@browsercore/tls 0.4.19 → 0.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -23
- package/dist/certificates/ca-constraints.d.ts +15 -13
- package/dist/certificates/ca-constraints.d.ts.map +1 -1
- package/dist/certificates/ca-constraints.js +41 -59
- package/dist/certificates/ca-constraints.js.map +1 -1
- package/dist/certificates/cert-extensions.d.ts +59 -9
- package/dist/certificates/cert-extensions.d.ts.map +1 -1
- package/dist/certificates/cert-extensions.js +104 -50
- package/dist/certificates/cert-extensions.js.map +1 -1
- package/dist/certificates/certificate-path.d.ts +66 -7
- package/dist/certificates/certificate-path.d.ts.map +1 -1
- package/dist/certificates/certificate-path.js +125 -11
- package/dist/certificates/certificate-path.js.map +1 -1
- package/dist/certificates/certificates.d.ts.map +1 -1
- package/dist/certificates/certificates.js +107 -29
- package/dist/certificates/certificates.js.map +1 -1
- package/dist/certificates/extension-policy.d.ts +16 -6
- package/dist/certificates/extension-policy.d.ts.map +1 -1
- package/dist/certificates/extension-policy.js +17 -6
- package/dist/certificates/extension-policy.js.map +1 -1
- package/dist/certificates/extension-values.d.ts +131 -0
- package/dist/certificates/extension-values.d.ts.map +1 -0
- package/dist/certificates/extension-values.js +443 -0
- package/dist/certificates/extension-values.js.map +1 -0
- package/dist/certificates/general-names.d.ts +142 -0
- package/dist/certificates/general-names.d.ts.map +1 -0
- package/dist/certificates/general-names.js +354 -0
- package/dist/certificates/general-names.js.map +1 -0
- package/dist/certificates/name-constraints.d.ts +245 -0
- package/dist/certificates/name-constraints.d.ts.map +1 -0
- package/dist/certificates/name-constraints.js +692 -0
- package/dist/certificates/name-constraints.js.map +1 -0
- package/dist/certificates/name-match.d.ts +59 -0
- package/dist/certificates/name-match.d.ts.map +1 -0
- package/dist/certificates/name-match.js +271 -0
- package/dist/certificates/name-match.js.map +1 -0
- package/dist/errors.d.ts +61 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +48 -0
- package/dist/errors.js.map +1 -1
- package/dist/handshake/client-hello.d.ts +16 -2
- package/dist/handshake/client-hello.d.ts.map +1 -1
- package/dist/handshake/client-hello.js +38 -5
- package/dist/handshake/client-hello.js.map +1 -1
- package/dist/handshake/handshake.d.ts +1 -1
- package/dist/handshake/handshake.d.ts.map +1 -1
- package/dist/handshake/handshake.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/session/binder.d.ts +76 -0
- package/dist/session/binder.d.ts.map +1 -0
- package/dist/session/binder.js +107 -0
- package/dist/session/binder.js.map +1 -0
- package/dist/session/psk-extension.d.ts +49 -0
- package/dist/session/psk-extension.d.ts.map +1 -0
- package/dist/session/psk-extension.js +96 -0
- package/dist/session/psk-extension.js.map +1 -0
- package/dist/session/psk-offer.d.ts +52 -0
- package/dist/session/psk-offer.d.ts.map +1 -0
- package/dist/session/psk-offer.js +62 -0
- package/dist/session/psk-offer.js.map +1 -0
- package/dist/types.d.ts +28 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension VALUE parsing at certificate-parse time (Part B parity).
|
|
3
|
+
*
|
|
4
|
+
* BoringSSL's ParsedCertificate::Initialize (pki/parsed_certificate.cc at the
|
|
5
|
+
* revision Chromium 140 pins, 0a0009998fa180695f3e2071805dc03c9a5f3124) parses
|
|
6
|
+
* the VALUE of every extension below — critical or NOT — and rejects the whole
|
|
7
|
+
* certificate when the parse fails (`errors->AddError(kFailedParsing…);
|
|
8
|
+
* return nullptr;`). This module carries the strict value parsers for the
|
|
9
|
+
* extensions whose values this package previously ignored when non-critical;
|
|
10
|
+
* the reviewers' finding was exactly that gap: the package accepted
|
|
11
|
+
* certificates Chrome rejects because their NON-critical extension values
|
|
12
|
+
* were malformed.
|
|
13
|
+
*
|
|
14
|
+
* The complete BoringSSL parse-time value set (parsed_certificate.cc:154-288):
|
|
15
|
+
* basicConstraints, keyUsage, extendedKeyUsage, subjectAltName,
|
|
16
|
+
* nameConstraints, authorityInfoAccess, certificatePolicies,
|
|
17
|
+
* policyConstraints, policyMappings, inhibitAnyPolicy,
|
|
18
|
+
* subjectKeyIdentifier, authorityKeyIdentifier. The first five already have
|
|
19
|
+
* strict parsers (cert-extensions.ts / general-names.ts /
|
|
20
|
+
* name-constraints.ts); THIS module owns the rest:
|
|
21
|
+
*
|
|
22
|
+
* - authorityInfoAccess — ParseAuthorityInfoAccessURIs: SEQUENCE SIZE
|
|
23
|
+
* (1..MAX) OF AccessDescription { accessMethod OID, accessLocation
|
|
24
|
+
* GeneralName }, nothing trailing. The accessLocation is read with
|
|
25
|
+
* ReadRawTLV — ANY well-formed TLV tag is accepted (parse_certificate.cc
|
|
26
|
+
* 851-852); only a uniformResourceIdentifier [6] location gets the ASCII
|
|
27
|
+
* check (:886-891), and other tags are simply never retained.
|
|
28
|
+
* - certificatePolicies — ParseCertificatePoliciesExtensionOids with
|
|
29
|
+
* fail_parsing_unknown_qualifier_oids = FALSE (the parse-time call):
|
|
30
|
+
* structure must be exact (≥1 PolicyInformation, each { policyIdentifier
|
|
31
|
+
* OID, qualifiers SEQUENCE(1..MAX) OF PolicyQualifierInfo { qualifierId
|
|
32
|
+
* OID, qualifier ANY } } optional-but-nonempty-when-present, no trailing
|
|
33
|
+
* data, no duplicate policy OID) but ANY qualifier OID is tolerated
|
|
34
|
+
* EXCEPT under the anyPolicy identifier — "When qualifiers are used with
|
|
35
|
+
* the special policy anyPolicy, they MUST be limited to the qualifiers
|
|
36
|
+
* identified in this section" (RFC 5280 §4.2.1.4): id-qt-cps or
|
|
37
|
+
* id-qt-unotice only. (The spec assumption that unknown qualifier OIDs
|
|
38
|
+
* fail at parse time is BoringSSL's CRITICAL-handling mode, not its
|
|
39
|
+
* parse-time mode; critical acceptance is decided separately by
|
|
40
|
+
* extension-policy.ts.)
|
|
41
|
+
* - policyConstraints — ParsePolicyConstraints: SEQUENCE with at least one
|
|
42
|
+
* of requireExplicitPolicy [0] / inhibitPolicyMapping [1], each an
|
|
43
|
+
* implicitly-tagged INTEGER that must decode as a uint8 (ParseUint8:
|
|
44
|
+
* minimal, non-negative), nothing trailing — RFC 5280: "Conforming CAs
|
|
45
|
+
* MUST NOT issue certificates where policy constraints is an empty
|
|
46
|
+
* sequence".
|
|
47
|
+
* - policyMappings — ParsePolicyMappings: SEQUENCE SIZE (1..MAX) OF
|
|
48
|
+
* SEQUENCE { issuerDomainPolicy OID, subjectDomainPolicy OID }, nothing
|
|
49
|
+
* trailing.
|
|
50
|
+
* - inhibitAnyPolicy — ParseInhibitAnyPolicy: exactly one INTEGER decoding
|
|
51
|
+
* as uint8 (SkipCerts ::= INTEGER (0..MAX)), nothing trailing.
|
|
52
|
+
* - subjectKeyIdentifier — ParseSubjectKeyIdentifier: exactly one OCTET
|
|
53
|
+
* STRING.
|
|
54
|
+
* - authorityKeyIdentifier — ParseAuthorityKeyIdentifier: SEQUENCE {
|
|
55
|
+
* keyIdentifier [0] OCTET STRING OPTIONAL, authorityCertIssuer [1]
|
|
56
|
+
* GeneralNames OPTIONAL, authorityCertSerialNumber [2] INTEGER OPTIONAL }
|
|
57
|
+
* where "authorityCertIssuer and authorityCertSerialNumber MUST both be
|
|
58
|
+
* present or both be absent", nothing trailing (an empty SEQUENCE is
|
|
59
|
+
* tolerated — BoringSSL's TODO notes RFC 5280 doesn't forbid it).
|
|
60
|
+
*
|
|
61
|
+
* cRLDistributionPoints (2.5.29.31) is deliberately NOT parsed: at the
|
|
62
|
+
* pinned revision `ParseCrlDistributionPoints` has NO caller in
|
|
63
|
+
* ParsedCertificate::Create (parsed_certificate.h carries no crl field; the
|
|
64
|
+
* function is exported for Chromium's revocation layer, which tolerates
|
|
65
|
+
* malformed values) — parsing it here would reject certificates Chrome
|
|
66
|
+
* accepts.
|
|
67
|
+
*/
|
|
68
|
+
import { parseOid, readTlv } from "./der.js";
|
|
69
|
+
import { TlsMalformedExtensionError } from "../errors.js";
|
|
70
|
+
import { ANY_POLICY_OID, AUTHORITY_INFO_ACCESS_OID, AUTHORITY_KEY_IDENTIFIER_OID, CERTIFICATE_POLICIES_OID, CRL_DISTRIBUTION_POINTS_OID, CPS_QUALIFIER_OID, INHIBIT_ANY_POLICY_OID, NAME_CONSTRAINTS_OID, POLICY_CONSTRAINTS_OID, POLICY_MAPPINGS_OID, SUBJECT_KEY_IDENTIFIER_OID, USER_NOTICE_QUALIFIER_OID, } from "./extension-policy.js";
|
|
71
|
+
// ONE-definition plumbing (code-standards §22): certificates.ts reaches the
|
|
72
|
+
// extension OIDs through THIS module (whose whole job is extension-value
|
|
73
|
+
// parsing) instead of adding another direct dependency on extension-policy.
|
|
74
|
+
export { ANY_POLICY_OID, AUTHORITY_INFO_ACCESS_OID, AUTHORITY_KEY_IDENTIFIER_OID, CERTIFICATE_POLICIES_OID, CRL_DISTRIBUTION_POINTS_OID, CPS_QUALIFIER_OID, INHIBIT_ANY_POLICY_OID, NAME_CONSTRAINTS_OID, POLICY_CONSTRAINTS_OID, POLICY_MAPPINGS_OID, SUBJECT_KEY_IDENTIFIER_OID, USER_NOTICE_QUALIFIER_OID, };
|
|
75
|
+
/**
|
|
76
|
+
* Throw the typed malformed-extension error. One helper so every rejection in
|
|
77
|
+
* this module names the extension OID uniformly (TlsMalformedExtensionError).
|
|
78
|
+
*/
|
|
79
|
+
function malformed(oid, detail) {
|
|
80
|
+
throw new TlsMalformedExtensionError(oid, detail);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* der::ParseUint8 (parse_values.h): an INTEGER whose value fits in one
|
|
84
|
+
* unsigned byte with the minimal encoding — exactly one content byte (a
|
|
85
|
+
* second byte 0x00 would be non-minimal padding; a two-byte value overflows;
|
|
86
|
+
* a high-bit-set first byte is negative).
|
|
87
|
+
*/
|
|
88
|
+
function parseUint8Content(oid, what, content) {
|
|
89
|
+
if (content.length !== 1) {
|
|
90
|
+
malformed(oid, `${what} must be an INTEGER that fits one unsigned byte (got ${content.length} content byte(s))`);
|
|
91
|
+
}
|
|
92
|
+
const value = content[0] ?? 0;
|
|
93
|
+
if ((value & 0x80) !== 0) {
|
|
94
|
+
malformed(oid, `${what} must be a non-negative INTEGER (0..255); the first content byte's high bit makes it negative`);
|
|
95
|
+
}
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
// authorityInfoAccess (1.3.6.1.5.5.7.1.1) — kFailedParsingAia.
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
/** id-ad-ocsp (RFC 5280 §4.2.2.1). */
|
|
102
|
+
export const AD_OCSP_OID = "1.3.6.1.5.5.7.48.1";
|
|
103
|
+
/** id-ad-caIssuers (RFC 5280 §4.2.2.1). */
|
|
104
|
+
export const AD_CA_ISSUERS_OID = "1.3.6.1.5.5.7.48.2";
|
|
105
|
+
/**
|
|
106
|
+
* ParseAuthorityInfoAccessURIs twin: SEQUENCE SIZE (1..MAX) OF
|
|
107
|
+
* AccessDescription { accessMethod OBJECT IDENTIFIER, accessLocation
|
|
108
|
+
* GeneralName } — each AccessDescription exactly two elements; the
|
|
109
|
+
* accessLocation is read with ReadRawTLV, so ANY well-formed TLV tag is
|
|
110
|
+
* accepted (parse_certificate.cc:851-852 — ParseAuthorityInfoAccess retains the
|
|
111
|
+
* raw TLV and ParseAuthorityInfoAccessURIs only inspects it when the tag is
|
|
112
|
+
* uniformResourceIdentifier [6], which must be ASCII, :886-891).
|
|
113
|
+
*/
|
|
114
|
+
export function parseAuthorityInfoAccess(value, oid) {
|
|
115
|
+
const seq = readTlv(value, 0);
|
|
116
|
+
if (seq.tag !== 0x30) {
|
|
117
|
+
malformed(oid, "expected AuthorityInfoAccessSyntax SEQUENCE");
|
|
118
|
+
}
|
|
119
|
+
// "SEQUENCE SIZE (1..MAX)": an empty AIA sequence is a parse failure.
|
|
120
|
+
if (seq.valueStart >= seq.end) {
|
|
121
|
+
malformed(oid, "AuthorityInfoAccessSyntax must contain at least one AccessDescription");
|
|
122
|
+
}
|
|
123
|
+
let o = seq.valueStart;
|
|
124
|
+
while (o < seq.end) {
|
|
125
|
+
const accessDescription = readTlv(value, o);
|
|
126
|
+
if (accessDescription.tag !== 0x30) {
|
|
127
|
+
malformed(oid, "expected AccessDescription SEQUENCE");
|
|
128
|
+
}
|
|
129
|
+
let p = accessDescription.valueStart;
|
|
130
|
+
const methodTlv = readTlv(value, p);
|
|
131
|
+
if (methodTlv.tag !== 0x06) {
|
|
132
|
+
malformed(oid, "accessMethod must be an OBJECT IDENTIFIER");
|
|
133
|
+
}
|
|
134
|
+
parseOid(value, methodTlv.valueStart, methodTlv.end);
|
|
135
|
+
p = methodTlv.end;
|
|
136
|
+
const location = readTlv(value, p);
|
|
137
|
+
p = location.end;
|
|
138
|
+
if (p !== accessDescription.end) {
|
|
139
|
+
// ParseAuthorityInfoAccess: `if (access_description_sequence_parser.HasMore())
|
|
140
|
+
// { return false; }` — the CHOICE leaves no room for more elements.
|
|
141
|
+
malformed(oid, "AccessDescription has trailing data after accessLocation");
|
|
142
|
+
}
|
|
143
|
+
// The accessLocation must be ONE well-formed TLV of ANY tag
|
|
144
|
+
// (ReadRawTLV); the value is never retained — only [6] gets a
|
|
145
|
+
// content check (ASCII), everything else is skipped silently by
|
|
146
|
+
// ParseAuthorityInfoAccessURIs. AIA fetching is out of scope, only
|
|
147
|
+
// the parse parity is in it.
|
|
148
|
+
if (location.tag === 0x86) {
|
|
149
|
+
for (const byte of value.subarray(location.valueStart, location.end)) {
|
|
150
|
+
if (byte > 0x7f) {
|
|
151
|
+
malformed(oid, "uniformResourceIdentifier accessLocation is not ASCII (kURINotAscii)");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
o = accessDescription.end;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
// certificatePolicies (2.5.29.32) — kFailedParsingPolicies.
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
/**
|
|
162
|
+
* ParseCertificatePoliciesExtensionOids(value,
|
|
163
|
+
* fail_parsing_unknown_qualifier_oids = false) twin — see the module comment
|
|
164
|
+
* for the exact fault list. Unknown qualifier OIDs are tolerated EXCEPT under
|
|
165
|
+
* anyPolicy (kUnknownPolicyQualifierOid fires there even in parse mode,
|
|
166
|
+
* certificate_policies.cc: `fail_parsing_unknown_qualifier_oids ||
|
|
167
|
+
* policy_oid == der::Input(kAnyPolicyOid)`).
|
|
168
|
+
*/
|
|
169
|
+
export function parseCertificatePolicies(value, oid) {
|
|
170
|
+
const seq = readTlv(value, 0);
|
|
171
|
+
if (seq.tag !== 0x30) {
|
|
172
|
+
malformed(oid, "expected certificatePolicies SEQUENCE");
|
|
173
|
+
}
|
|
174
|
+
if (seq.end !== value.length) {
|
|
175
|
+
malformed(oid, "trailing data after the certificatePolicies SEQUENCE");
|
|
176
|
+
}
|
|
177
|
+
if (seq.valueStart >= seq.end) {
|
|
178
|
+
// kPoliciesEmptySequence.
|
|
179
|
+
malformed(oid, "certificatePolicies is an empty SEQUENCE (kPoliciesEmptySequence)");
|
|
180
|
+
}
|
|
181
|
+
const policyOids = [];
|
|
182
|
+
let o = seq.valueStart;
|
|
183
|
+
while (o < seq.end) {
|
|
184
|
+
const policyInformation = readTlv(value, o);
|
|
185
|
+
if (policyInformation.tag !== 0x30) {
|
|
186
|
+
malformed(oid, "expected PolicyInformation SEQUENCE");
|
|
187
|
+
}
|
|
188
|
+
let p = policyInformation.valueStart;
|
|
189
|
+
const policyOidTlv = readTlv(value, p);
|
|
190
|
+
if (policyOidTlv.tag !== 0x06) {
|
|
191
|
+
malformed(oid, "policyIdentifier must be an OBJECT IDENTIFIER");
|
|
192
|
+
}
|
|
193
|
+
const policyOid = parseOid(value, policyOidTlv.valueStart, policyOidTlv.end);
|
|
194
|
+
policyOids.push(policyOid);
|
|
195
|
+
p = policyOidTlv.end;
|
|
196
|
+
if (p < policyInformation.end) {
|
|
197
|
+
const qualifiers = readTlv(value, p);
|
|
198
|
+
p = qualifiers.end;
|
|
199
|
+
if (qualifiers.tag !== 0x30) {
|
|
200
|
+
malformed(oid, "policyQualifiers must be a SEQUENCE");
|
|
201
|
+
}
|
|
202
|
+
if (policyInformation.end !== p) {
|
|
203
|
+
// kPolicyInformationTrailingData.
|
|
204
|
+
malformed(oid, "PolicyInformation has trailing data after the policyQualifiers SEQUENCE");
|
|
205
|
+
}
|
|
206
|
+
if (qualifiers.valueStart >= qualifiers.end) {
|
|
207
|
+
// kPolicyQualifiersEmptySequence.
|
|
208
|
+
malformed(oid, "the policyQualifiers SEQUENCE is empty (kPolicyQualifiersEmptySequence)");
|
|
209
|
+
}
|
|
210
|
+
const restrictToKnownQualifiers = policyOid === ANY_POLICY_OID;
|
|
211
|
+
let q = qualifiers.valueStart;
|
|
212
|
+
while (q < qualifiers.end) {
|
|
213
|
+
const qualifierInfo = readTlv(value, q);
|
|
214
|
+
if (qualifierInfo.tag !== 0x30) {
|
|
215
|
+
malformed(oid, "expected PolicyQualifierInfo SEQUENCE");
|
|
216
|
+
}
|
|
217
|
+
let qi = qualifierInfo.valueStart;
|
|
218
|
+
const qualifierOidTlv = readTlv(value, qi);
|
|
219
|
+
if (qualifierOidTlv.tag !== 0x06) {
|
|
220
|
+
malformed(oid, "policyQualifierId must be an OBJECT IDENTIFIER");
|
|
221
|
+
}
|
|
222
|
+
const qualifierOid = parseOid(value, qualifierOidTlv.valueStart, qualifierOidTlv.end);
|
|
223
|
+
qi = qualifierOidTlv.end;
|
|
224
|
+
if (restrictToKnownQualifiers && qualifierOid !== CPS_QUALIFIER_OID && qualifierOid !== USER_NOTICE_QUALIFIER_OID) {
|
|
225
|
+
malformed(oid, `unknown policy qualifier OID ${qualifierOid} under anyPolicy (kUnknownPolicyQualifierOid)`);
|
|
226
|
+
}
|
|
227
|
+
const qualifierTlv = readTlv(value, qi);
|
|
228
|
+
qi = qualifierTlv.end;
|
|
229
|
+
if (qi !== qualifierInfo.end) {
|
|
230
|
+
// kPolicyQualifierInfoTrailingData.
|
|
231
|
+
malformed(oid, "PolicyQualifierInfo has trailing data after the qualifier");
|
|
232
|
+
}
|
|
233
|
+
q = qualifierInfo.end;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
o = policyInformation.end;
|
|
237
|
+
}
|
|
238
|
+
// kPoliciesDuplicateOid: "A certificate policy OID MUST NOT appear more
|
|
239
|
+
// than once in a certificate policies extension."
|
|
240
|
+
const sorted = [...policyOids].sort();
|
|
241
|
+
for (let i = 1; i < sorted.length; i++) {
|
|
242
|
+
if (sorted[i] === sorted[i - 1]) {
|
|
243
|
+
malformed(oid, `duplicate policy OID ${sorted[i]} (kPoliciesDuplicateOid)`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// ---------------------------------------------------------------------------
|
|
248
|
+
// policyConstraints (2.5.29.36) — kFailedParsingPolicyConstraints.
|
|
249
|
+
// ---------------------------------------------------------------------------
|
|
250
|
+
/**
|
|
251
|
+
* ParsePolicyConstraints twin: SEQUENCE { requireExplicitPolicy [0] IMPLICIT
|
|
252
|
+
* INTEGER OPTIONAL, inhibitPolicyMapping [1] IMPLICIT INTEGER OPTIONAL } with
|
|
253
|
+
* at least one field present (RFC 5280: "Conforming CAs MUST NOT issue
|
|
254
|
+
* certificates where policy constraints is an empty sequence"), each field a
|
|
255
|
+
* uint8 (ParseUint8), nothing trailing. The fields are read POSITIONALLY —
|
|
256
|
+
* ReadOptionalTag([0]) then ReadOptionalTag([1]) then HasMore() — so a
|
|
257
|
+
* repeated or out-of-order field is a fault.
|
|
258
|
+
*/
|
|
259
|
+
export function parsePolicyConstraints(value, oid) {
|
|
260
|
+
const seq = readTlv(value, 0);
|
|
261
|
+
if (seq.tag !== 0x30) {
|
|
262
|
+
malformed(oid, "expected PolicyConstraints SEQUENCE");
|
|
263
|
+
}
|
|
264
|
+
if (seq.end !== value.length) {
|
|
265
|
+
malformed(oid, "trailing data after the PolicyConstraints SEQUENCE");
|
|
266
|
+
}
|
|
267
|
+
if (seq.valueStart >= seq.end) {
|
|
268
|
+
// RFC 5280 §4.2.1.5 via ParsePolicyConstraints: "if
|
|
269
|
+
// (!sequence_parser.HasMore()) { return false; }" — an empty sequence
|
|
270
|
+
// is the kFailedParsingPolicyConstraints fault.
|
|
271
|
+
malformed(oid, "PolicyConstraints is an empty SEQUENCE — RFC 5280 §4.2.1.5 requires requireExplicitPolicy or inhibitPolicyMapping");
|
|
272
|
+
}
|
|
273
|
+
let o = seq.valueStart;
|
|
274
|
+
let sawRequire = false;
|
|
275
|
+
let sawInhibit = false;
|
|
276
|
+
if (o < seq.end) {
|
|
277
|
+
const field = readTlv(value, o);
|
|
278
|
+
if (field.tag === 0x80) {
|
|
279
|
+
parseUint8Content(oid, "requireExplicitPolicy", value.subarray(field.valueStart, field.end));
|
|
280
|
+
sawRequire = true;
|
|
281
|
+
o = field.end;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (o < seq.end) {
|
|
285
|
+
const field = readTlv(value, o);
|
|
286
|
+
if (field.tag === 0x81) {
|
|
287
|
+
parseUint8Content(oid, "inhibitPolicyMapping", value.subarray(field.valueStart, field.end));
|
|
288
|
+
sawInhibit = true;
|
|
289
|
+
o = field.end;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (!sawRequire && !sawInhibit) {
|
|
293
|
+
malformed(oid, "expected requireExplicitPolicy [0] or inhibitPolicyMapping [1] as the first element");
|
|
294
|
+
}
|
|
295
|
+
if (o !== seq.end) {
|
|
296
|
+
// sequence_parser.HasMore() / unexpected extra element.
|
|
297
|
+
malformed(oid, "unexpected element after the PolicyConstraints fields");
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
// ---------------------------------------------------------------------------
|
|
301
|
+
// policyMappings (2.5.29.33) — kFailedParsingPolicyMappings.
|
|
302
|
+
// ---------------------------------------------------------------------------
|
|
303
|
+
/**
|
|
304
|
+
* ParsePolicyMappings twin: SEQUENCE SIZE (1..MAX) OF SEQUENCE {
|
|
305
|
+
* issuerDomainPolicy CertPolicyId, subjectDomainPolicy CertPolicyId } — each
|
|
306
|
+
* mapping exactly two OIDs, at least one mapping, nothing trailing.
|
|
307
|
+
*/
|
|
308
|
+
export function parsePolicyMappings(value, oid) {
|
|
309
|
+
const seq = readTlv(value, 0);
|
|
310
|
+
if (seq.tag !== 0x30) {
|
|
311
|
+
malformed(oid, "expected PolicyMappings SEQUENCE");
|
|
312
|
+
}
|
|
313
|
+
if (seq.end !== value.length) {
|
|
314
|
+
malformed(oid, "trailing data after the PolicyMappings SEQUENCE");
|
|
315
|
+
}
|
|
316
|
+
if (seq.valueStart >= seq.end) {
|
|
317
|
+
// "Must be at least 1 mapping."
|
|
318
|
+
malformed(oid, "PolicyMappings must contain at least one mapping");
|
|
319
|
+
}
|
|
320
|
+
let o = seq.valueStart;
|
|
321
|
+
while (o < seq.end) {
|
|
322
|
+
const mapping = readTlv(value, o);
|
|
323
|
+
if (mapping.tag !== 0x30) {
|
|
324
|
+
malformed(oid, "expected issuerDomainPolicy/subjectDomainPolicy SEQUENCE");
|
|
325
|
+
}
|
|
326
|
+
let p = mapping.valueStart;
|
|
327
|
+
const issuerPolicy = readTlv(value, p);
|
|
328
|
+
if (issuerPolicy.tag !== 0x06) {
|
|
329
|
+
malformed(oid, "issuerDomainPolicy must be an OBJECT IDENTIFIER");
|
|
330
|
+
}
|
|
331
|
+
parseOid(value, issuerPolicy.valueStart, issuerPolicy.end);
|
|
332
|
+
p = issuerPolicy.end;
|
|
333
|
+
if (p >= mapping.end) {
|
|
334
|
+
// The mapping SEQUENCE ended after issuerDomainPolicy — BoringSSL's
|
|
335
|
+
// mapping_parser.ReadTag(subject) fails on the truncation
|
|
336
|
+
// (kFailedParsingPolicyMappings); name the missing field.
|
|
337
|
+
malformed(oid, "subjectDomainPolicy must be an OBJECT IDENTIFIER");
|
|
338
|
+
}
|
|
339
|
+
const subjectPolicy = readTlv(value, p);
|
|
340
|
+
if (subjectPolicy.tag !== 0x06) {
|
|
341
|
+
malformed(oid, "subjectDomainPolicy must be an OBJECT IDENTIFIER");
|
|
342
|
+
}
|
|
343
|
+
parseOid(value, subjectPolicy.valueStart, subjectPolicy.end);
|
|
344
|
+
p = subjectPolicy.end;
|
|
345
|
+
if (p !== mapping.end) {
|
|
346
|
+
malformed(oid, "policy mapping has trailing data after subjectDomainPolicy");
|
|
347
|
+
}
|
|
348
|
+
o = mapping.end;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
// ---------------------------------------------------------------------------
|
|
352
|
+
// inhibitAnyPolicy (2.5.29.54) — kFailedParsingInhibitAnyPolicy.
|
|
353
|
+
// ---------------------------------------------------------------------------
|
|
354
|
+
/**
|
|
355
|
+
* ParseInhibitAnyPolicy twin: exactly one INTEGER (SkipCerts ::= INTEGER
|
|
356
|
+
* (0..MAX)) decoding as uint8 — the whole value IS the INTEGER, so a
|
|
357
|
+
* SEQUENCE wrapper or any trailing element is the fault.
|
|
358
|
+
*/
|
|
359
|
+
export function parseInhibitAnyPolicy(value, oid) {
|
|
360
|
+
const integer = readTlv(value, 0);
|
|
361
|
+
if (integer.tag !== 0x02) {
|
|
362
|
+
malformed(oid, `expected SkipCerts INTEGER, got tag 0x${integer.tag.toString(16)}`);
|
|
363
|
+
}
|
|
364
|
+
if (integer.end !== value.length) {
|
|
365
|
+
malformed(oid, "trailing data after the SkipCerts INTEGER");
|
|
366
|
+
}
|
|
367
|
+
parseUint8Content(oid, "SkipCerts", value.subarray(integer.valueStart, integer.end));
|
|
368
|
+
}
|
|
369
|
+
// ---------------------------------------------------------------------------
|
|
370
|
+
// subjectKeyIdentifier (2.5.29.14) — kFailedParsingSubjectKeyIdentifier.
|
|
371
|
+
// ---------------------------------------------------------------------------
|
|
372
|
+
/**
|
|
373
|
+
* ParseSubjectKeyIdentifier twin: exactly one OCTET STRING (KeyIdentifier ::=
|
|
374
|
+
* OCTET STRING), nothing trailing.
|
|
375
|
+
*/
|
|
376
|
+
export function parseSubjectKeyIdentifier(value, oid) {
|
|
377
|
+
const octetString = readTlv(value, 0);
|
|
378
|
+
if (octetString.tag !== 0x04) {
|
|
379
|
+
malformed(oid, `expected KeyIdentifier OCTET STRING, got tag 0x${octetString.tag.toString(16)}`);
|
|
380
|
+
}
|
|
381
|
+
if (octetString.end !== value.length) {
|
|
382
|
+
malformed(oid, "trailing data after the KeyIdentifier OCTET STRING");
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
// ---------------------------------------------------------------------------
|
|
386
|
+
// authorityKeyIdentifier (2.5.29.35) — kFailedParsingAuthorityKeyIdentifier.
|
|
387
|
+
// ---------------------------------------------------------------------------
|
|
388
|
+
/**
|
|
389
|
+
* ParseAuthorityKeyIdentifier twin: SEQUENCE { keyIdentifier [0] OCTET STRING
|
|
390
|
+
* OPTIONAL, authorityCertIssuer [1] GeneralNames OPTIONAL,
|
|
391
|
+
* authorityCertSerialNumber [2] INTEGER OPTIONAL } where [1] and [2] are
|
|
392
|
+
* both-present-or-both-absent ("authorityCertIssuer and
|
|
393
|
+
* authorityCertSerialNumber MUST both be present or both be absent"), nothing
|
|
394
|
+
* trailing. An EMPTY SEQUENCE is tolerated (BoringSSL's TODO: "Should having
|
|
395
|
+
* an empty AuthorityKeyIdentifier SEQUENCE be an error? RFC 5280 doesn't
|
|
396
|
+
* explicitly say it" — the parse succeeds there, so it succeeds here).
|
|
397
|
+
*/
|
|
398
|
+
export function parseAuthorityKeyIdentifier(value, oid) {
|
|
399
|
+
const seq = readTlv(value, 0);
|
|
400
|
+
if (seq.tag !== 0x30) {
|
|
401
|
+
malformed(oid, "expected AuthorityKeyIdentifier SEQUENCE");
|
|
402
|
+
}
|
|
403
|
+
if (seq.end !== value.length) {
|
|
404
|
+
malformed(oid, "trailing data after the AuthorityKeyIdentifier SEQUENCE");
|
|
405
|
+
}
|
|
406
|
+
// The three optional fields are read POSITIONALLY (ReadOptionalTag for
|
|
407
|
+
// [0], then [1], then [2], then HasMore()), so order matters and extras
|
|
408
|
+
// are faults. The [2] serial content is taken as an opaque value (der::Input)
|
|
409
|
+
// by BoringSSL — only the tag is checked here.
|
|
410
|
+
let o = seq.valueStart;
|
|
411
|
+
let sawIssuer = false;
|
|
412
|
+
let sawSerial = false;
|
|
413
|
+
if (o < seq.end) {
|
|
414
|
+
const field = readTlv(value, o);
|
|
415
|
+
if (field.tag === 0x80) {
|
|
416
|
+
o = field.end;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (o < seq.end) {
|
|
420
|
+
const field = readTlv(value, o);
|
|
421
|
+
if (field.tag === 0xa1) {
|
|
422
|
+
sawIssuer = true;
|
|
423
|
+
o = field.end;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
if (o < seq.end) {
|
|
427
|
+
const field = readTlv(value, o);
|
|
428
|
+
if (field.tag === 0x82) {
|
|
429
|
+
sawSerial = true;
|
|
430
|
+
o = field.end;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if (o !== seq.end) {
|
|
434
|
+
malformed(oid, "unexpected element in AuthorityKeyIdentifier (fields must be [0], [1], [2] in order)");
|
|
435
|
+
}
|
|
436
|
+
// "authorityCertIssuer and authorityCertSerialNumber MUST both be present
|
|
437
|
+
// or both be absent" (RFC 5280 §4.2.1.1; the != of the two has_value()
|
|
438
|
+
// tests in BoringSSL).
|
|
439
|
+
if (sawIssuer !== sawSerial) {
|
|
440
|
+
malformed(oid, "authorityCertIssuer [1] and authorityCertSerialNumber [2] must both be present or both absent");
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=extension-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-values.js","sourceRoot":"","sources":["../../src/certificates/extension-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC;IACD,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;QACd,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAChC,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YACrB,SAAS,GAAG,IAAI,CAAC;YACjB,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;QAClB,CAAC;IACL,CAAC;IACD,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;QACd,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAChC,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YACrB,SAAS,GAAG,IAAI,CAAC;YACjB,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;QAClB,CAAC;IACL,CAAC;IACD,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,EAAE,CAAC;QAChB,SAAS,CAAC,GAAG,EAAE,sFAAsF,CAAC,CAAC;IAC3G,CAAC;IACD,0EAA0E;IAC1E,uEAAuE;IACvE,uBAAuB;IACvB,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1B,SAAS,CAAC,GAAG,EAAE,+FAA+F,CAAC,CAAC;IACpH,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GeneralName / GeneralNames DER parsing (RFC 5280 §4.2.1.6, §4.2.1.10).
|
|
3
|
+
*
|
|
4
|
+
* One strict parser serves both consumers that BoringSSL parses at
|
|
5
|
+
* certificate-parse time (parsed_certificate.cc): the subjectAltName
|
|
6
|
+
* extension (`GeneralNames::Create`) and the nameConstraints subtrees
|
|
7
|
+
* (`ParseGeneralSubtrees` → `ParseGeneralName` with
|
|
8
|
+
* `IP_ADDRESS_AND_NETMASK`). Every structural fault this module THROWS on is
|
|
9
|
+
* one BoringSSL rejects the certificate for at parse time, regardless of the
|
|
10
|
+
* extension's critical flag:
|
|
11
|
+
*
|
|
12
|
+
* - the value is not a SEQUENCE covering all its bytes, or is an empty
|
|
13
|
+
* sequence ("GeneralNames is a sequence of 0 elements" /
|
|
14
|
+
* `kGeneralNamesEmpty`; "The GeneralNames sequence should have at least
|
|
15
|
+
* 1 element");
|
|
16
|
+
* - a GeneralName tag outside the nine CHOICE arms ("Unknown GeneralName
|
|
17
|
+
* type" — kUnknownGeneralNameType);
|
|
18
|
+
* - an rfc822Name / dNSName / uniformResourceIdentifier that is not ASCII
|
|
19
|
+
* ("rfc822Name is not ASCII" etc.);
|
|
20
|
+
* - an iPAddress whose octet length is not 4/16 (SAN) or 8/32 with a valid
|
|
21
|
+
* CIDR netmask (constraints) — "Failed parsing iPAddress";
|
|
22
|
+
* - a directoryName whose content does not BEGIN with a readable Name
|
|
23
|
+
* SEQUENCE. Trailing bytes after that SEQUENCE are IGNORED, exactly like
|
|
24
|
+
* BoringSSL: ParseGeneralName checks `parser.HasMore()` on the outer
|
|
25
|
+
* parser, which ReadTagAndValue already consumed (general_names.cc
|
|
26
|
+
* 152-157), so junk inside the [4] TLV after the Name never rejects.
|
|
27
|
+
*
|
|
28
|
+
* Only the name forms BoringSSL's name-constraint engine actually uses are
|
|
29
|
+
* retained (rfc822/dNS/directoryName/iPAddress — name_constraints.cc
|
|
30
|
+
* `kSupportedNameTypes`); the remaining CHOICE arms are validated for
|
|
31
|
+
* structure (so a malformed one still rejects the certificate) but not kept.
|
|
32
|
+
*/
|
|
33
|
+
/** DER content-encoding of one GeneralName CHOICE arm (RFC 5280 §4.2.1.6). */
|
|
34
|
+
export declare const GENERAL_NAME_TAGS: {
|
|
35
|
+
readonly otherName: 160;
|
|
36
|
+
readonly rfc822Name: 129;
|
|
37
|
+
readonly dNSName: 130;
|
|
38
|
+
readonly x400Address: 163;
|
|
39
|
+
readonly directoryName: 164;
|
|
40
|
+
readonly ediPartyName: 165;
|
|
41
|
+
readonly uniformResourceIdentifier: 134;
|
|
42
|
+
readonly iPAddress: 135;
|
|
43
|
+
readonly registeredID: 136;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The parsed GeneralNames value: the four name forms the name-constraint
|
|
47
|
+
* engine and hostname/IP policies consume, plus `presentTags` — the set of
|
|
48
|
+
* CHOICE arms that occurred (BoringSSL `present_name_types`), which decides
|
|
49
|
+
* the critical-unsupported-form rule (`constrained & present & ~supported`).
|
|
50
|
+
*/
|
|
51
|
+
export interface GeneralNames {
|
|
52
|
+
readonly dnsNames: readonly string[];
|
|
53
|
+
readonly rfc822Names: readonly string[];
|
|
54
|
+
/** iPAddress entries as raw octets (4 bytes IPv4 / 16 bytes IPv6). */
|
|
55
|
+
readonly ipAddresses: readonly Uint8Array[];
|
|
56
|
+
/** directoryName entries as RDNSequence VALUE bytes (outer SEQUENCE tag stripped). */
|
|
57
|
+
readonly directoryNames: readonly Uint8Array[];
|
|
58
|
+
/** UniformResourceIdentifier entries (parsed and validated, not enforced). */
|
|
59
|
+
readonly uris: readonly string[];
|
|
60
|
+
/** The set of GeneralName tag bytes that occurred anywhere in the value. */
|
|
61
|
+
readonly presentTags: ReadonlySet<number>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* One retained GeneralName arm: the discriminated value kind fixes the value
|
|
65
|
+
* type (strings for the IA5 forms, raw octets for iPAddress, RDNSequence
|
|
66
|
+
* VALUE bytes for directoryName).
|
|
67
|
+
*/
|
|
68
|
+
export type ParsedGeneralName = {
|
|
69
|
+
readonly kind: "dns";
|
|
70
|
+
readonly value: string;
|
|
71
|
+
} | {
|
|
72
|
+
readonly kind: "rfc822";
|
|
73
|
+
readonly value: string;
|
|
74
|
+
} | {
|
|
75
|
+
readonly kind: "uri";
|
|
76
|
+
readonly value: string;
|
|
77
|
+
} | {
|
|
78
|
+
readonly kind: "ip";
|
|
79
|
+
readonly value: Uint8Array;
|
|
80
|
+
} | {
|
|
81
|
+
readonly kind: "directory";
|
|
82
|
+
readonly value: Uint8Array;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Parse ONE GeneralName TLV (`tlv` already read at `tag`) inside a GeneralNames
|
|
86
|
+
* or GeneralSubtrees SEQUENCE. Returns the retained form, or undefined for the
|
|
87
|
+
* arms this package keeps only structurally-validated (otherName, x400Address,
|
|
88
|
+
* ediPartyName, registeredID). `ipMode` selects the SAN rule (4/16 bytes) or
|
|
89
|
+
* the name-constraint rule (8/32 bytes = address + CIDR netmask).
|
|
90
|
+
*
|
|
91
|
+
* Throws the typed certificate-phase error on any fault BoringSSL's
|
|
92
|
+
* ParseGeneralName (pki/general_names.cc) rejects the certificate for.
|
|
93
|
+
*/
|
|
94
|
+
export declare function parseGeneralName(buf: Uint8Array, tlv: {
|
|
95
|
+
tag: number;
|
|
96
|
+
valueStart: number;
|
|
97
|
+
end: number;
|
|
98
|
+
}, ipMode: "address-only" | "address-and-netmask", oid: string): ParsedGeneralName | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Parse the subjectAltName / GeneralNames value (already unwrapped from its
|
|
101
|
+
* extnValue OCTET STRING): SEQUENCE SIZE (1..MAX) OF GeneralName.
|
|
102
|
+
*
|
|
103
|
+
* Mirrors BoringSSL `GeneralNames::Create` (pki/general_names.cc) which
|
|
104
|
+
* ParsedCertificate::Create runs for EVERY subjectAltName, critical or not;
|
|
105
|
+
* a fault throws the typed error and the certificate is rejected.
|
|
106
|
+
*/
|
|
107
|
+
export declare function parseGeneralNames(value: Uint8Array, oid: string): GeneralNames;
|
|
108
|
+
/**
|
|
109
|
+
* True when `mask` is a valid CIDR netmask (BoringSSL ip_util.h IsValidNetmask):
|
|
110
|
+
* "some number of ones, followed by some number of zeros".
|
|
111
|
+
*/
|
|
112
|
+
export declare function isValidNetmask(mask: Uint8Array): boolean;
|
|
113
|
+
/** True when `addr1`/`addr2` are equal under netmask `mask` (IPAddressMatchesWithNetmask). */
|
|
114
|
+
export declare function ipAddressMatchesWithNetmask(addr1: Uint8Array, addr2: Uint8Array, mask: Uint8Array): boolean;
|
|
115
|
+
/** Dotted-decimal / colon-hex rendering of an iPAddress octet string for diagnostics. */
|
|
116
|
+
export declare function formatIpAddress(bytes: Uint8Array): string;
|
|
117
|
+
/**
|
|
118
|
+
* OID of the pkcs-9 emailAddress attribute (RFC 2985 §5.3.1) — the subject
|
|
119
|
+
* attribute the rfc822Name constraint applies to when the certificate has no
|
|
120
|
+
* subjectAltName (BoringSSL verify_name_match.cc FindEmailAddressesInName,
|
|
121
|
+
* `kTypeEmailAddressOid`).
|
|
122
|
+
*/
|
|
123
|
+
export declare const EMAIL_ADDRESS_ATTRIBUTE_OID = "1.2.840.113549.1.9.1";
|
|
124
|
+
/**
|
|
125
|
+
* True when `oid` (dotted) equals `bytes` (a DER-encoded OBJECT IDENTIFIER
|
|
126
|
+
* value, without tag/length). Used to match name attribute types (OIDs) that
|
|
127
|
+
* were parsed with parseOid against raw OIDs read from constraint DNs.
|
|
128
|
+
*/
|
|
129
|
+
export declare function dottedOidEqualsDer(oid: string, bytes: Uint8Array): boolean;
|
|
130
|
+
/** Read one attribute value as text (AttributeValue ANY → string, like ValueAsString). */
|
|
131
|
+
export declare function attributeValueAsText(buf: Uint8Array, tlv: {
|
|
132
|
+
valueStart: number;
|
|
133
|
+
end: number;
|
|
134
|
+
tag: number;
|
|
135
|
+
}): string | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* Render an RDNSequence VALUE (bytes WITHOUT the outer SEQUENCE tag) as a
|
|
138
|
+
* readable "OID=value, OID=value" string for diagnostics — the display form
|
|
139
|
+
* parseName produces for full Name TLVs, kept byte-shape-independent.
|
|
140
|
+
*/
|
|
141
|
+
export declare function formatRdnSequence(value: Uint8Array): string;
|
|
142
|
+
//# sourceMappingURL=general-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"general-names.d.ts","sourceRoot":"","sources":["../../src/certificates/general-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;G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