diff --git a/ecdsa/src/signing.rs b/ecdsa/src/signing.rs index 5a551627..6d5d7f61 100644 --- a/ecdsa/src/signing.rs +++ b/ecdsa/src/signing.rs @@ -25,10 +25,7 @@ use signature::{ use {crate::der, core::ops::Add, elliptic_curve::FieldBytesSize}; #[cfg(feature = "pem")] -use { - core::str::FromStr, - elliptic_curve::pkcs8::{DecodePrivateKey, EncodePrivateKey, SecretDocument}, -}; +use {core::str::FromStr, elliptic_curve::pkcs8::DecodePrivateKey}; #[cfg(feature = "pkcs8")] use crate::elliptic_curve::{ @@ -45,6 +42,9 @@ use crate::elliptic_curve::{ #[cfg(feature = "verifying")] use {crate::VerifyingKey, elliptic_curve::PublicKey, signature::KeypairRef}; +#[cfg(all(feature = "alloc", feature = "pkcs8"))] +use elliptic_curve::pkcs8::{EncodePrivateKey, SecretDocument}; + /// ECDSA secret key used for signing. Generic over prime order elliptic curves /// (e.g. NIST P-curves) /// @@ -567,7 +567,7 @@ where } } -#[cfg(feature = "pem")] +#[cfg(all(feature = "alloc", feature = "pkcs8"))] impl EncodePrivateKey for SigningKey where C: AssociatedOid + PrimeCurve + CurveArithmetic, diff --git a/ecdsa/src/verifying.rs b/ecdsa/src/verifying.rs index eabdb6d8..db4d6bf5 100644 --- a/ecdsa/src/verifying.rs +++ b/ecdsa/src/verifying.rs @@ -425,7 +425,7 @@ where } } -#[cfg(feature = "pem")] +#[cfg(all(feature = "alloc", feature = "pkcs8"))] impl EncodePublicKey for VerifyingKey where C: PrimeCurve + AssociatedOid + CurveArithmetic + PointCompression,