3
3
use crate :: { AlgorithmIdentifier , Error , Result } ;
4
4
use core:: cmp:: Ordering ;
5
5
use der:: {
6
- asn1:: { AnyRef , BitStringRef } ,
6
+ asn1:: { AnyLike , AnyRef , BitStringRef } ,
7
7
Choice , Decode , DecodeValue , DerOrd , Encode , EncodeValue , FixedTag , Header , Length , Reader ,
8
8
Sequence , ValueOrd , Writer ,
9
9
} ;
@@ -41,7 +41,7 @@ pub type SubjectPublicKeyInfoOwned = SubjectPublicKeyInfo<Any, BitString>;
41
41
/// [RFC 5280 § 4.1.2.7]: https://tools.ietf.org/html/rfc5280#section-4.1.2.7
42
42
#[ cfg_attr( feature = "arbitrary" , derive( arbitrary:: Arbitrary ) ) ]
43
43
#[ derive( Clone , Debug , Eq , PartialEq ) ]
44
- pub struct SubjectPublicKeyInfo < Params , Key > {
44
+ pub struct SubjectPublicKeyInfo < Params : AnyLike , Key > {
45
45
/// X.509 [`AlgorithmIdentifier`] for the public key type
46
46
pub algorithm : AlgorithmIdentifier < Params > ,
47
47
@@ -51,7 +51,7 @@ pub struct SubjectPublicKeyInfo<Params, Key> {
51
51
52
52
impl < ' a , Params , Key > SubjectPublicKeyInfo < Params , Key >
53
53
where
54
- Params : Choice < ' a , Error = der:: Error > + Encode ,
54
+ Params : AnyLike + Choice < ' a , Error = der:: Error > + Encode ,
55
55
// TODO: replace FixedTag with FixedTag<TAG = { Tag::BitString }> once
56
56
// https://github.com/rust-lang/rust/issues/92827 is fixed
57
57
Key : Decode < ' a , Error = der:: Error > + Encode + FixedTag ,
84
84
85
85
impl < ' a : ' k , ' k , Params , Key : ' k > DecodeValue < ' a > for SubjectPublicKeyInfo < Params , Key >
86
86
where
87
- Params : Choice < ' a , Error = der:: Error > + Encode ,
87
+ Params : AnyLike + Choice < ' a , Error = der:: Error > + Encode ,
88
88
Key : Decode < ' a , Error = der:: Error > ,
89
89
{
90
90
type Error = der:: Error ;
@@ -101,7 +101,7 @@ where
101
101
102
102
impl < ' a , Params , Key > EncodeValue for SubjectPublicKeyInfo < Params , Key >
103
103
where
104
- Params : Choice < ' a , Error = der:: Error > + Encode ,
104
+ Params : AnyLike + Choice < ' a , Error = der:: Error > + Encode ,
105
105
Key : Encode ,
106
106
{
107
107
fn value_len ( & self ) -> der:: Result < Length > {
@@ -117,14 +117,14 @@ where
117
117
118
118
impl < ' a , Params , Key > Sequence < ' a > for SubjectPublicKeyInfo < Params , Key >
119
119
where
120
- Params : Choice < ' a , Error = der:: Error > + Encode ,
120
+ Params : AnyLike + Choice < ' a , Error = der:: Error > + Encode ,
121
121
Key : Decode < ' a , Error = der:: Error > + Encode + FixedTag ,
122
122
{
123
123
}
124
124
125
125
impl < ' a , Params , Key > TryFrom < & ' a [ u8 ] > for SubjectPublicKeyInfo < Params , Key >
126
126
where
127
- Params : Choice < ' a , Error = der:: Error > + Encode ,
127
+ Params : AnyLike + Choice < ' a , Error = der:: Error > + Encode ,
128
128
Key : Decode < ' a , Error = der:: Error > + Encode + FixedTag ,
129
129
{
130
130
type Error = Error ;
@@ -136,7 +136,7 @@ where
136
136
137
137
impl < ' a , Params , Key > ValueOrd for SubjectPublicKeyInfo < Params , Key >
138
138
where
139
- Params : Choice < ' a , Error = der:: Error > + DerOrd + Encode ,
139
+ Params : AnyLike + Choice < ' a , Error = der:: Error > + DerOrd + Encode ,
140
140
Key : ValueOrd ,
141
141
{
142
142
fn value_cmp ( & self , other : & Self ) -> der:: Result < Ordering > {
@@ -150,7 +150,7 @@ where
150
150
#[ cfg( feature = "alloc" ) ]
151
151
impl < ' a : ' k , ' k , Params , Key : ' k > TryFrom < SubjectPublicKeyInfo < Params , Key > > for Document
152
152
where
153
- Params : Choice < ' a , Error = der:: Error > + Encode ,
153
+ Params : AnyLike + Choice < ' a , Error = der:: Error > + Encode ,
154
154
Key : Decode < ' a , Error = der:: Error > + Encode + FixedTag ,
155
155
BitStringRef < ' a > : From < & ' k Key > ,
156
156
{
@@ -164,7 +164,7 @@ where
164
164
#[ cfg( feature = "alloc" ) ]
165
165
impl < ' a : ' k , ' k , Params , Key : ' k > TryFrom < & SubjectPublicKeyInfo < Params , Key > > for Document
166
166
where
167
- Params : Choice < ' a , Error = der:: Error > + Encode ,
167
+ Params : AnyLike + Choice < ' a , Error = der:: Error > + Encode ,
168
168
Key : Decode < ' a , Error = der:: Error > + Encode + FixedTag ,
169
169
BitStringRef < ' a > : From < & ' k Key > ,
170
170
{
@@ -176,7 +176,10 @@ where
176
176
}
177
177
178
178
#[ cfg( feature = "pem" ) ]
179
- impl < Params , Key > PemLabel for SubjectPublicKeyInfo < Params , Key > {
179
+ impl < Params , Key > PemLabel for SubjectPublicKeyInfo < Params , Key >
180
+ where
181
+ Params : AnyLike ,
182
+ {
180
183
const PEM_LABEL : & ' static str = "PUBLIC KEY" ;
181
184
}
182
185
0 commit comments