Skip to content

Commit bfea8cb

Browse files
committed
Include new header files
And write a simple testcase.
1 parent 0f616a9 commit bfea8cb

File tree

9 files changed

+606
-7
lines changed

9 files changed

+606
-7
lines changed

lib/public_key/asn1/PKIXCRMF-2009.asn1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ PKIXCRMF-2009
128128

129129
Controls ::= SEQUENCE SIZE(1..MAX) OF SingleAttribute
130130
{{RegControlSet}}
131-
ProofOfPossession ::= CHOICE {
131+
132+
ProofOfPossession ::= CHOICE {
132133
raVerified [0] NULL,
133134
-- used if the RA has already verified that the requester is in
134135
-- possession of the private key

lib/public_key/doc/guides/public_key_records.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,38 @@ _Table: Public-Key Algorithm OIDs_
358358
[CRL Extensions](public_key_records.md#CRLCertExt) and
359359
[CRL Entry Extensions](public_key_records.md#CRLEntryExt).
360360

361+
### PKIXCMP Certificate Management Protocol
362+
363+
Erlang representation of PKIXCMP see `PKIXCMP.hrl`,
364+
some of the records defined.
365+
366+
```erlang
367+
-record('PKIMessage', {
368+
header, % #'PKIHeader'{}
369+
body, % #'PKIBody'{}
370+
protection, % Optional #'PKIProtection'{}
371+
extraCerts % Optional [#'CMPCertificate'{}]
372+
}).
373+
```
374+
375+
### PKIXCRMF Certificate Request Message Format
376+
Erlang representation of PKIXCRMF see `PKIXCRMF.hrl`,
377+
some of the records defined.
378+
379+
```erlang
380+
-record('CertReqMsg', {
381+
certReq, % #'CertRequest'{}
382+
popo, % Optional choice
383+
regInfo % [#'CertReqMsg_reginfo_SEQOF'{}]
384+
}).
385+
386+
-record('CertRequest', {
387+
certReqId % integer,
388+
certTemplate % #'CertTemplate'{}
389+
controls % #'Controls_SEQOF'{}
390+
}).
391+
```
392+
361393
[](){: #StdCertExt }
362394

363395
## Standard Certificate Extensions
@@ -622,4 +654,4 @@ specifications and RFC 5280 are as follows:
622654
values % [der_encoded()]
623655
}.
624656
```
625-
[](){: #PKCS10}
657+
[](){: #PKCS10}

lib/public_key/doc/public_key_app.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ that reads files.
5151
Information Syntax Standard
5252
- Supports [PKCS-10](http://www.ietf.org/rfc/rfc5967.txt) \- Certification
5353
Request Syntax Standard
54+
- Supports [PKIXCMP](http://www.ietf.org/rfc/rfc9810.txt) \- Certificate Management Protocol
55+
- Supports [PKIXCRMF](http://www.ietf.org/rfc/rfc5912.txt) \- Certificate Request Message Format
5456

5557
## Dependencies
5658

lib/public_key/include/PKIXCMP.hrl

Lines changed: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
%%
2+
%% %CopyrightBegin%
3+
%%
4+
%% SPDX-License-Identifier: Apache-2.0
5+
%%
6+
%% Copyright Ericsson AB 2025. All Rights Reserved.
7+
%%
8+
%% Licensed under the Apache License, Version 2.0 (the "License");
9+
%% you may not use this file except in compliance with the License.
10+
%% You may obtain a copy of the License at
11+
%%
12+
%% http://www.apache.org/licenses/LICENSE-2.0
13+
%%
14+
%% Unless required by applicable law or agreed to in writing, software
15+
%% distributed under the License is distributed on an "AS IS" BASIS,
16+
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
%% See the License for the specific language governing permissions and
18+
%% limitations under the License.
19+
%%
20+
%% %CopyrightEnd%
21+
%%
22+
23+
-ifndef(_PKIXCMP_HRL_).
24+
-define(_PKIXCMP_HRL_, true).
25+
26+
-record('PKIMessage', {
27+
header,
28+
body,
29+
protection = asn1_NOVALUE,
30+
extraCerts = asn1_NOVALUE
31+
}).
32+
33+
-record('PKIHeader', {
34+
pvno,
35+
sender,
36+
recipient,
37+
messageTime = asn1_NOVALUE,
38+
protectionAlg = asn1_NOVALUE,
39+
senderKID = asn1_NOVALUE,
40+
recipKID = asn1_NOVALUE,
41+
transactionID = asn1_NOVALUE,
42+
senderNonce = asn1_NOVALUE,
43+
recipNonce = asn1_NOVALUE,
44+
freeText = asn1_NOVALUE,
45+
generalInfo = asn1_NOVALUE
46+
}).
47+
48+
-record('PKIHeader_protectionAlg', {
49+
algorithm,
50+
parameters = asn1_NOVALUE
51+
}).
52+
53+
-record('ProtectedPart', {
54+
header,
55+
body
56+
}).
57+
58+
-ifndef(_PBMParameter_).
59+
-define(_PBMParameter_, true).
60+
61+
-record('PBMParameter', {
62+
salt,
63+
owf,
64+
iterationCount,
65+
mac
66+
}).
67+
68+
-record('PBMParameter_owf', {
69+
algorithm,
70+
parameters = asn1_NOVALUE
71+
}).
72+
73+
-record('PBMParameter_mac', {
74+
algorithm,
75+
parameters = asn1_NOVALUE
76+
}).
77+
78+
-endif. %% _PBMParameter_
79+
80+
-record('DHBMParameter', {
81+
owf,
82+
mac
83+
}).
84+
85+
-record('DHBMParameter_owf', {
86+
algorithm,
87+
parameters = asn1_NOVALUE
88+
}).
89+
90+
-record('DHBMParameter_mac', {
91+
algorithm,
92+
parameters = asn1_NOVALUE
93+
}).
94+
95+
-record('KemBMParameter', {
96+
kdf,
97+
kemContext = asn1_NOVALUE,
98+
len,
99+
mac
100+
}).
101+
102+
-record('KemBMParameter_kdf', {
103+
algorithm,
104+
parameters = asn1_NOVALUE
105+
}).
106+
107+
-record('KemBMParameter_mac', {
108+
algorithm,
109+
parameters = asn1_NOVALUE
110+
}).
111+
112+
-record('PKIStatusInfo', {
113+
status,
114+
statusString = asn1_NOVALUE,
115+
failInfo = asn1_NOVALUE
116+
}).
117+
118+
-record('OOBCertHash', {
119+
hashAlg = asn1_NOVALUE,
120+
certId = asn1_NOVALUE,
121+
hashVal
122+
}).
123+
124+
-record('OOBCertHash_hashAlg', {
125+
algorithm,
126+
parameters = asn1_NOVALUE
127+
}).
128+
129+
-record('Challenge', {
130+
owf = asn1_NOVALUE,
131+
witness,
132+
challenge,
133+
encryptedRand = asn1_NOVALUE
134+
}).
135+
136+
-record('Challenge_owf', {
137+
algorithm,
138+
parameters = asn1_NOVALUE
139+
}).
140+
141+
-record('Rand', {
142+
int,
143+
sender
144+
}).
145+
146+
-record('CertRepMessage', {
147+
caPubs = asn1_NOVALUE,
148+
response
149+
}).
150+
151+
-record('CertResponse', {
152+
certReqId,
153+
status,
154+
certifiedKeyPair = asn1_NOVALUE,
155+
rspInfo = asn1_NOVALUE
156+
}).
157+
158+
-record('CertifiedKeyPair', {
159+
certOrEncCert,
160+
privateKey = asn1_NOVALUE,
161+
publicationInfo = asn1_NOVALUE
162+
}).
163+
164+
-record('KeyRecRepContent', {
165+
status,
166+
newSigCert = asn1_NOVALUE,
167+
caCerts = asn1_NOVALUE,
168+
keyPairHist = asn1_NOVALUE
169+
}).
170+
171+
-record('RevDetails', {
172+
certDetails,
173+
crlEntryDetails = asn1_NOVALUE
174+
}).
175+
176+
-record('RevDetails_crlEntryDetails_SEQOF', {
177+
extnID,
178+
critical = asn1_DEFAULT,
179+
extnValue
180+
}).
181+
182+
-record('RevRepContent', {
183+
status,
184+
revCerts = asn1_NOVALUE,
185+
crls = asn1_NOVALUE
186+
}).
187+
188+
-record('CAKeyUpdAnnContent', {
189+
oldWithNew,
190+
newWithOld,
191+
newWithNew
192+
}).
193+
194+
-record('RevAnnContent', {
195+
status,
196+
certId,
197+
willBeRevokedAt,
198+
badSinceDate,
199+
crlDetails = asn1_NOVALUE
200+
}).
201+
202+
-record('RevAnnContent_crlDetails_SEQOF', {
203+
extnID,
204+
critical = asn1_DEFAULT,
205+
extnValue
206+
}).
207+
208+
-record('CertReqTemplateContent', {
209+
certTemplate,
210+
keySpec = asn1_NOVALUE
211+
}).
212+
213+
%% Include public_key.hrl for this
214+
%%
215+
%% -record('AttributeTypeAndValue', {
216+
%% type,
217+
%% value
218+
%% }).
219+
220+
-record('AlgIdCtrl', {
221+
algorithm,
222+
parameters = asn1_NOVALUE
223+
}).
224+
225+
-record('RootCaKeyUpdateContent', {
226+
newWithNew,
227+
newWithOld = asn1_NOVALUE,
228+
oldWithNew = asn1_NOVALUE
229+
}).
230+
231+
-record('CRLStatus', {
232+
source,
233+
thisUpdate = asn1_NOVALUE
234+
}).
235+
236+
-record('KemCiphertextInfo', {
237+
kem,
238+
ct
239+
}).
240+
241+
-record('KemCiphertextInfo_kem', {
242+
algorithm,
243+
parameters = asn1_NOVALUE
244+
}).
245+
246+
-record('KemOtherInfo', {
247+
staticString,
248+
transactionID,
249+
kemContext = asn1_NOVALUE
250+
}).
251+
252+
-record('InfoTypeAndValue', {
253+
infoType,
254+
infoValue
255+
}).
256+
257+
-record('ErrorMsgContent', {
258+
pKIStatusInfo,
259+
errorCode = asn1_NOVALUE,
260+
errorDetails = asn1_NOVALUE
261+
}).
262+
263+
-record('CertStatus', {
264+
certHash,
265+
certReqId,
266+
statusInfo = asn1_NOVALUE,
267+
hashAlg = asn1_NOVALUE
268+
}).
269+
270+
-record('CertStatus_hashAlg', {
271+
algorithm,
272+
parameters = asn1_NOVALUE
273+
}).
274+
275+
-record('PollReqContent_SEQOF', {
276+
certReqId
277+
}).
278+
279+
-record('PollRepContent_SEQOF', {
280+
certReqId,
281+
checkAfter,
282+
reason = asn1_NOVALUE
283+
}).
284+
285+
-define('id-PasswordBasedMac', {1,2,840,113533,7,66,13}).
286+
-define('id-DHBasedMac', {1,2,840,113533,7,66,30}).
287+
-define('id-KemBasedMac', {1,2,840,113533,7,66,16}).
288+
-define('id-regCtrl-altCertTemplate', {1,3,6,1,5,5,7,5,1,7}).
289+
-define('id-regCtrl-algId', {1,3,6,1,5,5,7,5,1,11}).
290+
-define('id-regCtrl-rsaKeyLen', {1,3,6,1,5,5,7,5,1,12}).
291+
-define('id-kp-cmKGA', {1,3,6,1,5,5,7,3,32}).
292+
-endif. %% _PKIXCMP_HRL_

0 commit comments

Comments
 (0)