2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
4
use cryptoki:: object:: { Attribute , AttributeType , KeyType , ObjectClass , ObjectHandle } ;
5
- use der:: AnyRef ;
6
- use rsa:: {
7
- pkcs1,
8
- pkcs1v15:: { Signature , VerifyingKey } ,
9
- } ;
10
- use spki:: { AlgorithmIdentifierRef , AssociatedAlgorithmIdentifier , SignatureAlgorithmIdentifier } ;
5
+ use rsa:: pkcs1v15:: { RsaSignatureAssociatedOid , Signature , VerifyingKey } ;
6
+ use spki:: { AlgorithmIdentifier , AssociatedAlgorithmIdentifier , SignatureAlgorithmIdentifier } ;
11
7
use std:: convert:: TryFrom ;
12
8
13
9
use super :: { read_key, DigestSigning , Error } ;
@@ -71,9 +67,14 @@ impl<D: DigestSigning, S: SessionLike> Signer<D, S> {
71
67
}
72
68
}
73
69
74
- impl < D : DigestSigning , S : SessionLike > AssociatedAlgorithmIdentifier for Signer < D , S > {
75
- type Params = AnyRef < ' static > ;
76
- const ALGORITHM_IDENTIFIER : AlgorithmIdentifierRef < ' static > = pkcs1:: ALGORITHM_ID ;
70
+ impl < D , S > AssociatedAlgorithmIdentifier for Signer < D , S >
71
+ where
72
+ D : DigestSigning ,
73
+ S : SessionLike ,
74
+ {
75
+ type Params = <VerifyingKey < D > as AssociatedAlgorithmIdentifier >:: Params ;
76
+ const ALGORITHM_IDENTIFIER : AlgorithmIdentifier < Self :: Params > =
77
+ <VerifyingKey < D > as AssociatedAlgorithmIdentifier >:: ALGORITHM_IDENTIFIER ;
77
78
}
78
79
79
80
impl < D : DigestSigning , S : SessionLike > signature:: Keypair for Signer < D , S > {
@@ -99,12 +100,13 @@ impl<D: DigestSigning, S: SessionLike> signature::Signer<Signature> for Signer<D
99
100
}
100
101
}
101
102
102
- impl < D : DigestSigning , S : SessionLike > SignatureAlgorithmIdentifier for Signer < D , S > {
103
- type Params = AnyRef < ' static > ;
103
+ impl < D , S > SignatureAlgorithmIdentifier for Signer < D , S >
104
+ where
105
+ S : SessionLike ,
106
+ D : DigestSigning + RsaSignatureAssociatedOid ,
107
+ {
108
+ type Params = <VerifyingKey < D > as SignatureAlgorithmIdentifier >:: Params ;
104
109
105
- const SIGNATURE_ALGORITHM_IDENTIFIER : AlgorithmIdentifierRef < ' static > =
106
- AlgorithmIdentifierRef {
107
- oid : D :: OID ,
108
- parameters : Some ( AnyRef :: NULL ) ,
109
- } ;
110
+ const SIGNATURE_ALGORITHM_IDENTIFIER : AlgorithmIdentifier < Self :: Params > =
111
+ <VerifyingKey < D > as SignatureAlgorithmIdentifier >:: SIGNATURE_ALGORITHM_IDENTIFIER ;
110
112
}
0 commit comments