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"
14
14
cryptoki = { path = " ../cryptoki" , version = " 0.6.1" }
15
15
der = " 0.7.8"
16
16
ecdsa = " 0.16.9"
17
+ p224 = { version = " 0.13.2" , features = [" pkcs8" ] }
17
18
p256 = { version = " 0.13.2" , features = [" pkcs8" ] }
19
+ p384 = { version = " 0.13.0" , features = [" pkcs8" ] }
20
+ k256 = { version = " 0.13.2" , features = [" pkcs8" ] }
18
21
rsa = " 0.9"
19
22
signature = { version = " 2.2.0" , features = [" digest" ] }
20
23
sha1 = { 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
89
89
fn sign_mechanism ( ) -> Mechanism < ' static > ;
90
90
}
91
91
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
+ } ;
96
100
}
97
101
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
+
98
107
pub struct Signer < C : SignAlgorithm , S : SessionLike > {
99
108
session : S ,
100
109
private_key : ObjectHandle ,
You can’t perform that action at this time.
0 commit comments