Skip to content

Commit 86091e1

Browse files
committed
Prune OTP-PKIX-Relaxed
1 parent b0ad6cb commit 86091e1

2 files changed

Lines changed: 29 additions & 138 deletions

File tree

lib/public_key/asn1/OTP-PKIX-Relaxed.asn1

Lines changed: 28 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ IMPORTS
3232
ATTRIBUTE, Extensions{}, SingleAttribute
3333
FROM PKIX-CommonTypes-2009
3434

35-
CertificateSerialNumber, CertExtensions{}, NoticeReference
36-
FROM PKIX1Implicit-2009
37-
{iso(1) identified-organization(3) dod(6) internet(1) security(5)
38-
mechanisms(5) pkix(7) id-mod(0) id-mod-pkix1-implicit-02(59)}
39-
4035
at-name, at-surname, at-givenName, at-initials, at-generationQualifier,
4136
at-x520CommonName, at-x520LocalityName, at-x520StateOrProvinceName,
4237
at-x520OrganizationName, at-x520OrganizationalUnitName, at-x520Title,
@@ -47,90 +42,41 @@ IMPORTS
4742
id-at-organizationalUnitName, id-at-title, id-at-countryName, id-at-serialNumber,
4843
id-at-pseudonym, id-emailAddress,
4944
ub-name, ub-common-name, ub-locality-name, ub-state-name, ub-organization-name,
50-
ub-organizational-unit-name, ub-title, ub-serial-number, ub-pseudonym, ub-emailaddress-length,
51-
Validity, Version, SubjectPublicKeyInfo,
52-
UniqueIdentifier,
53-
id-qt-unotice, id-qt-cps
45+
ub-organizational-unit-name, ub-title, ub-serial-number, ub-pseudonym, ub-emailaddress-length
5446
FROM PKIX1Explicit-2009
5547
{iso(1) identified-organization(3) dod(6) internet(1)
5648
security(5) mechanisms(5) pkix(7) id-mod(0)
57-
id-mod-pkix1-explicit-02(51)}
58-
59-
--Keys and Signatures
60-
dsa-with-sha1, DSA-Sig-Value, mda-sha1, pk-dsa, DSA-Params
61-
FROM PKIXAlgs-2009
62-
63-
AlgorithmIdentifier{}, SIGNATURE-ALGORITHM
64-
FROM AlgorithmInformation-2009
65-
{iso(1) identified-organization(3) dod(6) internet(1) security(5)
66-
mechanisms(5) pkix(7) id-mod(0)
67-
id-mod-algorithmInformation-02(58)};
49+
id-mod-pkix1-explicit-02(51)};
6850
--
6951
-- Certificate
7052
--
7153

7254
OTPCertificate ::= SEQUENCE {
7355
tbsCertificate OTPTBSCertificate,
74-
signatureAlgorithm AlgorithmIdentifier{SIGNATURE-ALGORITHM,
75-
{ OTPSignatureAlgorithms }},
56+
signatureAlgorithm OTP-PKIX.AlgorithmIdentifier{OTP-PKIX.SIGNATURE-ALGORITHM,
57+
{ OTP-PKIX.OTPSignatureAlgorithms }},
7658
signature BIT STRING }
7759

7860
OTPTBSCertificate ::= SEQUENCE {
79-
version [0] Version DEFAULT v1,
80-
serialNumber CertificateSerialNumber,
81-
signature AlgorithmIdentifier{SIGNATURE-ALGORITHM,
82-
{ OTPSignatureAlgorithms }},
61+
version [0] OTP-PKIX.Version DEFAULT v1,
62+
serialNumber OTP-PKIX.CertificateSerialNumber,
63+
signature OTP-PKIX.AlgorithmIdentifier{OTP-PKIX.SIGNATURE-ALGORITHM,
64+
{ OTP-PKIX.OTPSignatureAlgorithms }},
8365
issuer OTPName,
84-
validity Validity,
66+
validity OTP-PKIX.Validity,
8567
subject OTPName,
86-
subjectPublicKeyInfo SubjectPublicKeyInfo,
68+
subjectPublicKeyInfo OTP-PKIX.SubjectPublicKeyInfo,
8769
... ,
8870
[[2: -- If present, version MUST be v2
89-
issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,
90-
subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL
71+
issuerUniqueID [1] IMPLICIT OTP-PKIX.UniqueIdentifier OPTIONAL,
72+
subjectUniqueID [2] IMPLICIT OTP-PKIX.UniqueIdentifier OPTIONAL
9173
]],
9274
[[3: -- If present, version MUST be v3 --
93-
extensions [3] Extensions{{CertExtensions}} OPTIONAL
75+
extensions [3] Extensions{{OTP-PKIX.CertExtensions}} OPTIONAL
9476
]], ... }
9577

