@@ -26,10 +26,8 @@ use alloc::{
2626 vec:: Vec ,
2727} ;
2828use cipher:: {
29- BlockModeEncrypt , Iv , Key , KeyIvInit ,
30- block_padding:: Pkcs7 ,
31- crypto_common:: Generate ,
32- rand_core:: { CryptoRng , RngCore } ,
29+ BlockModeEncrypt , Iv , Key , KeyIvInit , block_padding:: Pkcs7 , crypto_common:: Generate ,
30+ rand_core:: CryptoRng ,
3331} ;
3432use const_oid:: ObjectIdentifier ;
3533use core:: { cmp:: Ordering , fmt, marker:: PhantomData } ;
@@ -439,7 +437,7 @@ impl<'s> SignedDataBuilder<'s> {
439437 S : RandomizedSigner < Signature > ,
440438 S :: VerifyingKey : EncodePublicKey ,
441439 Signature : SignatureBitStringEncoding ,
442- R : CryptoRng + RngCore + ?Sized ,
440+ R : CryptoRng + ?Sized ,
443441 {
444442 let signer_info = signer_info_builder
445443 . build_with_rng :: < S , Signature , R > ( signer, rng)
@@ -484,7 +482,7 @@ impl<'s> SignedDataBuilder<'s> {
484482 S : AsyncRandomizedSigner < Signature > ,
485483 S :: VerifyingKey : EncodePublicKey ,
486484 Signature : SignatureBitStringEncoding ,
487- R : CryptoRng + RngCore + ?Sized ,
485+ R : CryptoRng + ?Sized ,
488486 {
489487 let signer_info = signer_info_builder
490488 . build_with_rng_async :: < S , Signature , R > ( signer, rng)
@@ -608,7 +606,7 @@ impl<'s> SignedDataBuilder<'s> {
608606/// formats. All implementations must implement this trait.
609607pub trait RecipientInfoBuilder {
610608 /// Associated Rng type
611- type Rng : CryptoRng + RngCore + ?Sized ;
609+ type Rng : CryptoRng + ?Sized ;
612610
613611 /// Return the recipient info type
614612 fn recipient_info_type ( & self ) -> RecipientInfoType ;
@@ -670,9 +668,9 @@ impl<R> KeyTransRecipientInfoBuilder<R> {
670668 }
671669}
672670
673- impl < R > RecipientInfoBuilder for KeyTransRecipientInfoBuilder < R >
671+ impl < R : ? Sized > RecipientInfoBuilder for KeyTransRecipientInfoBuilder < R >
674672where
675- R : CryptoRng + RngCore + ? Sized ,
673+ R : CryptoRng ,
676674{
677675 type Rng = R ;
678676
@@ -741,9 +739,9 @@ impl<R> KekRecipientInfoBuilder<R> {
741739 }
742740}
743741
744- impl < R > RecipientInfoBuilder for KekRecipientInfoBuilder < R >
742+ impl < R : ? Sized > RecipientInfoBuilder for KekRecipientInfoBuilder < R >
745743where
746- R : CryptoRng + RngCore + ? Sized ,
744+ R : CryptoRng ,
747745{
748746 type Rng = R ;
749747
@@ -784,7 +782,7 @@ pub trait PwriEncryptor {
784782 /// including eventual parameters (e.g. the used iv).
785783 fn key_encryption_algorithm ( & self ) -> Result < AlgorithmIdentifierOwned > ;
786784 /// Encrypt the padded content-encryption key twice following RFC 3211, § 2.3.1
787- fn encrypt_rfc3211 < R : CryptoRng + RngCore + ?Sized > (
785+ fn encrypt_rfc3211 < R : CryptoRng + ?Sized > (
788786 & mut self ,
789787 padded_content_encryption_key : & [ u8 ] ,
790788 rng : & mut R ,
@@ -832,10 +830,10 @@ where
832830 }
833831}
834832
835- impl < P , R > PasswordRecipientInfoBuilder < P , R >
833+ impl < P , R : ? Sized > PasswordRecipientInfoBuilder < P , R >
836834where
837835 P : PwriEncryptor ,
838- R : CryptoRng + RngCore + ? Sized ,
836+ R : CryptoRng ,
839837{
840838 /// Wrap the content-encryption key according to [RFC 3211, §2.3.1]:
841839 /// ....
@@ -876,7 +874,7 @@ where
876874impl < P , R > RecipientInfoBuilder for PasswordRecipientInfoBuilder < P , R >
877875where
878876 P : PwriEncryptor ,
879- R : CryptoRng + RngCore + ?Sized ,
877+ R : CryptoRng + ?Sized ,
880878{
881879 type Rng = R ;
882880
@@ -935,7 +933,7 @@ impl<R> OtherRecipientInfoBuilder<R> {
935933
936934impl < R > RecipientInfoBuilder for OtherRecipientInfoBuilder < R >
937935where
938- R : CryptoRng + RngCore + ?Sized ,
936+ R : CryptoRng + ?Sized ,
939937{
940938 type Rng = R ;
941939
@@ -1019,7 +1017,7 @@ impl<'c, R> EnvelopedDataBuilder<'c, R> {
10191017
10201018impl < ' c , R > EnvelopedDataBuilder < ' c , R >
10211019where
1022- R : CryptoRng + RngCore + ?Sized ,
1020+ R : CryptoRng + ?Sized ,
10231021{
10241022 /// Add recipient info. A builder is used, which generates a `RecipientInfo` according to
10251023 /// RFC 5652 § 6.2, when `EnvelopedData` is built.
@@ -1216,7 +1214,7 @@ fn encrypt_data<R>(
12161214 rng : & mut R ,
12171215) -> Result < ( Vec < u8 > , Vec < u8 > , AlgorithmIdentifierOwned ) >
12181216where
1219- R : CryptoRng + RngCore + ?Sized ,
1217+ R : CryptoRng + ?Sized ,
12201218{
12211219 match encryption_algorithm_identifier {
12221220 ContentEncryptionAlgorithm :: Aes128Cbc => encrypt_block_mode ! (
0 commit comments