@@ -29,43 +29,11 @@ use x509_certificate::{asn1time::*, rfc3280::*, rfc5280::*, rfc5652::*};
29
29
30
30
use crate :: asn1:: rfc3281:: AttributeCertificate ;
31
31
32
- /// The data content type.
33
- ///
34
- /// `id-data` in the specification.
35
- ///
36
- /// 1.2.840.113549.1.7.1
37
- pub const OID_ID_DATA : ConstOid = Oid ( & [ 42 , 134 , 72 , 134 , 247 , 13 , 1 , 7 , 1 ] ) ;
38
-
39
32
/// The signed-data content type.
40
33
///
41
34
/// 1.2.840.113549.1.7.2
42
35
pub const OID_ID_SIGNED_DATA : ConstOid = Oid ( & [ 42 , 134 , 72 , 134 , 247 , 13 , 1 , 7 , 2 ] ) ;
43
36
44
- /// Enveloped data content type.
45
- ///
46
- /// 1.2.840.113549.1.7.3
47
- pub const OID_ENVELOPE_DATA : ConstOid = Oid ( & [ 42 , 134 , 72 , 134 , 247 , 13 , 1 , 7 , 3 ] ) ;
48
-
49
- /// Digested-data content type.
50
- ///
51
- /// 1.2.840.113549.1.7.5
52
- pub const OID_DIGESTED_DATA : ConstOid = Oid ( & [ 42 , 134 , 72 , 134 , 247 , 13 , 1 , 7 , 5 ] ) ;
53
-
54
- /// Encrypted-data content type.
55
- ///
56
- /// 1.2.840.113549.1.7.6
57
- pub const OID_ENCRYPTED_DATA : ConstOid = Oid ( & [ 42 , 134 , 72 , 134 , 247 , 13 , 1 , 7 , 6 ] ) ;
58
-
59
- /// Authenticated-data content type.
60
- ///
61
- /// 1.2.840.113549.1.9.16.1.2
62
- pub const OID_AUTHENTICATED_DATA : ConstOid = Oid ( & [ 42 , 134 , 72 , 134 , 247 , 13 , 1 , 9 , 16 , 1 , 2 ] ) ;
63
-
64
- /// Identifies the content-type attribute.
65
- ///
66
- /// 1.2.840.113549.1.9.3
67
- pub const OID_CONTENT_TYPE : ConstOid = Oid ( & [ 42 , 134 , 72 , 134 , 247 , 13 , 1 , 9 , 3 ] ) ;
68
-
69
37
/// Identifies the message-digest attribute.
70
38
///
71
39
/// 1.2.840.113549.1.9.4
@@ -76,11 +44,6 @@ pub const OID_MESSAGE_DIGEST: ConstOid = Oid(&[42, 134, 72, 134, 247, 13, 1, 9,
76
44
/// 1.2.840.113549.1.9.5
77
45
pub const OID_SIGNING_TIME : ConstOid = Oid ( & [ 42 , 134 , 72 , 134 , 247 , 13 , 1 , 9 , 5 ] ) ;
78
46
79
- /// Identifies the countersignature attribute.
80
- ///
81
- /// 1.2.840.113549.1.9.6
82
- pub const OID_COUNTER_SIGNATURE : ConstOid = Oid ( & [ 42 , 134 , 72 , 134 , 247 , 13 , 1 , 9 , 6 ] ) ;
83
-
84
47
/// Content info.
85
48
///
86
49
/// ```ASN.1
@@ -158,23 +121,6 @@ pub struct SignedData {
158
121
}
159
122
160
123
impl SignedData {
161
- /// Attempt to decode BER encoded bytes to a parsed data structure.
162
- pub fn decode_ber ( data : & [ u8 ] ) -> Result < Self , DecodeError < std:: convert:: Infallible > > {
163
- Constructed :: decode ( data, bcder:: Mode :: Ber , Self :: decode)
164
- }
165
-
166
- pub fn decode < S : Source > ( cons : & mut Constructed < S > ) -> Result < Self , DecodeError < S :: Error > > {
167
- cons. take_sequence ( |cons| {
168
- let oid = Oid :: take_from ( cons) ?;
169
-
170
- if oid != OID_ID_SIGNED_DATA {
171
- return Err ( cons. content_err ( "expected signed data OID" ) ) ;
172
- }
173
-
174
- cons. take_constructed_if ( Tag :: CTX_0 , Self :: take_from)
175
- } )
176
- }
177
-
178
124
pub fn take_from < S : Source > ( cons : & mut Constructed < S > ) -> Result < Self , DecodeError < S :: Error > > {
179
125
cons. take_sequence ( |cons| {
180
126
let version = CmsVersion :: take_from ( cons) ?;
@@ -197,25 +143,6 @@ impl SignedData {
197
143
} )
198
144
} )
199
145
}
200
-
201
- pub fn encode_ref ( & self ) -> impl Values + ' _ {
202
- encode:: sequence ( (
203
- OID_ID_SIGNED_DATA . encode_ref ( ) ,
204
- encode:: sequence_as (
205
- Tag :: CTX_0 ,
206
- encode:: sequence ( (
207
- self . version . encode ( ) ,
208
- self . digest_algorithms . encode_ref ( ) ,
209
- self . content_info . encode_ref ( ) ,
210
- self . certificates
211
- . as_ref ( )
212
- . map ( |certs| certs. encode_ref_as ( Tag :: CTX_0 ) ) ,
213
- // TODO crls.
214
- self . signer_infos . encode_ref ( ) ,
215
- ) ) ,
216
- ) ,
217
- ) )
218
- }
219
146
}
220
147
221
148
/// Digest algorithm identifiers.
@@ -252,10 +179,6 @@ impl DigestAlgorithmIdentifiers {
252
179
Ok ( Self ( identifiers) )
253
180
} )
254
181
}
255
-
256
- pub fn encode_ref ( & self ) -> impl Values + ' _ {
257
- encode:: set ( & self . 0 )
258
- }
259
182
}
260
183
261
184
pub type DigestAlgorithmIdentifier = AlgorithmIdentifier ;
@@ -294,10 +217,6 @@ impl SignerInfos {
294
217
Ok ( Self ( infos) )
295
218
} )
296
219
}
297
-
298
- pub fn encode_ref ( & self ) -> impl Values + ' _ {
299
- encode:: set ( & self . 0 )
300
- }
301
220
}
302
221
303
222
/// Encapsulated content info.
@@ -343,15 +262,6 @@ impl EncapsulatedContentInfo {
343
262
} )
344
263
} )
345
264
}
346
-
347
- pub fn encode_ref ( & self ) -> impl Values + ' _ {
348
- encode:: sequence ( (
349
- self . content_type . encode_ref ( ) ,
350
- self . content
351
- . as_ref ( )
352
- . map ( |content| encode:: sequence_as ( Tag :: CTX_0 , content. encode_ref ( ) ) ) ,
353
- ) )
354
- }
355
265
}
356
266
357
267
/// Per-signer information.
@@ -647,10 +557,6 @@ impl DerefMut for SignedAttributes {
647
557
}
648
558
649
559
impl SignedAttributes {
650
- pub fn take_from < S : Source > ( cons : & mut Constructed < S > ) -> Result < Self , DecodeError < S :: Error > > {
651
- cons. take_set ( |cons| Self :: take_from_set ( cons) )
652
- }
653
-
654
560
pub fn take_from_set < S : Source > (
655
561
cons : & mut Constructed < S > ,
656
562
) -> Result < Self , DecodeError < S :: Error > > {
@@ -759,10 +665,6 @@ impl DerefMut for UnsignedAttributes {
759
665
}
760
666
761
667
impl UnsignedAttributes {
762
- pub fn take_from < S : Source > ( cons : & mut Constructed < S > ) -> Result < Self , DecodeError < S :: Error > > {
763
- cons. take_set ( |cons| Self :: take_from_set ( cons) )
764
- }
765
-
766
668
pub fn take_from_set < S : Source > (
767
669
cons : & mut Constructed < S > ,
768
670
) -> Result < Self , DecodeError < S :: Error > > {
@@ -846,6 +748,8 @@ pub type UnprotectedAttributes = Vec<Attribute>;
846
748
/// ori [4] OtherRecipientInfo }
847
749
/// ```
848
750
#[ derive( Clone , Debug , Eq , PartialEq ) ]
751
+ #[ allow( unused) ]
752
+ #[ allow( clippy:: enum_variant_names) ]
849
753
pub enum RecipientInfo {
850
754
KeyTransRecipientInfo ( KeyTransRecipientInfo ) ,
851
755
KeyAgreeRecipientInfo ( KeyAgreeRecipientInfo ) ,
@@ -881,6 +785,7 @@ pub struct KeyTransRecipientInfo {
881
785
/// subjectKeyIdentifier [0] SubjectKeyIdentifier }
882
786
/// ```
883
787
#[ derive( Clone , Debug , Eq , PartialEq ) ]
788
+ #[ allow( unused) ]
884
789
pub enum RecipientIdentifier {
885
790
IssuerAndSerialNumber ( IssuerAndSerialNumber ) ,
886
791
SubjectKeyIdentifier ( SubjectKeyIdentifier ) ,
@@ -914,6 +819,7 @@ pub struct KeyAgreeRecipientInfo {
914
819
/// originatorKey [1] OriginatorPublicKey }
915
820
/// ```
916
821
#[ derive( Clone , Debug , Eq , PartialEq ) ]
822
+ #[ allow( unused) ]
917
823
pub enum OriginatorIdentifierOrKey {
918
824
IssuerAndSerialNumber ( IssuerAndSerialNumber ) ,
919
825
SubjectKeyIdentifier ( SubjectKeyIdentifier ) ,
@@ -957,6 +863,7 @@ pub struct RecipientEncryptedKey {
957
863
/// rKeyId [0] IMPLICIT RecipientKeyIdentifier }
958
864
/// ```
959
865
#[ derive( Clone , Debug , Eq , PartialEq ) ]
866
+ #[ allow( unused) ]
960
867
pub enum KeyAgreeRecipientIdentifier {
961
868
IssuerAndSerialNumber ( IssuerAndSerialNumber ) ,
962
869
RKeyId ( RecipientKeyIdentifier ) ,
@@ -1135,6 +1042,7 @@ impl RevocationInfoChoices {
1135
1042
/// other [1] IMPLICIT OtherRevocationInfoFormat }
1136
1043
/// ```
1137
1044
#[ derive( Clone , Debug , Eq , PartialEq ) ]
1045
+ #[ allow( unused) ]
1138
1046
pub enum RevocationInfoChoice {
1139
1047
Crl ( Box < CertificateList > ) ,
1140
1048
Other ( OtherRevocationInfoFormat ) ,
@@ -1268,10 +1176,6 @@ impl CertificateSet {
1268
1176
1269
1177
Ok ( Self ( certs) )
1270
1178
}
1271
-
1272
- pub fn encode_ref_as ( & self , tag : Tag ) -> impl Values + ' _ {
1273
- encode:: set_as ( tag, & self . 0 )
1274
- }
1275
1179
}
1276
1180
1277
1181
/// Issuer and serial number.
@@ -1372,10 +1276,6 @@ pub struct OtherKeyAttribute {
1372
1276
1373
1277
pub type ContentType = Oid ;
1374
1278
1375
- pub type MessageDigest = OctetString ;
1376
-
1377
- pub type SigningTime = Time ;
1378
-
1379
1279
/// Time variant.
1380
1280
///
1381
1281
/// ```ASN.1
@@ -1416,6 +1316,4 @@ impl From<Time> for chrono::DateTime<chrono::Utc> {
1416
1316
}
1417
1317
}
1418
1318
1419
- pub type CounterSignature = SignerInfo ;
1420
-
1421
1319
pub type AttributeCertificateV2 = AttributeCertificate ;
0 commit comments