2
2
// 2.0, and the BSD License. See the LICENSE file in the root of this repository
3
3
// for complete details.
4
4
5
+ use crate :: common:: Asn1Operation ;
5
6
use crate :: { certificate, common, csr, name} ;
6
7
7
8
pub 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
10
11
pub const PKCS7_ENCRYPTED_DATA_OID : asn1:: ObjectIdentifier = asn1:: oid!( 1 , 2 , 840 , 113549 , 1 , 7 , 6 ) ;
11
12
12
13
#[ derive( asn1:: Asn1Write , asn1:: Asn1Read ) ]
13
- pub struct ContentInfo < ' a > {
14
+ pub struct ContentInfo < ' a , Op : Asn1Operation > {
14
15
pub _content_type : asn1:: DefinedByMarker < asn1:: ObjectIdentifier > ,
15
16
16
17
#[ defined_by( _content_type) ]
17
- pub content : Content < ' a > ,
18
+ pub content : Content < ' a , Op > ,
18
19
}
19
20
20
21
#[ derive( asn1:: Asn1DefinedByWrite , asn1:: Asn1DefinedByRead ) ]
21
- pub enum Content < ' a > {
22
+ pub enum Content < ' a , Op : Asn1Operation > {
22
23
#[ defined_by( PKCS7_ENVELOPED_DATA_OID ) ]
23
- EnvelopedData ( asn1:: Explicit < Box < EnvelopedData < ' a > > , 0 > ) ,
24
+ EnvelopedData ( asn1:: Explicit < Box < EnvelopedData < ' a , Op > > , 0 > ) ,
24
25
#[ defined_by( PKCS7_SIGNED_DATA_OID ) ]
25
- SignedData ( asn1:: Explicit < Box < SignedData < ' a > > , 0 > ) ,
26
+ SignedData ( asn1:: Explicit < Box < SignedData < ' a , Op > > , 0 > ) ,
26
27
#[ defined_by( PKCS7_DATA_OID ) ]
27
28
Data ( Option < asn1:: Explicit < & ' a [ u8 ] , 0 > > ) ,
28
29
#[ defined_by( PKCS7_ENCRYPTED_DATA_OID ) ]
29
30
EncryptedData ( asn1:: Explicit < EncryptedData < ' a > , 0 > ) ,
30
31
}
31
32
32
33
#[ derive( asn1:: Asn1Write , asn1:: Asn1Read ) ]
33
- pub struct SignedData < ' a > {
34
+ pub struct SignedData < ' a , Op : Asn1Operation > {
34
35
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 > ,
40
38
#[ 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 > > > ,
47
40
48
41
// We don't ever supply any of these, so for now, don't fill out the fields.
49
42
#[ 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 > > ,
61
46
}
62
47
63
48
#[ derive( asn1:: Asn1Write , asn1:: Asn1Read ) ]
@@ -76,12 +61,9 @@ pub struct SignerInfo<'a> {
76
61
}
77
62
78
63
#[ derive( asn1:: Asn1Write , asn1:: Asn1Read ) ]
79
- pub struct EnvelopedData < ' a > {
64
+ pub struct EnvelopedData < ' a , Op : Asn1Operation > {
80
65
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 > > ,
85
67
pub encrypted_content_info : EncryptedContentInfo < ' a > ,
86
68
}
87
69
0 commit comments