forked from RustCrypto/formats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbody.rs
131 lines (124 loc) · 6.16 KB
/
body.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! PKIBody type
use der::asn1::Null;
use der::Choice;
use crmf::request::CertReqMessages;
use x509_cert::request::CertReq;
use crate::ann::{CaKeyUpdAnnContent, CertAnnContent, CrlAnnContent, RevAnnContent};
use crate::certified_key_pair::KeyRecRepContent;
use crate::gen::{GenMsgContent, GenRepContent};
use crate::message::PkiMessages;
use crate::poll::{PollRepContent, PollReqContent};
use crate::pop::{PopoDecKeyChallContent, PopoDecKeyRespContent};
use crate::response::CertRepMessage;
use crate::rev::{RevRepContent, RevReqContent};
use crate::status::{CertConfirmContent, ErrorMsgContent};
/// The `PKIBody` type is defined in [RFC 4210 Section 5.1.2]
///
/// ```text
/// PKIBody ::= CHOICE { -- message-specific body elements
/// ir [0] CertReqMessages, --Initialization Request
/// ip [1] CertRepMessage, --Initialization Response
/// cr [2] CertReqMessages, --Certification Request
/// cp [3] CertRepMessage, --Certification Response
/// p10cr [4] CertificationRequest, --imported from [PKCS10]
/// popdecc [5] POPODecKeyChallContent, --pop Challenge
/// popdecr [6] POPODecKeyRespContent, --pop Response
/// kur [7] CertReqMessages, --Key Update Request
/// kup [8] CertRepMessage, --Key Update Response
/// krr [9] CertReqMessages, --Key Recovery Request
/// krp [10] KeyRecRepContent, --Key Recovery Response
/// rr [11] RevReqContent, --Revocation Request
/// rp [12] RevRepContent, --Revocation Response
/// ccr [13] CertReqMessages, --Cross-Cert. Request
/// ccp [14] CertRepMessage, --Cross-Cert. Response
/// ckuann [15] CAKeyUpdAnnContent, --CA Key Update Ann.
/// cann [16] CertAnnContent, --Certificate Ann.
/// rann [17] RevAnnContent, --Revocation Ann.
/// crlann [18] CRLAnnContent, --CRL Announcement
/// pkiconf [19] PKIConfirmContent, --Confirmation
/// nested [20] NestedMessageContent, --Nested Message
/// genm [21] GenMsgContent, --General Message
/// genp [22] GenRepContent, --General Response
/// error [23] ErrorMsgContent, --Error Message
/// certConf [24] CertConfirmContent, --Certificate confirm
/// pollReq [25] PollReqContent, --Polling request
/// pollRep [26] PollRepContent --Polling response
/// }
/// ```
///
/// [RFC 4210 Section 5.1.2]: https://datatracker.ietf.org/doc/html/rfc4210#section-5.1.2
#[derive(Clone, Debug, Eq, PartialEq, Choice)]
#[allow(missing_docs)]
pub enum PkiBody<'a> {
#[asn1(context_specific = "0", tag_mode = "EXPLICIT", constructed = "true")]
Ir(CertReqMessages),
#[asn1(context_specific = "1", tag_mode = "EXPLICIT", constructed = "true")]
Ip(CertRepMessage<'a>),
#[asn1(context_specific = "2", tag_mode = "EXPLICIT", constructed = "true")]
Cr(CertReqMessages),
#[asn1(context_specific = "3", tag_mode = "EXPLICIT", constructed = "true")]
Cp(CertRepMessage<'a>),
#[asn1(context_specific = "4", tag_mode = "EXPLICIT", constructed = "true")]
P10cr(CertReq),
#[asn1(context_specific = "5", tag_mode = "EXPLICIT", constructed = "true")]
Popdecc(PopoDecKeyChallContent),
#[asn1(context_specific = "6", tag_mode = "EXPLICIT", constructed = "true")]
Popdecr(PopoDecKeyRespContent<'a>),
#[asn1(context_specific = "7", tag_mode = "EXPLICIT", constructed = "true")]
Kur(CertReqMessages),
#[asn1(context_specific = "8", tag_mode = "EXPLICIT", constructed = "true")]
Kup(CertRepMessage<'a>),
#[asn1(context_specific = "9", tag_mode = "EXPLICIT", constructed = "true")]
Krr(CertReqMessages),
#[asn1(context_specific = "10", tag_mode = "EXPLICIT", constructed = "true")]
Krp(KeyRecRepContent<'a>),
#[asn1(context_specific = "11", tag_mode = "EXPLICIT", constructed = "true")]
Rr(RevReqContent),
#[asn1(context_specific = "12", tag_mode = "EXPLICIT", constructed = "true")]
Rp(RevRepContent<'a>),
#[asn1(context_specific = "13", tag_mode = "EXPLICIT", constructed = "true")]
Ccr(CertReqMessages),
#[asn1(context_specific = "14", tag_mode = "EXPLICIT", constructed = "true")]
Ccp(CertRepMessage<'a>),
#[asn1(context_specific = "15", tag_mode = "EXPLICIT", constructed = "true")]
Ckuann(CaKeyUpdAnnContent),
#[asn1(context_specific = "16", tag_mode = "EXPLICIT", constructed = "true")]
Cann(CertAnnContent),
#[asn1(context_specific = "17", tag_mode = "EXPLICIT", constructed = "true")]
Rann(RevAnnContent),
#[asn1(context_specific = "18", tag_mode = "EXPLICIT", constructed = "true")]
CrlAnn(CrlAnnContent),
#[asn1(context_specific = "19", tag_mode = "EXPLICIT", constructed = "true")]
PkiConf(PkiConfirmContent),
// TODO address recursion error
// #[asn1(context_specific = "20", tag_mode = "EXPLICIT", constructed = "true")]
// Nested(NestedMessageContent<'a>),
#[asn1(context_specific = "21", tag_mode = "EXPLICIT", constructed = "true")]
GenM(GenMsgContent),
#[asn1(context_specific = "22", tag_mode = "EXPLICIT", constructed = "true")]
GenP(GenRepContent),
#[asn1(context_specific = "23", tag_mode = "EXPLICIT", constructed = "true")]
Error(ErrorMsgContent<'a>),
#[asn1(context_specific = "24", tag_mode = "EXPLICIT", constructed = "true")]
CertConf(CertConfirmContent<'a>),
#[asn1(context_specific = "25", tag_mode = "EXPLICIT", constructed = "true")]
PollReq(PollReqContent),
#[asn1(context_specific = "26", tag_mode = "EXPLICIT", constructed = "true")]
PollRep(PollRepContent<'a>),
}
/// The `PKIConfirmContent` type is defined in [RFC 4210 Section 5.3.17]
///
/// ```text
/// PKIConfirmContent ::= NULL
/// ```
///
/// [RFC 4210 Section 5.3.17]: https://www.rfc-editor.org/rfc/rfc4210#section-5.1.3.4
pub type PkiConfirmContent = Null;
/// The `PKIConfirmContent` type is defined in [RFC 4210 Section 5.3.17]
///
/// ```text
/// NestedMessageContent ::= PKIMessages
/// ```
///
/// [RFC 4210 Section 5.1.3.4]: https://www.rfc-editor.org/rfc/rfc4210#section-5.1.3.4
pub type NestedMessageContent<'a> = PkiMessages<'a>;