micro509 0.8.0 → 0.10.0

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.
Files changed (108) hide show
  1. package/dist/index.d.ts +4 -4
  2. package/dist/index.js +15 -15
  3. package/dist/internal/asn1/asn1.js +145 -186
  4. package/dist/internal/asn1/asn1.js.map +1 -0
  5. package/dist/internal/asn1/der.js +210 -227
  6. package/dist/internal/asn1/der.js.map +1 -0
  7. package/dist/internal/asn1/oids.js +297 -101
  8. package/dist/internal/asn1/oids.js.map +1 -0
  9. package/dist/internal/asn1/oids2.js +69 -0
  10. package/dist/internal/asn1/oids2.js.map +1 -0
  11. package/dist/internal/crypto/algorithm-names.js +37 -35
  12. package/dist/internal/crypto/algorithm-names.js.map +1 -0
  13. package/dist/internal/crypto/ecdsa.js +25 -28
  14. package/dist/internal/crypto/ecdsa.js.map +1 -0
  15. package/dist/internal/crypto/hash.js +56 -117
  16. package/dist/internal/crypto/hash.js.map +1 -0
  17. package/dist/internal/crypto/pbes2.js +122 -133
  18. package/dist/internal/crypto/pbes2.js.map +1 -0
  19. package/dist/internal/crypto/rsa-pss.js +118 -124
  20. package/dist/internal/crypto/rsa-pss.js.map +1 -0
  21. package/dist/internal/crypto/sig-verify.js +87 -99
  22. package/dist/internal/crypto/sig-verify.js.map +1 -0
  23. package/dist/internal/crypto/signing.d.ts +12 -8
  24. package/dist/internal/crypto/signing.js +53 -55
  25. package/dist/internal/crypto/signing.js.map +1 -0
  26. package/dist/internal/crypto/webcrypto.js +5 -3
  27. package/dist/internal/crypto/webcrypto.js.map +1 -0
  28. package/dist/internal/shared/base64.js +10 -9
  29. package/dist/internal/shared/base64.js.map +1 -0
  30. package/dist/internal/shared/dn.js +50 -57
  31. package/dist/internal/shared/dn.js.map +1 -0
  32. package/dist/internal/shared/ip.js +43 -53
  33. package/dist/internal/shared/ip.js.map +1 -0
  34. package/dist/internal/verify/name-constraints-engine.js +211 -239
  35. package/dist/internal/verify/name-constraints-engine.js.map +1 -0
  36. package/dist/internal/verify/policy-engine.js +228 -247
  37. package/dist/internal/verify/policy-engine.js.map +1 -0
  38. package/dist/internal/verify/verify-path.js +213 -228
  39. package/dist/internal/verify/verify-path.js.map +1 -0
  40. package/dist/internal/x509/extension-bits.js +62 -59
  41. package/dist/internal/x509/extension-bits.js.map +1 -0
  42. package/dist/internal/x509/extension-registry.js +133 -164
  43. package/dist/internal/x509/extension-registry.js.map +1 -0
  44. package/dist/internal/x509/name-fields.js +35 -41
  45. package/dist/internal/x509/name-fields.js.map +1 -0
  46. package/dist/keys/keys.d.ts +626 -447
  47. package/dist/keys/keys.js +652 -404
  48. package/dist/keys/keys.js.map +1 -0
  49. package/dist/keys.d.ts +2 -2
  50. package/dist/keys.js +2 -2
  51. package/dist/pem/pem.d.ts +46 -46
  52. package/dist/pem/pem.js +62 -81
  53. package/dist/pem/pem.js.map +1 -0
  54. package/dist/pem.js +2 -2
  55. package/dist/pkcs/pfx.d.ts +96 -80
  56. package/dist/pkcs/pfx.js +191 -231
  57. package/dist/pkcs/pfx.js.map +1 -0
  58. package/dist/pkcs/pkcs12-mac.d.ts +20 -18
  59. package/dist/pkcs/pkcs12-mac.js +90 -111
  60. package/dist/pkcs/pkcs12-mac.js.map +1 -0
  61. package/dist/pkcs/pkcs7.d.ts +118 -69
  62. package/dist/pkcs/pkcs7.js +401 -443
  63. package/dist/pkcs/pkcs7.js.map +1 -0
  64. package/dist/pkcs.d.ts +2 -2
  65. package/dist/pkcs.js +4 -4
  66. package/dist/result/result.d.ts +37 -32
  67. package/dist/result/result.js +46 -44
  68. package/dist/result/result.js.map +1 -0
  69. package/dist/result.js +2 -2
  70. package/dist/revocation/chain.d.ts +138 -119
  71. package/dist/revocation/chain.js +248 -281
  72. package/dist/revocation/chain.js.map +1 -0
  73. package/dist/revocation/crl.d.ts +125 -123
  74. package/dist/revocation/crl.js +653 -745
  75. package/dist/revocation/crl.js.map +1 -0
  76. package/dist/revocation/ocsp.d.ts +183 -177
  77. package/dist/revocation/ocsp.js +581 -638
  78. package/dist/revocation/ocsp.js.map +1 -0
  79. package/dist/revocation/revocation.d.ts +26 -26
  80. package/dist/revocation/revocation.js +104 -125
  81. package/dist/revocation/revocation.js.map +1 -0
  82. package/dist/revocation.js +5 -5
  83. package/dist/verify/identity.d.ts +42 -42
  84. package/dist/verify/identity.js +158 -167
  85. package/dist/verify/identity.js.map +1 -0
  86. package/dist/verify/name-constraints.d.ts +7 -7
  87. package/dist/verify/policy.d.ts +10 -10
  88. package/dist/verify/verify.d.ts +163 -163
  89. package/dist/verify/verify.js +396 -392
  90. package/dist/verify/verify.js.map +1 -0
  91. package/dist/verify.js +3 -3
  92. package/dist/x509/certificate.d.ts +117 -117
  93. package/dist/x509/certificate.js +51 -60
  94. package/dist/x509/certificate.js.map +1 -0
  95. package/dist/x509/csr.d.ts +25 -25
  96. package/dist/x509/csr.js +26 -30
  97. package/dist/x509/csr.js.map +1 -0
  98. package/dist/x509/extensions.d.ts +228 -184
  99. package/dist/x509/extensions.js +175 -200
  100. package/dist/x509/extensions.js.map +1 -0
  101. package/dist/x509/name.d.ts +94 -93
  102. package/dist/x509/name.js +30 -29
  103. package/dist/x509/name.js.map +1 -0
  104. package/dist/x509/parse.d.ts +185 -185
  105. package/dist/x509/parse.js +638 -676
  106. package/dist/x509/parse.js.map +1 -0
  107. package/dist/x509.js +6 -6
  108. package/package.json +79 -41
