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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
"""
synta.crmf — RFC 4211 Certificate Request Message Format types.
Provides :class:`CertReqMessages` and :class:`CertReqMsg` for parsing
DER-encoded CRMF certificate request messages, along with OID constants
for CRMF registration controls.
"""
# ── pubMethod constants (RFC 4211 §11) ────────────────────────────────────────
:
"""``pubMethod`` value: ``dontCare(0)`` — no publication preference."""
:
"""``pubMethod`` value: ``x500(1)`` — publish in an X.500 directory."""
:
"""``pubMethod`` value: ``web(2)`` — publish via HTTP/HTTPS URI."""
:
"""``pubMethod`` value: ``ldap(3)`` — publish in an LDAP directory."""
# ── CertReqMsg ────────────────────────────────────────────────────────────────
"""A single CRMF certificate request message.
``cert_template_der`` holds the raw DER-encoded CertTemplate;
use a ``synta.Decoder`` to inspect individual optional fields.
``popo_type`` and ``popo_der`` describe the proof-of-possession (if present).
"""
"""Integer certificate request ID."""
...
"""DER-encoded CertTemplate SEQUENCE."""
...
"""Proof-of-possession type string, or ``None`` if absent."""
...
"""DER-encoded proof-of-possession value, or ``None``."""
...
"""DER-encoded subject Name from the template, or ``None``."""
...
"""DER-encoded issuer Name from the template, or ``None``."""
...
...
# ── CertReqMsgBuilder ─────────────────────────────────────────────────────────
"""Fluent builder for a single CRMF certificate request message.
Chain setters and call :meth:`build` to obtain a :class:`CertReqMsg`.
Example:
```python
import synta, synta.crmf as crmf
name_der = synta.NameBuilder().common_name("host.example.com").build()
req = (
crmf.CertReqMsgBuilder()
.cert_req_id(0)
.subject_name(name_der)
.popo_ra_verified()
.build()
)
```
"""
...
"""Set the ``certReqId`` integer."""
...
"""Set the subject ``Name`` from pre-encoded DER bytes."""
...
"""Set the issuer ``Name`` from pre-encoded DER bytes."""
...
"""Set the ``SubjectPublicKeyInfo`` from pre-encoded DER bytes."""
...
"""Set proof-of-possession to ``raVerified`` (``[0] IMPLICIT NULL``)."""
...
"""Set PKIPublicationInfo action (0=dontPublish, 1=pleasePublish)."""
...
"""Add a SinglePubInfo with no pubLocation.
``pub_method`` should be one of the ``PUB_METHOD_*`` module constants.
"""
...
"""Add a SinglePubInfo with a URI pubLocation."""
...
"""Add a SinglePubInfo with an rfc822Name pubLocation."""
...
"""Add a SinglePubInfo with a dNSName pubLocation."""
...
"""Add a SinglePubInfo with a directoryName pubLocation (DER Name bytes)."""
...
"""Encode and return the :class:`CertReqMsg`.
:raises ValueError: if stored Name/SPKI bytes are invalid.
"""
...
...
# ── CertReqMessagesBuilder ────────────────────────────────────────────────────
"""Fluent builder for a CRMF batch of certificate request messages.
Example:
```python
import synta, synta.crmf as crmf
name_der = synta.NameBuilder().common_name("host.example.com").build()
req = (
crmf.CertReqMsgBuilder()
.cert_req_id(0)
.subject_name(name_der)
.popo_ra_verified()
.build()
)
msgs = crmf.CertReqMessagesBuilder().add_request(req).build()
raw = msgs.to_der()
```
"""
...
"""Append a :class:`CertReqMsg` to the batch."""
...
"""Encode and return the :class:`CertReqMessages` SEQUENCE OF.
:raises ValueError: if ASN.1 encoding fails.
"""
...
...
# ── CertReqMessages ───────────────────────────────────────────────────────────
"""A SEQUENCE OF CertReqMsg (the outer CRMF message container).
Example:
```python
import synta.crmf as crmf
msgs = crmf.CertReqMessages.from_der(raw)
for req in msgs:
print(req.cert_req_id, req.subject_der)
```
"""
"""Parse a DER-encoded CertReqMessages SEQUENCE."""
...
"""Re-encode to DER bytes."""
...
"""All certificate request messages in the sequence."""
...
...
...
...
...
# ── OID constants ─────────────────────────────────────────────────────────────
:
"""id-regCtrl-regToken — registration token control OID."""
:
"""id-regCtrl-authenticator — authenticator control OID."""
:
"""id-regCtrl-pkiPublicationInfo — publication info control OID."""
:
"""id-regCtrl-pkiArchiveOptions — archive options control OID."""
:
"""id-regCtrl-oldCertID — old certificate ID control OID."""
:
"""id-regCtrl-protocolEncrKey — protocol encryption key control OID."""
:
"""id-regInfo-utf8Pairs — UTF-8 pairs registration info OID."""
:
"""id-regInfo-certReq — certificate request registration info OID."""