96-
-- Here follows a workaround to handle very old certificates.
97-
98-
OTPSignatureAlgorithms SIGNATURE-ALGORITHM ::= {
99-
OTPSignatureAlgs, ...,
100-
PKIX1-PSS-OAEP-Algorithms-2009.SignatureAlgs }
101-
102-
OTPSignatureAlgs SIGNATURE-ALGORITHM ::= {
103-
PKIXAlgs-2009.sa-rsaWithMD2 |
104-
PKIXAlgs-2009.sa-rsaWithMD5 |
105-
PKIXAlgs-2009.sa-rsaWithSHA1 |
106-
otp-sa-dsaWithSHA1 |
107-
PKIXAlgs-2009.sa-ecdsaWithSHA1,
108-
..., -- Extensible
109-
PKIXAlgs-2009.sa-dsaWithSHA224 |
110-
PKIXAlgs-2009.sa-dsaWithSHA256 |
111-
PKIXAlgs-2009.sa-ecdsaWithSHA224 |
112-
PKIXAlgs-2009.sa-ecdsaWithSHA256 |
113-
PKIXAlgs-2009.sa-ecdsaWithSHA384 |
114-
PKIXAlgs-2009.sa-ecdsaWithSHA512
115-
}
116-
117-
otp-sa-dsaWithSHA1 SIGNATURE-ALGORITHM ::= {
118-
IDENTIFIER dsa-with-sha1
119-
VALUE DSA-Sig-Value
120-
-- Allow DSA-Params as well as NULL here.
121-
PARAMS TYPE OTP-DSA-Params-Or-NULL ARE absent
122-
HASHES { mda-sha1 }
123-
PUBLIC-KEYS { pk-dsa }
124-
SMIME-CAPS { IDENTIFIED BY dsa-with-sha1 }
125-
}
126-
127-
OTP-DSA-Params-Or-NULL ::= CHOICE {
128-
present DSA-Params, -- Only in very old certificates.
129-
absent NULL
130-
}
131-
132-
-- OTPName can contain country name and email addresses that don't
133-
-- follow the standard.
78+
-- OTPName can contain empty RDNs that don't follow the standard
79+
-- but seem to be generally accepted.
13480

13581
OTPName ::= CHOICE {
13682
rdnSequence RDNSequence }
@@ -226,74 +172,19 @@ OTP-emailAddress ::= CHOICE {
226172
wrong UTF8String
227173
}
228174

