22// 2.0, and the BSD License. See the LICENSE file in the root of this repository
33// for complete details.
44
5+ use crate :: common:: Asn1Operation ;
56use crate :: { certificate, common, csr, name} ;
67
78pub const PKCS7_DATA_OID : asn1:: ObjectIdentifier = asn1:: oid!( 1 , 2 , 840 , 113549 , 1 , 7 , 1 ) ;
@@ -10,54 +11,38 @@ pub const PKCS7_ENVELOPED_DATA_OID: asn1::ObjectIdentifier = asn1::oid!(1, 2, 84
1011pub const PKCS7_ENCRYPTED_DATA_OID : asn1:: ObjectIdentifier = asn1:: oid!( 1 , 2 , 840 , 113549 , 1 , 7 , 6 ) ;
1112
1213#[ derive( asn1:: Asn1Write , asn1:: Asn1Read ) ]
13- pub struct ContentInfo < ' a > {
14+ pub struct ContentInfo < ' a , Op : Asn1Operation > {
1415 pub _content_type : asn1:: DefinedByMarker < asn1:: ObjectIdentifier > ,
1516
1617 #[ defined_by( _content_type) ]
17- pub content : Content < ' a > ,
18+ pub content : Content < ' a , Op > ,
1819}
1920
2021#[ derive( asn1:: Asn1DefinedByWrite , asn1:: Asn1DefinedByRead ) ]
21- pub enum Content < ' a > {
22+ pub enum Content < ' a , Op : Asn1Operation > {
2223 #[ defined_by( PKCS7_ENVELOPED_DATA_OID ) ]
23- EnvelopedData ( asn1:: Explicit < Box < EnvelopedData < ' a > > , 0 > ) ,
24+ EnvelopedData ( asn1:: Explicit < Box < EnvelopedData < ' a , Op > > , 0 > ) ,
2425 #[ defined_by( PKCS7_SIGNED_DATA_OID ) ]
25- SignedData ( asn1:: Explicit < Box < SignedData < ' a > > , 0 > ) ,
26+ SignedData ( asn1:: Explicit < Box < SignedData < ' a , Op > > , 0 > ) ,
2627 #[ defined_by( PKCS7_DATA_OID ) ]
2728 Data ( Option < asn1:: Explicit < & ' a [ u8 ] , 0 > > ) ,
2829 #[ defined_by( PKCS7_ENCRYPTED_DATA_OID ) ]
2930 EncryptedData ( asn1:: Explicit < EncryptedData < ' a > , 0 > ) ,
3031}
3132
3233#[ derive( asn1:: Asn1Write , asn1:: Asn1Read ) ]
33- pub struct SignedData < ' a > {
34+ pub struct SignedData < ' a , Op : Asn1Operation > {
3435 pub version : u8 ,
35- pub digest_algorithms : common:: Asn1ReadableOrWritable <
36- asn1:: SetOf < ' a , common:: AlgorithmIdentifier < ' a > > ,
37- asn1:: SetOfWriter < ' a , common:: AlgorithmIdentifier < ' a > > ,
38- > ,
39- pub content_info : ContentInfo < ' a > ,
36+ pub digest_algorithms : Op :: SetOf < ' a , common:: AlgorithmIdentifier < ' a > > ,
37+ pub content_info : ContentInfo < ' a , Op > ,
4038 #[ implicit( 0 ) ]
41- pub certificates : Option <
42- common:: Asn1ReadableOrWritable <
43- asn1:: SetOf < ' a , certificate:: Certificate < ' a > > ,
44- asn1:: SetOfWriter < ' a , certificate:: Certificate < ' a > > ,
45- > ,
46- > ,
39+ pub certificates : Option < Op :: SetOf < ' a , certificate:: Certificate < ' a > > > ,
4740
4841 // We don't ever supply any of these, so for now, don't fill out the fields.
4942 #[ implicit( 1 ) ]
50- pub crls : Option <
51- common:: Asn1ReadableOrWritable <
52- asn1:: SetOf < ' a , asn1:: Sequence < ' a > > ,
53- asn1:: SetOfWriter < ' a , asn1:: Sequence < ' a > > ,
54- > ,
55- > ,
56-
57- pub signer_infos : common:: Asn1ReadableOrWritable <
58- asn1:: SetOf < ' a , SignerInfo < ' a > > ,
59- asn1:: SetOfWriter < ' a , SignerInfo < ' a > > ,
60- > ,
43+ pub crls : Option < Op :: SetOf < ' a , asn1:: Sequence < ' a > > > ,
44+
45+ pub signer_infos : Op :: SetOf < ' a , SignerInfo < ' a > > ,
6146}
6247
6348#[ derive( asn1:: Asn1Write , asn1:: Asn1Read ) ]
@@ -76,12 +61,9 @@ pub struct SignerInfo<'a> {
7661}
7762
7863#[ derive( asn1:: Asn1Write , asn1:: Asn1Read ) ]
79- pub struct EnvelopedData < ' a > {
64+ pub struct EnvelopedData < ' a , Op : Asn1Operation > {
8065 pub version : u8 ,
81- pub recipient_infos : common:: Asn1ReadableOrWritable <
82- asn1:: SetOf < ' a , RecipientInfo < ' a > > ,
83- asn1:: SetOfWriter < ' a , RecipientInfo < ' a > > ,
84- > ,
66+ pub recipient_infos : Op :: SetOf < ' a , RecipientInfo < ' a > > ,
8567 pub encrypted_content_info : EncryptedContentInfo < ' a > ,
8668}
8769
0 commit comments