@@ -81,6 +81,21 @@ pub use signature::{self, Error, SignatureEncoding};
81
81
82
82
use core:: fmt;
83
83
84
+ #[ cfg( feature = "pkcs8" ) ]
85
+ pub use crate :: pkcs8:: {
86
+ KeypairBytes , PublicKeyBytes ,
87
+ spki:: {
88
+ AlgorithmIdentifierRef , AssociatedAlgorithmIdentifier ,
89
+ der:: { AnyRef , oid:: ObjectIdentifier } ,
90
+ } ,
91
+ } ;
92
+
93
+ #[ cfg( all( feature = "alloc" , feature = "pkcs8" ) ) ]
94
+ use pkcs8:: spki:: {
95
+ SignatureBitStringEncoding ,
96
+ der:: { self , asn1:: BitString } ,
97
+ } ;
98
+
84
99
/// Size of a single component of an Ed448 signature.
85
100
pub const COMPONENT_SIZE : usize = 57 ;
86
101
@@ -208,3 +223,17 @@ impl fmt::Display for Signature {
208
223
write ! ( f, "{:X}" , self )
209
224
}
210
225
}
226
+
227
+ #[ cfg( all( feature = "alloc" , feature = "pkcs8" ) ) ]
228
+ impl SignatureBitStringEncoding for Signature {
229
+ fn to_bitstring ( & self ) -> der:: Result < BitString > {
230
+ BitString :: new ( 0 , self . to_bytes ( ) )
231
+ }
232
+ }
233
+
234
+ #[ cfg( feature = "pkcs8" ) ]
235
+ impl AssociatedAlgorithmIdentifier for Signature {
236
+ type Params = AnyRef < ' static > ;
237
+
238
+ const ALGORITHM_IDENTIFIER : AlgorithmIdentifierRef < ' static > = pkcs8:: ALGORITHM_ID ;
239
+ }
0 commit comments