File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,10 @@ repository = "https://github.com/parallaxsecond/rust-cryptoki"
1414cryptoki = { path = " ../cryptoki" , version = " 0.6.1" }
1515der = " 0.7.8"
1616ecdsa = " 0.16.9"
17+ p224 = { version = " 0.13.2" , features = [" pkcs8" ] }
1718p256 = { version = " 0.13.2" , features = [" pkcs8" ] }
19+ p384 = { version = " 0.13.0" , features = [" pkcs8" ] }
20+ k256 = { version = " 0.13.2" , features = [" pkcs8" ] }
1821rsa = " 0.9"
1922signature = { version = " 2.2.0" , features = [" digest" ] }
2023sha1 = { version = " 0.10" , features = [" oid" ] }
Original file line number Diff line number Diff line change @@ -89,12 +89,21 @@ pub trait SignAlgorithm: PrimeCurve + CurveArithmetic + AssociatedOid + DigestPr
8989 fn sign_mechanism ( ) -> Mechanism < ' static > ;
9090}
9191
92- impl SignAlgorithm for p256:: NistP256 {
93- fn sign_mechanism ( ) -> Mechanism < ' static > {
94- Mechanism :: Ecdsa
95- }
92+ macro_rules! impl_sign_algorithm {
93+ ( $ec: ty) => {
94+ impl SignAlgorithm for $ec {
95+ fn sign_mechanism( ) -> Mechanism <' static > {
96+ Mechanism :: Ecdsa
97+ }
98+ }
99+ } ;
96100}
97101
102+ impl_sign_algorithm ! ( p224:: NistP224 ) ;
103+ impl_sign_algorithm ! ( p256:: NistP256 ) ;
104+ impl_sign_algorithm ! ( p384:: NistP384 ) ;
105+ impl_sign_algorithm ! ( k256:: Secp256k1 ) ;
106+
98107pub struct Signer < C : SignAlgorithm , S : SessionLike > {
99108 session : S ,
100109 private_key : ObjectHandle ,
You can’t perform that action at this time.
0 commit comments