@@ -1,14 +1,13 @@
1
1
  import { NameAttribute, NameFieldKey, RelativeDistinguishedNameInput } from "./name.js";
2
-
3
2
  //#region src/x509/extensions.d.ts
4
3
  /**
5
- * A decoded BIT STRING flag set.
6
- *
7
- * `flags` contains the recognized flag values with any non-zero padding bits
8
- * masked out. `nonZeroPadding` is `true` when the original BIT STRING encoding
9
- * had non-zero bits in positions that DER (X.690 §11.2.2) requires to be zero.
10
- * Verification layers can use this signal to reject non-conformant encodings.
11
- */
4
+ * A decoded BIT STRING flag set.
5
+ *
6
+ * `flags` contains the recognized flag values with any non-zero padding bits
7
+ * masked out. `nonZeroPadding` is `true` when the original BIT STRING encoding
8
+ * had non-zero bits in positions that DER (X.690 §11.2.2) requires to be zero.
9
+ * Verification layers can use this signal to reject non-conformant encodings.
10
+ */
12
11
  interface ParsedBitFlags<T extends string> {
13
12
  /** Decoded flag values, padding bits masked. */
14
13
  readonly flags: readonly T[];
@@ -16,55 +15,70 @@ interface ParsedBitFlags<T extends string> {
16
15
  readonly nonZeroPadding: boolean;
17
16
  }
18
17
  /**
19
- * RFC 5280 §4.2.1.3 Key Usage bit flag.
20
- *
21
- * Each value corresponds to one bit in the KeyUsage BIT STRING.
22
- *
23
- * @see {@link https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.3 RFC 5280 §4.2.1.3}
24
- */
18
+ * RFC 5280 §4.2.1.3 Key Usage bit flag.
19
+ *
20
+ * Each value corresponds to one bit in the KeyUsage BIT STRING.
21
+ *
22
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.3 RFC 5280 §4.2.1.3}
23
+ */
25
24
  type KeyUsage = "digitalSignature" | "nonRepudiation" | "keyEncipherment" | "dataEncipherment" | "keyAgreement" | "keyCertSign" | "cRLSign" | "encipherOnly" | "decipherOnly";
