44use core:: str:: FromStr ;
55use der:: { SecretDocument , asn1:: OctetStringRef } ;
66
7- use crate :: { ALGORITHM_OID , PublicKey , ScalarValue } ;
7+ #[ cfg( feature = "pkcs8" ) ]
8+ use crate :: ALGORITHM_OID ;
9+ use crate :: { PublicKey , ScalarValue } ;
810use elliptic_curve:: { Error , Generate , array:: typenum:: Unsigned , zeroize:: Zeroizing } ;
11+ #[ cfg( feature = "pkcs8" ) ]
912use pkcs8:: {
1013 AssociatedOid , DecodePrivateKey , EncodePrivateKey , ObjectIdentifier ,
1114 spki:: { AlgorithmIdentifier , AssociatedAlgorithmIdentifier } ,
@@ -95,6 +98,7 @@ impl SecretKey {
9598 }
9699}
97100
101+ #[ cfg( feature = "pkcs8" ) ]
98102impl AssociatedAlgorithmIdentifier for SecretKey {
99103 type Params = ObjectIdentifier ;
100104 const ALGORITHM_IDENTIFIER : AlgorithmIdentifier < Self :: Params > = AlgorithmIdentifier {
@@ -135,6 +139,7 @@ impl Generate for SecretKey {
135139 }
136140}
137141
142+ #[ cfg( feature = "pkcs8" ) ]
138143impl TryFrom < pkcs8:: PrivateKeyInfoRef < ' _ > > for SecretKey {
139144 type Error = pkcs8:: Error ;
140145
@@ -156,6 +161,7 @@ impl FromStr for SecretKey {
156161 }
157162}
158163
164+ #[ cfg( feature = "pkcs8" ) ]
159165impl EncodePrivateKey for SecretKey {
160166 fn to_pkcs8_der ( & self ) -> pkcs8:: Result < SecretDocument > {
161167 let algorithm_identifier = pkcs8:: AlgorithmIdentifierRef {
0 commit comments