@@ -81,6 +81,21 @@ pub use signature::{self, Error, SignatureEncoding};
8181
8282use core:: fmt;
8383
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+
8499/// Size of a single component of an Ed448 signature.
85100pub const COMPONENT_SIZE : usize = 57 ;
86101
@@ -208,3 +223,17 @@ impl fmt::Display for Signature {
208223 write ! ( f, "{:X}" , self )
209224 }
210225}
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