26
25
  /**
27
- * RFC 5280 §4.2.1.6 Subject Alternative Name / GeneralName.
28
- *
29
- * Discriminated union keyed on `type`.
30
- *
31
- * The `'unknown'` variant preserves unrecognized {@linkcode GeneralName} tags for round-trip fidelity.
32
- */
26
+ * RFC 5280 §4.2.1.6 Subject Alternative Name / GeneralName.
27
+ *
28
+ * Discriminated union keyed on `type`.
29
+ *
30
+ * The `'unknown'` variant preserves unrecognized {@linkcode GeneralName} tags for round-trip fidelity.
31
+ */
33
32
  type SubjectAltName = {
34
- /** DNS hostname (dNSName [2]). */readonly type: "dns"; /** Fully-qualified domain name, e.g. `"example.com"`. */
33
+ /** DNS hostname (dNSName [2]). */
34
+ readonly type: "dns";
35
+ /** Fully-qualified domain name, e.g. `"example.com"`. */
35
36
  readonly value: string;
36
37
  } | {
37
- /** IP address (iPAddress [7]). */readonly type: "ip"; /** Dotted-decimal IPv4 or colon-hex IPv6 string. */
38
+ /** IP address (iPAddress [7]). */
39
+ readonly type: "ip";
40
+ /** Dotted-decimal IPv4 or colon-hex IPv6 string. */
38
41
  readonly value: string;
39
42
  } | {
40
- /** Email address (rfc822Name [1]). */readonly type: "email"; /** RFC 822 mailbox, e.g. `"admin@example.com"`. */
43
+ /** Email address (rfc822Name [1]). */
44
+ readonly type: "email";
45
+ /** RFC 822 mailbox, e.g. `"admin@example.com"`. */
41
46
  readonly value: string;
42
47
  } | {
43
- /** URI (uniformResourceIdentifier [6]). */readonly type: "uri"; /** Absolute URI string. */
48
+ /** URI (uniformResourceIdentifier [6]). */
49
+ readonly type: "uri";
50
+ /** Absolute URI string. */
44
51
  readonly value: string;
45
52
  } | {
46
- /** SRV-ID otherName (id-on-dnsSRV). */readonly type: "srv"; /** SRV service name, e.g. `"_imaps.example.com"`. */
53
+ /** SRV-ID otherName (id-on-dnsSRV). */
54
+ readonly type: "srv";
55
+ /** SRV service name, e.g. `"_imaps.example.com"`. */
47
56
  readonly value: string;
48
57
  } | {
49
- /** X.500 directory name (directoryName [4]). */readonly type: "directoryName"; /** Hex-encoded DER of the Name SEQUENCE. */
58
+ /** X.500 directory name (directoryName [4]). */
59
+ readonly type: "directoryName";
60
+ /** Hex-encoded DER of the Name SEQUENCE. */
50
61
  readonly derHex: string;
51
62
  } | {
52
- /** Unrecognized {@linkcode GeneralName} tag, preserved as raw bytes. */readonly type: "unknown"; /** ASN.1 context tag number. */
53
- readonly tag: number; /** Raw content bytes of the element. */
63
+ /** Unrecognized {@linkcode GeneralName} tag, preserved as raw bytes. */
64
+ readonly type: "unknown";
65
+ /** ASN.1 context tag number. */
66
+ readonly tag: number;
67
+ /** Raw content bytes of the element. */
54
68
  readonly value: Uint8Array;
55
69
  };
56
70
  /** Alias for {@linkcode SubjectAltName} — used where RFC 5280 says "GeneralName". */
57
71
  type GeneralName = SubjectAltName;
58
72
  /**
59
- * Revocation reason flags for CRL Distribution Points and Issuing Distribution Points
60
- * (RFC 5280 §4.2.1.13, §5.2.5).
61
- */
73
+ * Revocation reason flags for CRL Distribution Points and Issuing Distribution Points
74
+ * (RFC 5280 §4.2.1.13, §5.2.5).
75
+ */
62
76
  type DistributionPointReason = "keyCompromise" | "cACompromise" | "affiliationChanged" | "superseded" | "cessationOfOperation" | "certificateHold" | "privilegeWithdrawn" | "aACompromise";
63
77
  /**
64
- * Name component of a CRL Distribution Point (RFC 5280 §4.2.1.13).
65
- *
66
- * Supply exactly one of `fullName` or `relativeName`.
67
- */
78
+ * Name component of a CRL Distribution Point (RFC 5280 §4.2.1.13).
79
+ *
80
+ * Supply exactly one of `fullName` or `relativeName`.
81
+ */
68
82
  interface DistributionPointName {
69
83
  /** Absolute {@linkcode GeneralName}(s) identifying the distribution point (usually a URI). */
70
84
  readonly fullName?: readonly GeneralName[];
@@ -72,18 +86,24 @@ interface DistributionPointName {
72
86
  readonly relativeName?: RelativeDistinguishedNameInput;
73
87
  }
74
88
  /**
75
- * Input for a single CRL Distribution Point (RFC 5280 §4.2.1.13).
76
- *
77
- * At least one of `distributionPoint` or `crlIssuer` must be provided.
78
- * The union enforces this constraint at the type level.
79
- */
89
+ * Input for a single CRL Distribution Point (RFC 5280 §4.2.1.13).
90
+ *
91
+ * At least one of `distributionPoint` or `crlIssuer` must be provided.
92
+ * The union enforces this constraint at the type level.
93
+ */
80
94
  type DistributionPoint = {
81
- /** Where to fetch the CRL (fullName or relativeName). */readonly distributionPoint: DistributionPointName; /** Revocation reason subset. Absent means all reasons. */
82
- readonly reasons?: readonly DistributionPointReason[]; /** Entity that signed the CRL, when different from the cert issuer. */
95
+ /** Where to fetch the CRL (fullName or relativeName). */
96
+ readonly distributionPoint: DistributionPointName;
97
+ /** Revocation reason subset. Absent means all reasons. */
98
+ readonly reasons?: readonly DistributionPointReason[];
99
+ /** Entity that signed the CRL, when different from the cert issuer. */
83
100
  readonly crlIssuer?: readonly GeneralName[];
84
101
  } | {
85
- /** Where to fetch the CRL. Optional when `crlIssuer` is present. */readonly distributionPoint?: DistributionPointName; /** Revocation reason subset. Absent means all reasons. */
86
- readonly reasons?: readonly DistributionPointReason[]; /** Entity that signed the CRL. Required when `distributionPoint` is absent. */
102
+ /** Where to fetch the CRL. Optional when `crlIssuer` is present. */
103
+ readonly distributionPoint?: DistributionPointName;
104
+ /** Revocation reason subset. Absent means all reasons. */
105
+ readonly reasons?: readonly DistributionPointReason[];
106
+ /** Entity that signed the CRL. Required when `distributionPoint` is absent. */
87
107
  readonly crlIssuer: readonly GeneralName[];
88
108
  };
89
109
  /** Base shape for Issuing Distribution Point (RFC 5280 §5.2.5) — no scope restriction. */
@@ -129,22 +149,26 @@ interface IssuingDistributionPointForAttributeCerts extends Omit<IssuingDistribu
129
149
  readonly onlyContainsAttributeCerts: true;
130
150
  }
