1
1
//! Traits for encoding/decoding SPKI public keys.
2
2
3
3
use crate :: { AlgorithmIdentifier , Error , Result , SubjectPublicKeyInfoRef } ;
4
+ use der:: { EncodeValue , Tagged } ;
4
5
5
6
#[ cfg( feature = "alloc" ) ]
6
7
use {
7
8
crate :: AlgorithmIdentifierOwned ,
8
- der:: { Any , Document , EncodeValue , Tagged } ,
9
+ der:: { Any , Document } ,
9
10
} ;
10
11
11
12
#[ cfg( feature = "pem" ) ]
@@ -102,7 +103,7 @@ pub trait EncodePublicKey {
102
103
/// This is useful for e.g. keys for digital signature algorithms.
103
104
pub trait AssociatedAlgorithmIdentifier {
104
105
/// Algorithm parameters.
105
- type Params : der :: Encode ;
106
+ type Params : Tagged + EncodeValue ;
106
107
107
108
/// `AlgorithmIdentifier` for this structure.
108
109
const ALGORITHM_IDENTIFIER : AlgorithmIdentifier < Self :: Params > ;
@@ -121,7 +122,6 @@ pub trait DynAssociatedAlgorithmIdentifier {
121
122
impl < T > DynAssociatedAlgorithmIdentifier for T
122
123
where
123
124
T : AssociatedAlgorithmIdentifier ,
124
- T :: Params : Tagged + EncodeValue ,
125
125
{
126
126
fn algorithm_identifier ( & self ) -> Result < AlgorithmIdentifierOwned > {
127
127
Ok ( AlgorithmIdentifierOwned {
@@ -141,7 +141,7 @@ where
141
141
/// private keys.
142
142
pub trait SignatureAlgorithmIdentifier {
143
143
/// Algorithm parameters.
144
- type Params : der :: Encode ;
144
+ type Params : Tagged + EncodeValue ;
145
145
146
146
/// `AlgorithmIdentifier` for the corresponding singature system.
147
147
const SIGNATURE_ALGORITHM_IDENTIFIER : AlgorithmIdentifier < Self :: Params > ;
@@ -161,7 +161,6 @@ pub trait DynSignatureAlgorithmIdentifier {
161
161
impl < T > DynSignatureAlgorithmIdentifier for T
162
162
where
163
163
T : SignatureAlgorithmIdentifier ,
164
- T :: Params : Tagged + EncodeValue ,
165
164
{
166
165
fn signature_algorithm_identifier ( & self ) -> Result < AlgorithmIdentifierOwned > {
167
166
Ok ( AlgorithmIdentifierOwned {
0 commit comments