Skip to content
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkcs8/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ der = { version = "0.8.0-rc.12", features = ["oid"] }
spki = "0.8"

# optional dependencies
rand_core = { version = "0.10", optional = true, default-features = false }
ctutils = { version = "0.4", optional = true }
pkcs5 = { version = "0.8", optional = true, features = ["rand_core"] }
subtle = { version = "2", optional = true, default-features = false }
rand_core = { version = "0.10", optional = true, default-features = false }

[dev-dependencies]
hex-literal = "1"
Expand Down
19 changes: 8 additions & 11 deletions pkcs8/src/private_key_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@ use der::{
};
use spki::AlgorithmIdentifier;

#[cfg(feature = "ctutils")]
use ctutils::{Choice, CtEq};
#[cfg(feature = "pem")]
use der::pem::PemLabel;
#[cfg(feature = "alloc")]
use der::{
SecretDocument,
asn1::{Any, BitString, OctetString},
};

#[cfg(feature = "encryption")]
use {
crate::EncryptedPrivateKeyInfoRef, der::zeroize::Zeroizing, pkcs5::pbes2, rand_core::CryptoRng,
};

#[cfg(feature = "pem")]
use der::pem::PemLabel;

#[cfg(feature = "subtle")]
use subtle::{Choice, ConstantTimeEq};

/// Context-specific tag number for attributes.
const ATTRIBUTES_TAG: TagNumber = TagNumber(0);

Expand Down Expand Up @@ -336,8 +333,8 @@ impl<Params, Key, PubKey> PemLabel for PrivateKeyInfo<Params, Key, PubKey> {
const PEM_LABEL: &'static str = "PRIVATE KEY";
}

#[cfg(feature = "subtle")]
impl<Params, Key, PubKey> ConstantTimeEq for PrivateKeyInfo<Params, Key, PubKey>
#[cfg(feature = "ctutils")]
impl<Params, Key, PubKey> CtEq for PrivateKeyInfo<Params, Key, PubKey>
where
Params: Eq,
Key: PartialEq + AsRef<[u8]>,
Expand All @@ -353,7 +350,7 @@ where
}
}

#[cfg(feature = "subtle")]
#[cfg(feature = "ctutils")]
impl<Params, Key, PubKey> Eq for PrivateKeyInfo<Params, Key, PubKey>
where
Params: Eq,
Expand All @@ -362,7 +359,7 @@ where
{
}

#[cfg(feature = "subtle")]
#[cfg(feature = "ctutils")]
impl<Params, Key, PubKey> PartialEq for PrivateKeyInfo<Params, Key, PubKey>
where
Params: Eq,
Expand Down
2 changes: 1 addition & 1 deletion pkcs8/tests/private_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fn encode_ed25519_der_v1() {
}

#[test]
#[cfg(all(feature = "alloc", feature = "subtle"))]
#[cfg(all(feature = "alloc", feature = "ctutils"))]
fn encode_ed25519_der_v2() {
let private_key = PrivateKeyInfoRef::try_from(ED25519_DER_V2_EXAMPLE).unwrap();
let private_der = private_key.to_der().unwrap();
Expand Down
Loading