131
151
  /**
132
- * Input for the Issuing Distribution Point CRL extension (RFC 5280 §5.2.5).
133
- *
134
- * The union enforces that at most one of the `onlyContains*` flags is true.
135
- */
152
+ * Input for the Issuing Distribution Point CRL extension (RFC 5280 §5.2.5).
153
+ *
154
+ * The union enforces that at most one of the `onlyContains*` flags is true.
155
+ */
136
156
  type IssuingDistributionPoint = IssuingDistributionPointBase | IssuingDistributionPointForUserCerts | IssuingDistributionPointForCaCerts | IssuingDistributionPointForAttributeCerts;
137
157
  /**
138
- * RFC 5280 §4.2.1.9 Basic Constraints.
139
- *
140
- * A certificate with `ca: true` may issue other certificates; `pathLength`
141
- * limits how many additional CAs may appear below it in the chain.
142
- */
158
+ * RFC 5280 §4.2.1.9 Basic Constraints.
159
+ *
160
+ * A certificate with `ca: true` may issue other certificates; `pathLength`
161
+ * limits how many additional CAs may appear below it in the chain.
162
+ */
143
163
  type BasicConstraints = {
144
- /** End-entity certificate: not a CA. */readonly ca: false; /** Never present on end-entity certificates. */
164
+ /** End-entity certificate: not a CA. */
165
+ readonly ca: false;
166
+ /** Never present on end-entity certificates. */
145
167
  readonly pathLength?: undefined;
146
168
  } | {
147
- /** CA certificate: may issue other certificates. */readonly ca: true; /** Maximum number of intermediate CA certificates allowed below this CA. */
169
+ /** CA certificate: may issue other certificates. */
170
+ readonly ca: true;
171
+ /** Maximum number of intermediate CA certificates allowed below this CA. */
148
172
  readonly pathLength?: number;
149
173
  };
150
174
  /** A single certificate policy: an OID plus optional qualifiers. */
@@ -156,7 +180,9 @@ interface PolicyInformation {
156
180
  }
157
181
  /** RFC 5280 §4.2.1.4 — array of policy OIDs with optional qualifiers. */