229-
-- We use this variation of SingleAttribute/AttributeTypeAndValue
230-
-- when calculating the "short" hash of the certificate issuer.
231-
-- See public_key:short_name_hash/1.
232-
233-
HashSingleAttribute ::= SEQUENCE {
234-
type OBJECT IDENTIFIER,
235-
value UTF8String
236-
}
237-
238-
HashRDNSequence ::= SEQUENCE OF HashRelativeDistinguishedName
239-
240-
HashRelativeDistinguishedName ::=
241-
SET SIZE (1 .. MAX) OF HashSingleAttribute
242-
243-
-- Used to workaround that some CAs create too long User Notices
244-
245-
OTPCertificatePolicies ::= SEQUENCE SIZE (1..MAX) OF OTPPolicyInformation
246-
247-
OTPPolicyInformation ::= SEQUENCE {
248-
policyIdentifier CertPolicyId,
249-
policyQualifiers SEQUENCE SIZE (1..MAX) OF
250-
OTPPolicyQualifierInfo OPTIONAL }
251-
252-
CertPolicyId ::= OBJECT IDENTIFIER
253-
254-
CERT-POLICY-QUALIFIER ::= TYPE-IDENTIFIER
255-
256-
OTPPolicyQualifierInfo ::= SEQUENCE {
257-
policyQualifierId CERT-POLICY-QUALIFIER.
258-
&id({PolicyQualifierId}),
259-
qualifier CERT-POLICY-QUALIFIER.
260-
&Type({PolicyQualifierId}{@policyQualifierId})}
261-
262-
-- Implementations that recognize additional policy qualifiers MUST
263-
-- augment the following definition for PolicyQualifierId
264-
265-
PolicyQualifierId CERT-POLICY-QUALIFIER ::=
266-
{ pqid-cps | pqid-unotice, ... }
267-
268-
pqid-cps CERT-POLICY-QUALIFIER ::= { CPSuri IDENTIFIED BY id-qt-cps }
269-
pqid-unotice CERT-POLICY-QUALIFIER ::= { OTPUserNotice
270-
IDENTIFIED BY id-qt-unotice }
271-
272-
-- CPS pointer qualifier
273-
274-
CPSuri ::= IA5String
275-
276-
OTPUserNotice ::= SEQUENCE {
277-
noticeRef NoticeReference OPTIONAL,
278-
explicitText OTPDisplayText OPTIONAL}
279-
280-
-- NoticeReference ::= SEQUENCE {
281-
-- organization OTPDisplayText,
282-
-- noticeNumbers SEQUENCE OF INTEGER }
283-
284-
OTPDisplayText ::= CHOICE {
285-
ia5String IA5String (SIZE (1..650)),
286-
visibleString VisibleString (SIZE (1..650)),
287-
bmpString BMPString (SIZE (1..650)),
288-
utf8String UTF8String (SIZE (1..650)) }
289-
290-
-- Extensions
291-
292-
Extensions ::= SEQUENCE SIZE (1..MAX) OF OTPExtension
293175

294-
OTPExtension ::= SEQUENCE {
295-
extnID OBJECT IDENTIFIER,
296-
critical BOOLEAN DEFAULT FALSE,
297-
extnValue OCTET STRING }
176+
HashSingleAttribute ::= OTP-PKIX.HashSingleAttribute
177+
HashRDNSequence ::= OTP-PKIX.HashRDNSequence
178+
HashRelativeDistinguishedName ::= OTP-PKIX.HashRelativeDistinguishedName
179+
OTPCertificatePolicies ::= OTP-PKIX.OTPCertificatePolicies
180+
OTPPolicyInformation ::= OTP-PKIX.OTPPolicyInformation
181+
CertPolicyId ::= OTP-PKIX.CertPolicyId
182+
CERT-POLICY-QUALIFIER ::= OTP-PKIX.CERT-POLICY-QUALIFIER
183+
OTPPolicyQualifierInfo ::= OTP-PKIX.OTPPolicyQualifierInfo
184+
CPSuri ::= OTP-PKIX.CPSuri
185+
OTPUserNotice ::= OTP-PKIX.OTPUserNotice
186+
OTPDisplayText ::= OTP-PKIX.OTPDisplayText
187+
Extensions ::= OTP-PKIX.Extensions
188+
OTPExtension ::= OTP-PKIX.OTPExtension
298189

299190
END

lib/public_key/src/pubkey_cert_records.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ decode_extensions(Exts, WhenCRL) ->
463463
decode_otp_cert_polices(Ext, Value) ->
464464
%% RFC 3280 states that certificate users SHOULD gracefully handle
465465
%% explicitText with more than 200 characters.
466-
{ok, CPs} = 'OTP-PKIX-Relaxed':decode('OTPCertificatePolicies', Value),
466+
{ok, CPs} = 'OTP-PKIX':decode('OTPCertificatePolicies', Value),
467467
Ext#'Extension'{extnValue=[translate_cert_polices(CP) || CP <- CPs]}.
468468

469469
translate_cert_polices(#'OTPPolicyInformation'{policyIdentifier = Id, policyQualifiers = Qs0}) ->

0 commit comments

Comments
 (0)