diff --git a/pkcs8/src/encrypted_private_key_info.rs b/pkcs8/src/encrypted_private_key_info.rs index 0a7cd812e..91b99d680 100644 --- a/pkcs8/src/encrypted_private_key_info.rs +++ b/pkcs8/src/encrypted_private_key_info.rs @@ -12,7 +12,7 @@ use pkcs5::EncryptionScheme; use der::{SecretDocument, asn1::OctetString}; #[cfg(feature = "encryption")] -use {pkcs5::pbes2, rand_core::CryptoRng}; +use {pkcs5::pbes2, rand_core::TryCryptoRng}; #[cfg(feature = "pem")] use der::pem::PemLabel; @@ -68,7 +68,7 @@ where /// Encrypt the given ASN.1 DER document using a symmetric encryption key /// derived from the provided password. #[cfg(feature = "encryption")] - pub(crate) fn encrypt( + pub(crate) fn encrypt( rng: &mut R, password: impl AsRef<[u8]>, doc: &[u8], diff --git a/pkcs8/src/private_key_info.rs b/pkcs8/src/private_key_info.rs index 8c7d27c3f..50d0fb148 100644 --- a/pkcs8/src/private_key_info.rs +++ b/pkcs8/src/private_key_info.rs @@ -20,7 +20,8 @@ use der::{ }; #[cfg(feature = "encryption")] use { - crate::EncryptedPrivateKeyInfoRef, der::zeroize::Zeroizing, pkcs5::pbes2, rand_core::CryptoRng, + crate::EncryptedPrivateKeyInfoRef, der::zeroize::Zeroizing, pkcs5::pbes2, + rand_core::TryCryptoRng, }; /// Context-specific tag number for attributes. @@ -149,7 +150,7 @@ where /// - Propagates errors from calling [`Encode::to_der`] on `Self`. /// - Returns errors in the event encryption failed. #[cfg(feature = "encryption")] - pub fn encrypt( + pub fn encrypt( &self, rng: &mut R, password: impl AsRef<[u8]>, diff --git a/pkcs8/src/traits.rs b/pkcs8/src/traits.rs index a0b6b71e0..1bf738d48 100644 --- a/pkcs8/src/traits.rs +++ b/pkcs8/src/traits.rs @@ -6,7 +6,7 @@ use crate::{Error, PrivateKeyInfoRef, Result}; use der::SecretDocument; #[cfg(feature = "encryption")] -use {crate::EncryptedPrivateKeyInfoRef, rand_core::CryptoRng}; +use {crate::EncryptedPrivateKeyInfoRef, rand_core::TryCryptoRng}; #[cfg(feature = "pem")] use { @@ -131,7 +131,7 @@ pub trait EncodePrivateKey { /// - Returns format-specific errors in the event the document failed to serialize. /// - Returns algorithm-specific errors in the event the document couldn't be encrypted. #[cfg(feature = "encryption")] - fn to_pkcs8_encrypted_der( + fn to_pkcs8_encrypted_der( &self, rng: &mut R, password: impl AsRef<[u8]>, @@ -157,7 +157,7 @@ pub trait EncodePrivateKey { /// - Returns the same errors as [`EncodePrivateKey::to_pkcs8_encrypted_der`]. /// - Returns the same errors as [`SecretDocument::to_pem`]. #[cfg(all(feature = "encryption", feature = "pem"))] - fn to_pkcs8_encrypted_pem( + fn to_pkcs8_encrypted_pem( &self, rng: &mut R, password: impl AsRef<[u8]>,