158
182
  type CertificatePolicies = readonly {
159
- /** Dotted-decimal OID of the policy (e.g. `"2.23.140.1.2.1"` for DV). */readonly policyIdentifier: string; /** Optional CPS URIs or user notices attached to this policy. */
183
+ /** Dotted-decimal OID of the policy (e.g. `"2.23.140.1.2.1"` for DV). */
184
+ readonly policyIdentifier: string;
185
+ /** Optional CPS URIs or user notices attached to this policy. */
160
186
  readonly policyQualifiers?: readonly ({
161
187
  readonly type: "cps";
162
188
  readonly uri: string;
@@ -216,15 +242,17 @@ interface PolicyMapping {
216
242
  }
217
243
  /** RFC 5280 §4.2.1.5 — array of issuer-to-subject policy OID pairs. */
218
244
  type PolicyMappings = readonly {
219
- /** Policy OID as defined by the issuing CA. Must not be anyPolicy. */readonly issuerDomainPolicy: string; /** Equivalent policy OID in the subject CA's domain. Must not be anyPolicy. */
245
+ /** Policy OID as defined by the issuing CA. Must not be anyPolicy. */
246
+ readonly issuerDomainPolicy: string;
247
+ /** Equivalent policy OID in the subject CA's domain. Must not be anyPolicy. */
220
248
  readonly subjectDomainPolicy: string;
221
249
  }[];
222
250
  /**
223
- * RFC 5280 §4.2.1.11 Policy Constraints.
224
- *
225
- * At least one field must be present. Values are certificate-count
226
- * thresholds measured from the current certificate toward the end entity.
227
- */
251
+ * RFC 5280 §4.2.1.11 Policy Constraints.
252
+ *
253
+ * At least one field must be present. Values are certificate-count
254
+ * thresholds measured from the current certificate toward the end entity.
255
+ */
228
256
  interface PolicyConstraints {
229
257
  /** After this many certificates, an acceptable policy must be in the path. */
230
258
  readonly requireExplicitPolicy?: number;
@@ -232,23 +260,23 @@ interface PolicyConstraints {
232
260
  readonly inhibitPolicyMapping?: number;
233
261
  }
234
262
  /**
235
- * RFC 5280 §4.2.1.14 Inhibit anyPolicy.
236
- *
237
- * After `skipCerts` additional certificates in the path, the special
238
- * anyPolicy OID is no longer considered a match.
239
- */
263
+ * RFC 5280 §4.2.1.14 Inhibit anyPolicy.
264
+ *
265
+ * After `skipCerts` additional certificates in the path, the special
266
+ * anyPolicy OID is no longer considered a match.
267
+ */
240
268
  interface InhibitAnyPolicy {
241
269
  /** Number of additional certificates before anyPolicy stops being valid. */
242
270
  readonly skipCerts: number;
243
271
  }
244
272
  /**
245
- * Input for `createCertificate`, `createSelfSignedCertificate`,
246
- * and `createCertificateSigningRequest`.
247
- *
248
- * Every field is optional. Omitted extensions are not encoded. Built-in
249
- * extensions (SKI, AKI, basicConstraints defaults) are handled automatically
250
- * by the builder.
251
- */
273
+ * Input for `createCertificate`, `createSelfSignedCertificate`,
274
+ * and `createCertificateSigningRequest`.
275
+ *
276
+ * Every field is optional. Omitted extensions are not encoded. Built-in
277
+ * extensions (SKI, AKI, basicConstraints defaults) are handled automatically
278
+ * by the builder.
279
+ */
252
280
  interface CertificateExtensionsInput {
253
281
  /** Subject Alternative Names (dns, ip, email, uri, srv, directoryName). */
254
282
  readonly subjectAltNames?: readonly SubjectAltName[];
@@ -285,42 +313,57 @@ interface CustomExtension {
285
313
  readonly critical?: boolean;
286
314
  }
287
315
  /**
288
- * A name form used as a constraint base in namEConstraints.
289
- * Distinct from {@linkcode SubjectAltName} because IP constraints carry
290
- * address + mask bytes (8 for IPv4, 32 for IPv6) rather than bare addresses.
291
- */
316
+ * A name form used as a constraint base in namEConstraints.
317
+ * Distinct from {@linkcode SubjectAltName} because IP constraints carry
318
+ * address + mask bytes (8 for IPv4, 32 for IPv6) rather than bare addresses.
319
+ */
292
320
  type NameConstraintForm = {
293
- /** DNS domain constraint (dNSName [2]). */readonly type: "dns"; /** Domain suffix, e.g. `".example.com"` or `"example.com"`. */
321
+ /** DNS domain constraint (dNSName [2]). */
322
+ readonly type: "dns";
323
+ /** Domain suffix, e.g. `".example.com"` or `"example.com"`. */
294
324
  readonly value: string;
295
325
  } | {
296
- /** Email constraint (rfc822Name [1]). */readonly type: "email"; /** Email domain or full address pattern. */
326
+ /** Email constraint (rfc822Name [1]). */
327
+ readonly type: "email";
328
+ /** Email domain or full address pattern. */
297
329
  readonly value: string;
298
330
  } | {
299
- /** URI constraint (uniformResourceIdentifier [6]). */readonly type: "uri"; /** Host or domain component of a URI. */
331
+ /** URI constraint (uniformResourceIdentifier [6]). */
332
+ readonly type: "uri";
333
+ /** Host or domain component of a URI. */
300
334
  readonly value: string;
301
335
  } | {
302
- /** IP range constraint (iPAddress [7]). */readonly type: "ip"; /** Network address bytes (4 for IPv4, 16 for IPv6). */
303
- readonly addressBytes: Uint8Array; /** Subnet mask bytes (same length as addressBytes). */
336
+ /** IP range constraint (iPAddress [7]). */
337
+ readonly type: "ip";
338
+ /** Network address bytes (4 for IPv4, 16 for IPv6). */
339
+ readonly addressBytes: Uint8Array;
340
+ /** Subnet mask bytes (same length as addressBytes). */
304
341
  readonly maskBytes: Uint8Array;
305
342
  } | {
306
- /** Directory name constraint (directoryName [4]). */readonly type: "directoryName"; /** Hex-encoded DER of the Name SEQUENCE. */
343
+ /** Directory name constraint (directoryName [4]). */
344
+ readonly type: "directoryName";
345
+ /** Hex-encoded DER of the Name SEQUENCE. */
307
346
  readonly derHex: string;
308
347
  };
309
348
  /**
310
- * Name constraint forms parsed from DER but not supported for encoding or
311
- * validation. Preserved for diagnostic round-tripping.
312
- */
349
+ * Name constraint forms parsed from DER but not supported for encoding or
350
+ * validation. Preserved for diagnostic round-tripping.
351
+ */
313
352
  type UnsupportedNameConstraintForm = {
314
- /** otherName [0] — raw bytes. */readonly type: "otherName";
353
+ /** otherName [0] — raw bytes. */
354
+ readonly type: "otherName";
315
355
  readonly value: Uint8Array;
316
356
  } | {
317
- /** x400Address [3] — raw bytes. */readonly type: "x400Address";
357
+ /** x400Address [3] — raw bytes. */
358
+ readonly type: "x400Address";
318
359
  readonly value: Uint8Array;
319
360
  } | {
320
- /** ediPartyName [5] — raw bytes. */readonly type: "ediPartyName";
361
+ /** ediPartyName [5] — raw bytes. */
362
+ readonly type: "ediPartyName";
321
363
  readonly value: Uint8Array;
322
364
  } | {
323
- /** registeredID [8] — decoded OID string. */readonly type: "registeredID";
365
+ /** registeredID [8] — decoded OID string. */
366
+ readonly type: "registeredID";
324
367
  readonly value: string;
325
368
  };
326
369
  /** Union of supported and unsupported name constraint forms as produced by parsing. */
@@ -375,11 +418,11 @@ interface GeneralSubtree<TForm extends ParsedNameConstraintForm = {
375
418
  readonly base: TForm;
376
419
  }
377
420
  /**
378
- * RFC 5280 §4.2.1.10 Name Constraints.
379
- *
380
- * A CA certificate may restrict the namespace of all subject names in
381
- * subsequent certificates in the path.
382
- */
421
+ * RFC 5280 §4.2.1.10 Name Constraints.
422
+ *
423
+ * A CA certificate may restrict the namespace of all subject names in
424
+ * subsequent certificates in the path.
425
+ */
383
426
  interface NameConstraints<TForm extends ParsedNameConstraintForm = {
384
427
  readonly type: "dns";
385
428
  readonly value: string;
@@ -438,127 +481,128 @@ type ExtendedKeyUsage = "serverAuth" | "clientAuth" | "codeSigning" | "emailProt
438
481
  readonly value: string;
439
482
  };
440
483
  /**
441
- * Build the v3 extensions block for a certificate.
442
- *
443
- * Automatically adds SKI, AKI (when issuer key is available), and
444
- * basicConstraints (defaults to `{ ca: false }`). Additional extensions
445
- * come from the caller's {@linkcode CertificateExtensionsInput}.
446
- *
447
- * @param subjectPublicKeyInfo DER-encoded SPKI of the subject.
448
- * @param issuerPublicKeyInfo DER-encoded SPKI of the issuer, or `undefined` for self-signed.
449
- * @param input Optional extension configuration.
450
- * @param subjectIsEmpty Whether the certificate subject DN is empty. When `true`, the
451
- * subjectAltName extension is marked critical per RFC 5280 §4.2.1.6.
452
- * @returns Array of DER-encoded Extension SEQUENCEs.
453
- */
484
+ * Build the v3 extensions block for a certificate.
485
+ *
486
+ * Automatically adds SKI, AKI (when issuer key is available), and
487
+ * basicConstraints (defaults to `{ ca: false }`). Additional extensions
488
+ * come from the caller's {@linkcode CertificateExtensionsInput}.
489
+ *
490
+ * @param subjectPublicKeyInfo DER-encoded SPKI of the subject.
491
+ * @param issuerPublicKeyInfo DER-encoded SPKI of the issuer, or `undefined` for self-signed.
492
+ * @param input Optional extension configuration.
493
+ * @param subjectIsEmpty Whether the certificate subject DN is empty. When `true`, the
494
+ * subjectAltName extension is marked critical per RFC 5280 §4.2.1.6.
495
+ * @returns Array of DER-encoded Extension SEQUENCEs.
496
+ */
454
497
  declare function buildCertificateExtensions(subjectPublicKeyInfo: Uint8Array, issuerPublicKeyInfo: Uint8Array | undefined, input: CertificateExtensionsInput | undefined, subjectIsEmpty?: boolean): Uint8Array[];
455
498
  /**
456
- * Build the extensions for a CSR's extensionRequest attribute.
457
- *
458
- * Unlike {@linkcode buildCertificateExtensions}, SKI/AKI are not auto-generated.
459
- *
460
- * @param input Optional extension configuration.
461
- * @returns Array of DER-encoded Extension SEQUENCEs.
462
- */
499
+ * Build the extensions for a CSR's extensionRequest attribute.
500
+ *
501
+ * Unlike {@linkcode buildCertificateExtensions}, SKI/AKI are not auto-generated.
502
+ *
503
+ * @param input Optional extension configuration.
504
+ * @returns Array of DER-encoded Extension SEQUENCEs.
505
+ */
463
506
  declare function buildRequestedExtensions(input: CertificateExtensionsInput | undefined): Uint8Array[];
464
507
  /**
465
- * Encode a single X.509 Extension SEQUENCE (OID + optional critical BOOLEAN + OCTET STRING).
466
- *
467
- * @param oid Dotted-decimal extension OID.
468
- * @param extnValue DER-encoded extension payload.
469
- * @param critical Whether to mark the extension as critical. Default `false`.
470
- */
508
+ * Encode a single X.509 Extension SEQUENCE (OID + optional critical BOOLEAN + OCTET STRING).
509
+ *
510
+ * @param oid Dotted-decimal extension OID.
511
+ * @param extnValue DER-encoded extension payload.
512
+ * @param critical Whether to mark the extension as critical. Default `false`.
513
+ */
471
514
  declare function encodeExtension(oid: string, extnValue: Uint8Array, critical?: boolean): Uint8Array;
472
515
  /**
473
- * DER-encode a {@linkcode BasicConstraints} value.
474
- *
475
- * @param input CA flag and optional pathLength.
476
- * @returns DER SEQUENCE suitable for wrapping in an Extension OCTET STRING.
477
- */
516
+ * DER-encode a {@linkcode BasicConstraints} value.
517
+ *
518
+ * @param input CA flag and optional pathLength.
519
+ * @returns DER SEQUENCE suitable for wrapping in an Extension OCTET STRING.
520
+ */
478
521
  declare function encodeBasicConstraints(input: BasicConstraints): Uint8Array;
479
522
  /**
480
- * DER-encode a Key Usage BIT STRING from an array of {@linkcode KeyUsage} flags.
481
- *
482
- * @param usages Flags to set in the bit string.
483
- */
523
+ * DER-encode a Key Usage BIT STRING from an array of {@linkcode KeyUsage} flags.
524
+ *
525
+ * @param usages Flags to set in the bit string.
526
+ */
484
527
  declare function encodeKeyUsage(usages: readonly KeyUsage[]): Uint8Array;
485
528
  /**
486
- * DER-encode a single {@linkcode SubjectAltName} GeneralName element.
487
- *
488
- * @param value The SAN entry to encode.
489
- */
529
+ * DER-encode a single {@linkcode SubjectAltName} GeneralName element.
530
+ *
531
+ * @param value The SAN entry to encode.
532
+ */
490
533
  declare function encodeSubjectAltName(value: SubjectAltName): Uint8Array;
491
534
  /**
492
- * DER-encode an Extended Key Usage SEQUENCE OF OIDs.
493
- *
494
- * @param usages EKU purposes to encode.
495
- */
535
+ * DER-encode an Extended Key Usage SEQUENCE OF OIDs.
536
+ *
537
+ * @param usages EKU purposes to encode.
538
+ */
496
539
  declare function encodeExtendedKeyUsage(usages: readonly ExtendedKeyUsage[]): Uint8Array;
497
540
  /**
498
- * DER-encode an Authority Information Access SEQUENCE.
499
- *
500
- * @param entries AIA entries (OCSP, caIssuers, or custom) to encode.
501
- */
541
+ * DER-encode an Authority Information Access SEQUENCE.
542
+ *
543
+ * @param entries AIA entries (OCSP, caIssuers, or custom) to encode.
544
+ */
502
545
  declare function encodeAuthorityInfoAccess(entries: readonly AuthorityInformationAccess[]): Uint8Array;
503
546
  /**
504
- * DER-encode a CRL Distribution Points SEQUENCE.
505
- *
506
- * @param points Distribution points to encode.
507
- */
547
+ * DER-encode a CRL Distribution Points SEQUENCE.
548
+ *
549
+ * @param points Distribution points to encode.
550
+ */
508
551
  declare function encodeCrlDistributionPoints(points: readonly DistributionPoint[]): Uint8Array;
509
552
  /**
510
- * DER-encode a Name Constraints extension value.
511
- *
512
- * @param constraints Permitted and/or excluded subtrees.
513
- */
553
+ * DER-encode a Name Constraints extension value.
554
+ *
555
+ * @param constraints Permitted and/or excluded subtrees.
556
+ */
514
557
  declare function encodeNameConstraints(constraints: NameConstraints): Uint8Array;
515
558
  /**
516
- * DER-encode a Certificate Policies extension value.
517
- *
518
- * @param policies Non-empty array of policy information entries.
519
- */
559
+ * DER-encode a Certificate Policies extension value.
560
+ *
561
+ * @param policies Non-empty array of policy information entries.
562
+ */
520
563
  declare function encodeCertificatePolicies(policies: CertificatePolicies): Uint8Array;
521
564
  /**
522
- * DER-encode a Policy Mappings extension value.
523
- *
524
- * @param mappings Non-empty array of issuer-to-subject policy pairs. Neither OID may be anyPolicy.
525
- */
565
+ * DER-encode a Policy Mappings extension value.
566
+ *
567
+ * @param mappings Non-empty array of issuer-to-subject policy pairs. Neither OID may be anyPolicy.
568
+ */
526
569
  declare function encodePolicyMappings(mappings: PolicyMappings): Uint8Array;
527
570
  /**
528
- * DER-encode a Policy Constraints extension value.
529
- *
530
- * @param constraints At least one of `requireExplicitPolicy` or `inhibitPolicyMapping` must be set.
531
- */
571
+ * DER-encode a Policy Constraints extension value.
572
+ *
573
+ * @param constraints At least one of `requireExplicitPolicy` or `inhibitPolicyMapping` must be set.
574
+ */
532
575
  declare function encodePolicyConstraints(constraints: PolicyConstraints): Uint8Array;
533
576
  /**
534
- * DER-encode an Inhibit anyPolicy extension value (single INTEGER).
535
- *
536
- * @param input The skipCerts threshold.
537
- */
577
+ * DER-encode an Inhibit anyPolicy extension value (single INTEGER).
578
+ *
579
+ * @param input The skipCerts threshold.
580
+ */
538
581
  declare function encodeInhibitAnyPolicy(input: InhibitAnyPolicy): Uint8Array;
539
582
  /**
540
- * Resolve an {@linkcode ExtendedKeyUsage} to its dotted-decimal OID.
541
- *
542
- * @param usage Well-known string or custom OID object.
543
- */
583
+ * Resolve an {@linkcode ExtendedKeyUsage} to its dotted-decimal OID.
584
+ *
585
+ * @param usage Well-known string or custom OID object.
586
+ */
544
587
  declare function getExtendedKeyUsageOid(usage: ExtendedKeyUsage): string;
545
588
  /**
546
- * Map a dotted-decimal OID to an {@linkcode ExtendedKeyUsage} value.
547
- *
548
- * Returns a well-known string for recognized OIDs, or `{ type: 'oid', value }` otherwise.
549
- */
589
+ * Map a dotted-decimal OID to an {@linkcode ExtendedKeyUsage} value.
590
+ *
591
+ * Returns a well-known string for recognized OIDs, or `{ type: 'oid', value }` otherwise.
592
+ */
550
593
  declare function parseExtendedKeyUsageOid(oid: string): ExtendedKeyUsage;
551
594
  /**
552
- * Resolve an {@linkcode AuthorityInfoAccessMethod} to its dotted-decimal OID.
553
- *
554
- * @param method Well-known string or custom OID object.
555
- */
595
+ * Resolve an {@linkcode AuthorityInfoAccessMethod} to its dotted-decimal OID.
596
+ *
597
+ * @param method Well-known string or custom OID object.
598
+ */
556
599
  declare function getAuthorityInfoAccessMethodOid(method: AuthorityInfoAccessMethod): string;
557
600
  /**
558
- * Map a dotted-decimal OID to an {@linkcode AuthorityInfoAccessMethod} value.
559
- *
560
- * Returns `'ocsp'` or `'caIssuers'` for recognized OIDs, or `{ type: 'oid', value }` otherwise.
561
- */
601
+ * Map a dotted-decimal OID to an {@linkcode AuthorityInfoAccessMethod} value.
602
+ *
603
+ * Returns `'ocsp'` or `'caIssuers'` for recognized OIDs, or `{ type: 'oid', value }` otherwise.
604
+ */
562
605
  declare function parseAuthorityInfoAccessMethodOid(oid: string): AuthorityInfoAccessMethod;
563
606
  //#endregion
564
- export { AuthorityInfoAccessMethod, AuthorityInformationAccess, BasicConstraints, CertificateExtensionsInput, CertificatePolicies, CpsPolicyQualifierInfo, CustomAuthorityInfoAccessMethod, CustomExtendedKeyUsage, CustomExtension, CustomPolicyQualifierInfo, DistributionPoint, DistributionPointName, DistributionPointReason, ExtendedKeyUsage, GeneralName, GeneralSubtree, InhibitAnyPolicy, IssuingDistributionPoint, IssuingDistributionPointBase, IssuingDistributionPointForAttributeCerts, IssuingDistributionPointForCaCerts, IssuingDistributionPointForUserCerts, KeyUsage, KnownAuthorityInfoAccessMethod, KnownExtendedKeyUsage, NameConstraintForm, NameConstraints, ParsedBitFlags, ParsedNameConstraintForm, PolicyConstraints, PolicyInformation, PolicyMapping, PolicyMappings, PolicyNoticeReference, PolicyQualifierInfo, SubjectAltName, UnsupportedNameConstraintForm, UserNoticePolicyQualifierInfo, buildCertificateExtensions, buildRequestedExtensions, encodeAuthorityInfoAccess, encodeBasicConstraints, encodeCertificatePolicies, encodeCrlDistributionPoints, encodeExtendedKeyUsage, encodeExtension, encodeInhibitAnyPolicy, encodeKeyUsage, encodeNameConstraints, encodePolicyConstraints, encodePolicyMappings, encodeSubjectAltName, getAuthorityInfoAccessMethodOid, getExtendedKeyUsageOid, parseAuthorityInfoAccessMethodOid, parseExtendedKeyUsageOid };
607
+ export { AuthorityInfoAccessMethod, AuthorityInformationAccess, BasicConstraints, CertificateExtensionsInput, CertificatePolicies, CpsPolicyQualifierInfo, CustomAuthorityInfoAccessMethod, CustomExtendedKeyUsage, CustomExtension, CustomPolicyQualifierInfo, DistributionPoint, DistributionPointName, DistributionPointReason, ExtendedKeyUsage, GeneralName, GeneralSubtree, InhibitAnyPolicy, IssuingDistributionPoint, IssuingDistributionPointBase, IssuingDistributionPointForAttributeCerts, IssuingDistributionPointForCaCerts, IssuingDistributionPointForUserCerts, KeyUsage, KnownAuthorityInfoAccessMethod, KnownExtendedKeyUsage, NameConstraintForm, NameConstraints, ParsedBitFlags, ParsedNameConstraintForm, PolicyConstraints, PolicyInformation, PolicyMapping, PolicyMappings, PolicyNoticeReference, PolicyQualifierInfo, SubjectAltName, UnsupportedNameConstraintForm, UserNoticePolicyQualifierInfo, buildCertificateExtensions, buildRequestedExtensions, encodeAuthorityInfoAccess, encodeBasicConstraints, encodeCertificatePolicies, encodeCrlDistributionPoints, encodeExtendedKeyUsage, encodeExtension, encodeInhibitAnyPolicy, encodeKeyUsage, encodeNameConstraints, encodePolicyConstraints, encodePolicyMappings, encodeSubjectAltName, getAuthorityInfoAccessMethodOid, getExtendedKeyUsageOid, parseAuthorityInfoAccessMethodOid, parseExtendedKeyUsageOid };
608
+ //# sourceMappingURL=extensions.d.ts.map