Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecdsa: gate pkcs8::Encode*Key impls under alloc+pkcs8 #783

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ecdsa/src/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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)
///
Expand Down Expand Up @@ -567,7 +567,7 @@ where
}
}

#[cfg(feature = "pem")]
#[cfg(all(feature = "alloc", feature = "pkcs8"))]
impl<C> EncodePrivateKey for SigningKey<C>
where
C: AssociatedOid + PrimeCurve + CurveArithmetic,
Expand Down
10 changes: 5 additions & 5 deletions ecdsa/src/verifying.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ use alloc::boxed::Box;
use {crate::der, core::ops::Add};

#[cfg(feature = "pem")]
use {
core::str::FromStr,
elliptic_curve::pkcs8::{DecodePublicKey, EncodePublicKey},
};
use {core::str::FromStr, elliptic_curve::pkcs8::DecodePublicKey};

#[cfg(feature = "pkcs8")]
use elliptic_curve::pkcs8::{
Expand All @@ -45,6 +42,9 @@ use {
sha2::{Sha224, Sha256, Sha384, Sha512},
};

#[cfg(all(feature = "alloc", feature = "pkcs8"))]
use elliptic_curve::pkcs8::EncodePublicKey;

#[cfg(all(feature = "pem", feature = "serde"))]
use serdect::serde::{de, ser, Deserialize, Serialize};

Expand Down Expand Up @@ -425,7 +425,7 @@ where
}
}

#[cfg(feature = "pem")]
#[cfg(all(feature = "alloc", feature = "pkcs8"))]
impl<C> EncodePublicKey for VerifyingKey<C>
where
C: PrimeCurve + AssociatedOid + CurveArithmetic + PointCompression,
Expand Down