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
4 changes: 2 additions & 2 deletions pkcs8/src/encrypted_private_key_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<R: CryptoRng>(
pub(crate) fn encrypt<R: TryCryptoRng>(
rng: &mut R,
password: impl AsRef<[u8]>,
doc: &[u8],
Expand Down
5 changes: 3 additions & 2 deletions pkcs8/src/private_key_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<R: CryptoRng>(
pub fn encrypt<R: TryCryptoRng>(
&self,
rng: &mut R,
password: impl AsRef<[u8]>,
Expand Down
6 changes: 3 additions & 3 deletions pkcs8/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<R: CryptoRng>(
fn to_pkcs8_encrypted_der<R: TryCryptoRng>(
&self,
rng: &mut R,
password: impl AsRef<[u8]>,
Expand All @@ -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<R: CryptoRng>(
fn to_pkcs8_encrypted_pem<R: TryCryptoRng>(
&self,
rng: &mut R,
password: impl AsRef<[u8]>,
Expand Down