micro509 0.14.0 → 0.16.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.
- package/CHANGELOG.md +2119 -0
- package/README.md +105 -225
- package/dist/crypto/crypto.d.ts +42 -11
- package/dist/crypto/crypto.js +53 -22
- package/dist/crypto/crypto.js.map +1 -1
- package/dist/crypto.d.ts +2 -2
- package/dist/crypto.js +1 -2
- package/dist/der/der.d.ts +41 -33
- package/dist/der/der.js +26 -24
- package/dist/der/der.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +19 -19
- package/dist/internal/asn1/asn1.d.ts +3 -6
- package/dist/internal/asn1/asn1.js +343 -43
- package/dist/internal/asn1/asn1.js.map +1 -1
- package/dist/internal/asn1/ber.js +146 -0
- package/dist/internal/asn1/ber.js.map +1 -0
- package/dist/internal/asn1/decode-refusal.js +29 -0
- package/dist/internal/asn1/decode-refusal.js.map +1 -0
- package/dist/internal/asn1/der.d.ts +38 -41
- package/dist/internal/asn1/der.js +131 -52
- package/dist/internal/asn1/der.js.map +1 -1
- package/dist/internal/asn1/oids.js +83 -53
- package/dist/internal/asn1/oids.js.map +1 -1
- package/dist/internal/asn1/oids2.js +1 -2
- package/dist/internal/asn1/oids2.js.map +1 -1
- package/dist/internal/crypto/algorithm-names.js +1 -2
- package/dist/internal/crypto/algorithm-names.js.map +1 -1
- package/dist/internal/crypto/ecdsa.js +13 -8
- package/dist/internal/crypto/ecdsa.js.map +1 -1
- package/dist/internal/crypto/hash.js +1 -2
- package/dist/internal/crypto/hash.js.map +1 -1
- package/dist/internal/crypto/pbes2.d.ts +24 -11
- package/dist/internal/crypto/pbes2.js +79 -26
- package/dist/internal/crypto/pbes2.js.map +1 -1
- package/dist/internal/crypto/rsa-pss.js +46 -44
- package/dist/internal/crypto/rsa-pss.js.map +1 -1
- package/dist/internal/crypto/sig-verify.d.ts +4 -7
- package/dist/internal/crypto/sig-verify.js +107 -60
- package/dist/internal/crypto/sig-verify.js.map +1 -1
- package/dist/internal/crypto/signing.d.ts +1 -4
- package/dist/internal/crypto/signing.js +28 -29
- package/dist/internal/crypto/signing.js.map +1 -1
- package/dist/internal/crypto/webcrypto.js +1 -2
- package/dist/internal/crypto/webcrypto.js.map +1 -1
- package/dist/internal/shared/base64.js +1 -2
- package/dist/internal/shared/base64.js.map +1 -1
- package/dist/internal/shared/dn.d.ts +3 -6
- package/dist/internal/shared/dn.js +99 -53
- package/dist/internal/shared/dn.js.map +1 -1
- package/dist/internal/shared/idna-tables.js +7217 -0
- package/dist/internal/shared/idna-tables.js.map +1 -0
- package/dist/internal/shared/idna.js +296 -0
- package/dist/internal/shared/idna.js.map +1 -0
- package/dist/internal/shared/ip.d.ts +4 -7
- package/dist/internal/shared/ip.js +1 -2
- package/dist/internal/shared/ip.js.map +1 -1
- package/dist/internal/shared/mailbox.js +26 -0
- package/dist/internal/shared/mailbox.js.map +1 -0
- package/dist/internal/shared/punycode.js +101 -0
- package/dist/internal/shared/punycode.js.map +1 -0
- package/dist/internal/shared/rfc3454-tables.js +1 -2
- package/dist/internal/shared/rfc3454-tables.js.map +1 -1
- package/dist/internal/shared/rfc4518-tables.js +119 -0
- package/dist/internal/shared/rfc4518-tables.js.map +1 -0
- package/dist/internal/shared/uri-host.js +102 -0
- package/dist/internal/shared/uri-host.js.map +1 -0
- package/dist/internal/verify/name-constraints-engine.js +246 -131
- package/dist/internal/verify/name-constraints-engine.js.map +1 -1
- package/dist/internal/verify/policy-engine.js +6 -21
- package/dist/internal/verify/policy-engine.js.map +1 -1
- package/dist/internal/verify/spki-distrust.js +23 -0
- package/dist/internal/verify/spki-distrust.js.map +1 -0
- package/dist/internal/verify/verify-path.d.ts +1 -4
- package/dist/internal/verify/verify-path.js +282 -129
- package/dist/internal/verify/verify-path.js.map +1 -1
- package/dist/internal/x509/directory-name.js +1 -2
- package/dist/internal/x509/directory-name.js.map +1 -1
- package/dist/internal/x509/extension-bits.js +2 -3
- package/dist/internal/x509/extension-bits.js.map +1 -1
- package/dist/internal/x509/extension-errors.d.ts +1 -4
- package/dist/internal/x509/extension-errors.js +1 -2
- package/dist/internal/x509/extension-errors.js.map +1 -1
- package/dist/internal/x509/extension-registry.js +107 -89
- package/dist/internal/x509/extension-registry.js.map +1 -1
- package/dist/internal/x509/general-name-profile.js +129 -0
- package/dist/internal/x509/general-name-profile.js.map +1 -0
- package/dist/internal/x509/general-name-tags.js +1 -2
- package/dist/internal/x509/general-name-tags.js.map +1 -1
- package/dist/internal/x509/general-name.js +128 -42
- package/dist/internal/x509/general-name.js.map +1 -1
- package/dist/internal/x509/name-fields.js +1 -2
- package/dist/internal/x509/name-fields.js.map +1 -1
- package/dist/internal/x509/or-address.js +217 -0
- package/dist/internal/x509/or-address.js.map +1 -0
- package/dist/keys/keys.d.ts +122 -104
- package/dist/keys/keys.js +211 -204
- package/dist/keys/keys.js.map +1 -1
- package/dist/keys.d.ts +3 -3
- package/dist/pem/pem.d.ts +14 -17
- package/dist/pem/pem.js +16 -17
- package/dist/pem/pem.js.map +1 -1
- package/dist/pem.js +1 -2
- package/dist/pkcs/pfx.d.ts +57 -32
- package/dist/pkcs/pfx.js +209 -173
- package/dist/pkcs/pfx.js.map +1 -1
- package/dist/pkcs/pkcs12-mac.d.ts +104 -27
- package/dist/pkcs/pkcs12-mac.js +266 -79
- package/dist/pkcs/pkcs12-mac.js.map +1 -1
- package/dist/pkcs/pkcs7.d.ts +43 -37
- package/dist/pkcs/pkcs7.js +218 -217
- package/dist/pkcs/pkcs7.js.map +1 -1
- package/dist/pkcs.d.ts +4 -3
- package/dist/result/result.d.ts +27 -20
- package/dist/result/result.js +8 -3
- package/dist/result/result.js.map +1 -1
- package/dist/result.d.ts +2 -2
- package/dist/result.js +1 -2
- package/dist/revocation/chain.d.ts +101 -23
- package/dist/revocation/chain.js +436 -182
- package/dist/revocation/chain.js.map +1 -1
- package/dist/revocation/crl.d.ts +131 -67
- package/dist/revocation/crl.js +443 -327
- package/dist/revocation/crl.js.map +1 -1
- package/dist/revocation/ocsp.d.ts +94 -59
- package/dist/revocation/ocsp.js +331 -293
- package/dist/revocation/ocsp.js.map +1 -1
- package/dist/revocation/revocation.d.ts +47 -35
- package/dist/revocation/revocation.js +88 -57
- package/dist/revocation/revocation.js.map +1 -1
- package/dist/revocation.d.ts +3 -3
- package/dist/verify/identity.d.ts +16 -19
- package/dist/verify/identity.js +118 -89
- package/dist/verify/identity.js.map +1 -1
- package/dist/verify/name-constraints.d.ts +1 -4
- package/dist/verify/policy.d.ts +9 -7
- package/dist/verify/verify.d.ts +115 -46
- package/dist/verify/verify.js +373 -183
- package/dist/verify/verify.js.map +1 -1
- package/dist/verify.d.ts +2 -2
- package/dist/x509/certificate.d.ts +20 -21
- package/dist/x509/certificate.js +62 -46
- package/dist/x509/certificate.js.map +1 -1
- package/dist/x509/csr.d.ts +5 -7
- package/dist/x509/csr.js +10 -11
- package/dist/x509/csr.js.map +1 -1
- package/dist/x509/extensions.d.ts +154 -66
- package/dist/x509/extensions.js +317 -151
- package/dist/x509/extensions.js.map +1 -1
- package/dist/x509/fingerprint.d.ts +15 -7
- package/dist/x509/fingerprint.js +20 -3
- package/dist/x509/fingerprint.js.map +1 -1
- package/dist/x509/name-text.d.ts +7 -9
- package/dist/x509/name-text.js +18 -4
- package/dist/x509/name-text.js.map +1 -1
- package/dist/x509/name.d.ts +9 -11
- package/dist/x509/name.js +18 -19
- package/dist/x509/name.js.map +1 -1
- package/dist/x509/parse.d.ts +84 -69
- package/dist/x509/parse.js +421 -400
- package/dist/x509/parse.js.map +1 -1
- package/dist/x509.d.ts +3 -3
- package/dist/x509.js +3 -3
- package/package.json +76 -59
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NameAttribute, NameFieldKey, RelativeDistinguishedNameInput } from "./name.js";
|
|
2
2
|
import { ExtensionEncoderErrorCode } from "../internal/x509/extension-errors.js";
|
|
3
3
|
import { allOnesMaskForIpAddress, decodeIpAddress, normalizeIpAddress, parseIpAddressToBytes } from "../internal/shared/ip.js";
|
|
4
|
-
//#region src/x509/extensions.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* A decoded BIT STRING flag set.
|
|
7
6
|
*
|
|
@@ -11,7 +10,7 @@ import { allOnesMaskForIpAddress, decodeIpAddress, normalizeIpAddress, parseIpAd
|
|
|
11
10
|
* Extension flag decoding rejects such encodings, so parsed extension values
|
|
12
11
|
* always report `false`.
|
|
13
12
|
*/
|
|
14
|
-
interface ParsedBitFlags<T extends string> {
|
|
13
|
+
export interface ParsedBitFlags<T extends string> {
|
|
15
14
|
/** Decoded flag values, padding bits masked. */
|
|
16
15
|
readonly flags: readonly T[];
|
|
17
16
|
/** `true` when the original encoding had non-zero padding bits (DER violation). */
|
|
@@ -24,15 +23,16 @@ interface ParsedBitFlags<T extends string> {
|
|
|
24
23
|
*
|
|
25
24
|
* @see {@link https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.3 RFC 5280 §4.2.1.3}
|
|
26
25
|
*/
|
|
27
|
-
type KeyUsage = "digitalSignature" | "nonRepudiation" | "keyEncipherment" | "dataEncipherment" | "keyAgreement" | "keyCertSign" | "cRLSign" | "encipherOnly" | "decipherOnly";
|
|
26
|
+
export type KeyUsage = "digitalSignature" | "nonRepudiation" | "keyEncipherment" | "dataEncipherment" | "keyAgreement" | "keyCertSign" | "cRLSign" | "encipherOnly" | "decipherOnly";
|
|
28
27
|
/**
|
|
29
28
|
* RFC 5280 §4.2.1.6 Subject Alternative Name / GeneralName.
|
|
30
29
|
*
|
|
31
30
|
* Discriminated union keyed on `type`.
|
|
32
31
|
*
|
|
33
|
-
*
|
|
32
|
+
* Every GeneralName alternative has a typed variant. Parsing never produces
|
|
33
|
+
* `'unknown'`, which remains as raw builder input.
|
|
34
34
|
*/
|
|
35
|
-
type SubjectAltName = {
|
|
35
|
+
export type SubjectAltName = {
|
|
36
36
|
/** DNS hostname (dNSName [2]). */
|
|
37
37
|
readonly type: "dns";
|
|
38
38
|
/** Fully-qualified domain name, e.g. `"example.com"`. */
|
|
@@ -57,13 +57,54 @@ type SubjectAltName = {
|
|
|
57
57
|
readonly type: "srv";
|
|
58
58
|
/** SRV service name, e.g. `"_imaps.example.com"`. */
|
|
59
59
|
readonly value: string;
|
|
60
|
+
} | {
|
|
61
|
+
/** SmtpUTF8Mailbox otherName (id-on-SmtpUTF8Mailbox, RFC 9598 §3). */
|
|
62
|
+
readonly type: "smtpUtf8Mailbox";
|
|
63
|
+
/** Internationalized mailbox whose domain is in A-labels, e.g. `"用户@example.com"`. */
|
|
64
|
+
readonly value: string;
|
|
65
|
+
} | {
|
|
66
|
+
/** User principal name otherName (szOID_NT_PRINCIPAL_NAME, [MS-WCCE] §2.2.2.7.5), a UTF8String. */
|
|
67
|
+
readonly type: "upn";
|
|
68
|
+
/** User principal name, e.g. `"user@example.com"`. */
|
|
69
|
+
readonly value: string;
|
|
70
|
+
} | {
|
|
71
|
+
/** Kerberos principal name otherName (id-pkinit-san, RFC 4556 §3.2.2). */
|
|
72
|
+
readonly type: "krb5PrincipalName";
|
|
73
|
+
/** Kerberos realm, e.g. `"EXAMPLE.COM"`. */
|
|
74
|
+
readonly realm: string;
|
|
75
|
+
/** RFC 4120 §6.2 name type, e.g. `1` for NT-PRINCIPAL. */
|
|
76
|
+
readonly nameType: number;
|
|
77
|
+
/** Principal name components, e.g. `["host", "www.example.com"]`. */
|
|
78
|
+
readonly nameString: readonly string[];
|
|
60
79
|
} | {
|
|
61
80
|
/** X.500 directory name (directoryName [4]). */
|
|
62
81
|
readonly type: "directoryName";
|
|
63
82
|
/** Hex-encoded DER of the Name SEQUENCE. */
|
|
64
83
|
readonly derHex: string;
|
|
65
84
|
} | {
|
|
66
|
-
/**
|
|
85
|
+
/** otherName [0] of a type-id without a dedicated variant, or a UPN or KRB5PrincipalName value that does not fit its variant. */
|
|
86
|
+
readonly type: "otherName";
|
|
87
|
+
/** Dotted-decimal type-id OID. */
|
|
88
|
+
readonly typeId: string;
|
|
89
|
+
/** DER of the single element inside `value [0] EXPLICIT`. */
|
|
90
|
+
readonly value: Uint8Array;
|
|
91
|
+
} | {
|
|
92
|
+
/** X.400 O/R address (x400Address [3]). */
|
|
93
|
+
readonly type: "x400Address";
|
|
94
|
+
/** Content octets of the ORAddress SEQUENCE. */
|
|
95
|
+
readonly value: Uint8Array;
|
|
96
|
+
} | {
|
|
97
|
+
/** EDI party name (ediPartyName [5]). */
|
|
98
|
+
readonly type: "ediPartyName";
|
|
99
|
+
/** Content octets of the EDIPartyName SEQUENCE. */
|
|
100
|
+
readonly value: Uint8Array;
|
|
101
|
+
} | {
|
|
102
|
+
/** Registered identifier (registeredID [8]). */
|
|
103
|
+
readonly type: "registeredID";
|
|
104
|
+
/** Dotted-decimal OID. */
|
|
105
|
+
readonly value: string;
|
|
106
|
+
} | {
|
|
107
|
+
/** Raw {@linkcode GeneralName} builder input, encoded under its wire tag. */
|
|
67
108
|
readonly type: "unknown";
|
|
68
109
|
/** ASN.1 context tag number. */
|
|
69
110
|
readonly tag: number;
|
|
@@ -71,18 +112,18 @@ type SubjectAltName = {
|
|
|
71
112
|
readonly value: Uint8Array;
|
|
72
113
|
};
|
|
73
114
|
/** Alias for {@linkcode SubjectAltName} — used where RFC 5280 says "GeneralName". */
|
|
74
|
-
type GeneralName = SubjectAltName;
|
|
115
|
+
export type GeneralName = SubjectAltName;
|
|
75
116
|
/**
|
|
76
117
|
* Revocation reason flags for CRL Distribution Points and Issuing Distribution Points
|
|
77
118
|
* (RFC 5280 §4.2.1.13, §5.2.5).
|
|
78
119
|
*/
|
|
79
|
-
type DistributionPointReason = "keyCompromise" | "cACompromise" | "affiliationChanged" | "superseded" | "cessationOfOperation" | "certificateHold" | "privilegeWithdrawn" | "aACompromise";
|
|
120
|
+
export type DistributionPointReason = "keyCompromise" | "cACompromise" | "affiliationChanged" | "superseded" | "cessationOfOperation" | "certificateHold" | "privilegeWithdrawn" | "aACompromise";
|
|
80
121
|
/**
|
|
81
122
|
* Name component of a CRL Distribution Point, mirroring RFC 5280 §4.2.1.13
|
|
82
123
|
* `DistributionPointName ::= CHOICE { fullName [0] GeneralNames,
|
|
83
124
|
* nameRelativeToCRLIssuer [1] RelativeDistinguishedName }`.
|
|
84
125
|
*/
|
|
85
|
-
type DistributionPointName = {
|
|
126
|
+
export type DistributionPointName = {
|
|
86
127
|
/** The `fullName [0]` alternative. */
|
|
87
128
|
readonly type: "fullName";
|
|
88
129
|
/** Absolute {@linkcode GeneralName}(s) identifying the distribution point (usually a URI). */
|
|
@@ -99,7 +140,7 @@ type DistributionPointName = {
|
|
|
99
140
|
* At least one of `distributionPoint` or `crlIssuer` must be provided.
|
|
100
141
|
* The union enforces this constraint at the type level.
|
|
101
142
|
*/
|
|
102
|
-
type DistributionPoint = {
|
|
143
|
+
export type DistributionPoint = {
|
|
103
144
|
/** Where to fetch the CRL (fullName or relativeName). */
|
|
104
145
|
readonly distributionPoint: DistributionPointName;
|
|
105
146
|
/** Revocation reason subset. Absent means all reasons. */
|
|
@@ -115,7 +156,7 @@ type DistributionPoint = {
|
|
|
115
156
|
readonly crlIssuer: readonly GeneralName[];
|
|
116
157
|
};
|
|
117
158
|
/** Base shape for Issuing Distribution Point (RFC 5280 §5.2.5) — no scope restriction. */
|
|
118
|
-
interface IssuingDistributionPointBase {
|
|
159
|
+
export interface IssuingDistributionPointBase {
|
|
119
160
|
/** Where to fetch this CRL. */
|
|
120
161
|
readonly distributionPoint?: DistributionPointName;
|
|
121
162
|
/** Limits the CRL to these revocation reasons. Absent means all reasons. */
|
|
@@ -130,7 +171,7 @@ interface IssuingDistributionPointBase {
|
|
|
130
171
|
readonly onlyContainsAttributeCerts?: boolean;
|
|
131
172
|
}
|
|
132
173
|
/** IDP scoped to end-entity (user) certificates only. Mutually exclusive with CA / attribute scopes. */
|
|
133
|
-
interface IssuingDistributionPointForUserCerts extends Omit<IssuingDistributionPointBase, "onlyContainsUserCerts"> {
|
|
174
|
+
export interface IssuingDistributionPointForUserCerts extends Omit<IssuingDistributionPointBase, "onlyContainsUserCerts"> {
|
|
134
175
|
/** This variant only covers end-entity certificates. */
|
|
135
176
|
readonly onlyContainsUserCerts: true;
|
|
136
177
|
/** Must be absent or false when the CRL is not CA-only. */
|
|
@@ -139,7 +180,7 @@ interface IssuingDistributionPointForUserCerts extends Omit<IssuingDistributionP
|
|
|
139
180
|
readonly onlyContainsAttributeCerts?: false;
|
|
140
181
|
}
|
|
141
182
|
/** IDP scoped to CA certificates only. Mutually exclusive with user / attribute scopes. */
|
|
142
|
-
interface IssuingDistributionPointForCaCerts extends Omit<IssuingDistributionPointBase, "onlyContainsCACerts"> {
|
|
183
|
+
export interface IssuingDistributionPointForCaCerts extends Omit<IssuingDistributionPointBase, "onlyContainsCACerts"> {
|
|
143
184
|
/** Must be absent or false when the CRL is not user-cert-only. */
|
|
144
185
|
readonly onlyContainsUserCerts?: false;
|
|
145
186
|
/** This variant only covers CA certificates. */
|
|
@@ -148,7 +189,7 @@ interface IssuingDistributionPointForCaCerts extends Omit<IssuingDistributionPoi
|
|
|
148
189
|
readonly onlyContainsAttributeCerts?: false;
|
|
149
190
|
}
|
|
150
191
|
/** IDP scoped to attribute certificates only. Mutually exclusive with user / CA scopes. */
|
|
151
|
-
interface IssuingDistributionPointForAttributeCerts extends Omit<IssuingDistributionPointBase, "onlyContainsAttributeCerts"> {
|
|
192
|
+
export interface IssuingDistributionPointForAttributeCerts extends Omit<IssuingDistributionPointBase, "onlyContainsAttributeCerts"> {
|
|
152
193
|
/** Must be absent or false when the CRL is not user-cert-only. */
|
|
153
194
|
readonly onlyContainsUserCerts?: false;
|
|
154
195
|
/** Must be absent or false when the CRL is not CA-only. */
|
|
@@ -161,14 +202,14 @@ interface IssuingDistributionPointForAttributeCerts extends Omit<IssuingDistribu
|
|
|
161
202
|
*
|
|
162
203
|
* The union enforces that at most one of the `onlyContains*` flags is true.
|
|
163
204
|
*/
|
|
164
|
-
type IssuingDistributionPoint = IssuingDistributionPointBase | IssuingDistributionPointForUserCerts | IssuingDistributionPointForCaCerts | IssuingDistributionPointForAttributeCerts;
|
|
205
|
+
export type IssuingDistributionPoint = IssuingDistributionPointBase | IssuingDistributionPointForUserCerts | IssuingDistributionPointForCaCerts | IssuingDistributionPointForAttributeCerts;
|
|
165
206
|
/**
|
|
166
207
|
* RFC 5280 §4.2.1.9 Basic Constraints.
|
|
167
208
|
*
|
|
168
209
|
* A certificate with `ca: true` may issue other certificates; `pathLength`
|
|
169
210
|
* limits how many additional CAs may appear below it in the chain.
|
|
170
211
|
*/
|
|
171
|
-
type BasicConstraints = {
|
|
212
|
+
export type BasicConstraints = {
|
|
172
213
|
/** End-entity certificate: not a CA. */
|
|
173
214
|
readonly ca: false;
|
|
174
215
|
/** Never present on end-entity certificates. */
|
|
@@ -180,14 +221,14 @@ type BasicConstraints = {
|
|
|
180
221
|
readonly pathLength?: number;
|
|
181
222
|
};
|
|
182
223
|
/** A single certificate policy: an OID plus optional qualifiers. */
|
|
183
|
-
interface PolicyInformation {
|
|
224
|
+
export interface PolicyInformation {
|
|
184
225
|
/** Dotted-decimal OID of the policy (e.g. `"2.23.140.1.2.1"` for DV). */
|
|
185
226
|
readonly policyIdentifier: string;
|
|
186
227
|
/** Optional CPS URIs or user notices attached to this policy. */
|
|
187
228
|
readonly policyQualifiers?: readonly PolicyQualifierInfo[];
|
|
188
229
|
}
|
|
189
230
|
/** RFC 5280 §4.2.1.4 — array of policy OIDs with optional qualifiers. */
|
|
190
|
-
type CertificatePolicies = readonly {
|
|
231
|
+
export type CertificatePolicies = readonly {
|
|
191
232
|
/** Dotted-decimal OID of the policy (e.g. `"2.23.140.1.2.1"` for DV). */
|
|
192
233
|
readonly policyIdentifier: string;
|
|
193
234
|
/** Optional CPS URIs or user notices attached to this policy. */
|
|
@@ -199,8 +240,13 @@ type CertificatePolicies = readonly {
|
|
|
199
240
|
readonly noticeRef?: {
|
|
200
241
|
readonly organization: string;
|
|
201
242
|
readonly noticeNumbers: readonly number[];
|
|
243
|
+
/** Present when `organization` exceeds 200 characters; the builder emits no such notice. */
|
|
244
|
+
readonly oversizedOrganization?: OversizedDisplayText;
|
|
202
245
|
};
|
|
203
246
|
readonly explicitText?: string;
|
|
247
|
+
readonly explicitTextType?: DisplayTextType;
|
|
248
|
+
/** Present when `explicitText` exceeds 200 characters; the builder emits no such notice. */
|
|
249
|
+
readonly oversizedExplicitText?: OversizedDisplayText;
|
|
204
250
|
} | {
|
|
205
251
|
readonly type: "oid";
|
|
206
252
|
readonly oid: string;
|
|
@@ -208,30 +254,49 @@ type CertificatePolicies = readonly {
|
|
|
208
254
|
})[];
|
|
209
255
|
}[];
|
|
210
256
|
/** CPS (Certification Practice Statement) URI policy qualifier. */
|
|
211
|
-
interface CpsPolicyQualifierInfo {
|
|
257
|
+
export interface CpsPolicyQualifierInfo {
|
|
212
258
|
/** Discriminant for the `'cps'` qualifier variant. */
|
|
213
259
|
readonly type: "cps";
|
|
214
260
|
/** URL of the Certification Practice Statement document. */
|
|
215
261
|
readonly uri: string;
|
|
216
262
|
}
|
|
217
263
|
/** Reference to a numbered notice within an organization's practice statement. */
|
|
218
|
-
interface PolicyNoticeReference {
|
|
264
|
+
export interface PolicyNoticeReference {
|
|
219
265
|
/** Organization name that published the notice. */
|
|
220
266
|
readonly organization: string;
|
|
221
267
|
/** One-based notice numbers within that organization's documentation. */
|
|
222
268
|
readonly noticeNumbers: readonly number[];
|
|
223
269
|
}
|
|
224
270
|
/** UserNotice policy qualifier — human-readable notice text and/or a notice reference. */
|
|
225
|
-
interface UserNoticePolicyQualifierInfo {
|
|
271
|
+
export interface UserNoticePolicyQualifierInfo {
|
|
226
272
|
/** Discriminant for the `'userNotice'` qualifier variant. */
|
|
227
273
|
readonly type: "userNotice";
|
|
228
274
|
/** Pointer to a numbered notice in an organization's practice statement. */
|
|
229
275
|
readonly noticeRef?: PolicyNoticeReference;
|
|
230
276
|
/** Free-form text to display to relying parties. */
|
|
231
277
|
readonly explicitText?: string;
|
|
278
|
+
/**
|
|
279
|
+
* ASN.1 string type carrying `explicitText`. Parsing reports the received
|
|
280
|
+
* type. The builder defaults to `'utf8String'`, accepts `'visibleString'`
|
|
281
|
+
* and `'bmpString'`, and rejects `'ia5String'` (RFC 6818 §3).
|
|
282
|
+
*/
|
|
283
|
+
readonly explicitTextType?: DisplayTextType;
|
|
284
|
+
}
|
|
285
|
+
/** The ASN.1 string types RFC 5280 §4.2.1.4 allows for a DisplayText. */
|
|
286
|
+
export type DisplayTextType = "utf8String" | "ia5String" | "visibleString" | "bmpString";
|
|
287
|
+
/**
|
|
288
|
+
* A user notice `explicitText` or `noticeRef` organization longer than the 200
|
|
289
|
+
* characters RFC 5280 §4.2.1.4 allows a DisplayText. Parsing keeps the text
|
|
290
|
+
* whole and reports its size here.
|
|
291
|
+
*/
|
|
292
|
+
export interface OversizedDisplayText {
|
|
293
|
+
/** Characters the certificate carries. */
|
|
294
|
+
readonly characters: number;
|
|
295
|
+
/** The RFC 5280 §4.2.1.4 upper bound, 200. */
|
|
296
|
+
readonly limit: number;
|
|
232
297
|
}
|
|
233
298
|
/** Opaque policy qualifier identified by a custom OID, carried as raw DER. */
|
|
234
|
-
interface CustomPolicyQualifierInfo {
|
|
299
|
+
export interface CustomPolicyQualifierInfo {
|
|
235
300
|
/** Discriminant for the custom-OID qualifier variant. */
|
|
236
301
|
readonly type: "oid";
|
|
237
302
|
/** Dotted-decimal OID of the qualifier. */
|
|
@@ -240,16 +305,16 @@ interface CustomPolicyQualifierInfo {
|
|
|
240
305
|
readonly qualifierDer: Uint8Array;
|
|
241
306
|
}
|
|
242
307
|
/** Discriminated union of all supported policy qualifier types. */
|
|
243
|
-
type PolicyQualifierInfo = CpsPolicyQualifierInfo | UserNoticePolicyQualifierInfo | CustomPolicyQualifierInfo;
|
|
308
|
+
export type PolicyQualifierInfo = CpsPolicyQualifierInfo | UserNoticePolicyQualifierInfo | CustomPolicyQualifierInfo;
|
|
244
309
|
/** Maps a policy OID in the issuer's domain to an equivalent OID in the subject's domain. */
|
|
245
|
-
interface PolicyMapping {
|
|
310
|
+
export interface PolicyMapping {
|
|
246
311
|
/** Policy OID as defined by the issuing CA. Must not be anyPolicy. */
|
|
247
312
|
readonly issuerDomainPolicy: string;
|
|
248
313
|
/** Equivalent policy OID in the subject CA's domain. Must not be anyPolicy. */
|
|
249
314
|
readonly subjectDomainPolicy: string;
|
|
250
315
|
}
|
|
251
316
|
/** RFC 5280 §4.2.1.5 — array of issuer-to-subject policy OID pairs. */
|
|
252
|
-
type PolicyMappings = readonly {
|
|
317
|
+
export type PolicyMappings = readonly {
|
|
253
318
|
/** Policy OID as defined by the issuing CA. Must not be anyPolicy. */
|
|
254
319
|
readonly issuerDomainPolicy: string;
|
|
255
320
|
/** Equivalent policy OID in the subject CA's domain. Must not be anyPolicy. */
|
|
@@ -261,7 +326,7 @@ type PolicyMappings = readonly {
|
|
|
261
326
|
* At least one field must be present. Values are certificate-count
|
|
262
327
|
* thresholds measured from the current certificate toward the end entity.
|
|
263
328
|
*/
|
|
264
|
-
interface PolicyConstraints {
|
|
329
|
+
export interface PolicyConstraints {
|
|
265
330
|
/** After this many certificates, an acceptable policy must be in the path. */
|
|
266
331
|
readonly requireExplicitPolicy?: number;
|
|
267
332
|
/** After this many certificates, policy mapping is no longer allowed. */
|
|
@@ -274,7 +339,7 @@ interface PolicyConstraints {
|
|
|
274
339
|
* special anyPolicy OID is no longer considered a match, except when it
|
|
275
340
|
* appears in an intermediate self-issued CA certificate.
|
|
276
341
|
*/
|
|
277
|
-
interface InhibitAnyPolicy {
|
|
342
|
+
export interface InhibitAnyPolicy {
|
|
278
343
|
/** Number of additional non-self-issued certificates before anyPolicy stops being valid. */
|
|
279
344
|
readonly skipCerts: number;
|
|
280
345
|
}
|
|
@@ -286,7 +351,7 @@ interface InhibitAnyPolicy {
|
|
|
286
351
|
* extensions (SKI, AKI, basicConstraints defaults) are handled automatically
|
|
287
352
|
* by the builder.
|
|
288
353
|
*/
|
|
289
|
-
interface CertificateExtensionsInput {
|
|
354
|
+
export interface CertificateExtensionsInput {
|
|
290
355
|
/** Subject Alternative Names (dns, ip, email, uri, srv, directoryName). */
|
|
291
356
|
readonly subjectAltNames?: readonly SubjectAltName[];
|
|
292
357
|
/** Key Usage flags (digitalSignature, keyCertSign, etc.). */
|
|
@@ -309,11 +374,17 @@ interface CertificateExtensionsInput {
|
|
|
309
374
|
readonly authorityInfoAccess?: readonly AuthorityInformationAccessInput[];
|
|
310
375
|
/** CRL Distribution Points — where to check revocation status. */
|
|
311
376
|
readonly crlDistributionPoints?: readonly DistributionPoint[];
|
|
377
|
+
/**
|
|
378
|
+
* Emit No Revocation Available (RFC 9608 §2): the CA publishes no revocation
|
|
379
|
+
* information for this certificate. A certificate carrying it cannot be a CA
|
|
380
|
+
* and cannot point at a CRL or an OCSP responder (RFC 9608 §3).
|
|
381
|
+
*/
|
|
382
|
+
readonly noRevAvail?: boolean;
|
|
312
383
|
/** Arbitrary extensions not covered by the built-in fields. */
|
|
313
384
|
readonly customExtensions?: readonly CustomExtension[];
|
|
314
385
|
}
|
|
315
386
|
/** An extension not covered by the typed fields in {@linkcode CertificateExtensionsInput}. */
|
|
316
|
-
interface CustomExtension {
|
|
387
|
+
export interface CustomExtension {
|
|
317
388
|
/** Dotted-decimal OID of the extension. */
|
|
318
389
|
readonly oid: string;
|
|
319
390
|
/** Pre-encoded DER content for the extnValue OCTET STRING. */
|
|
@@ -326,7 +397,7 @@ interface CustomExtension {
|
|
|
326
397
|
* Distinct from {@linkcode SubjectAltName} because IP constraints carry
|
|
327
398
|
* address + mask bytes (8 for IPv4, 32 for IPv6) rather than bare addresses.
|
|
328
399
|
*/
|
|
329
|
-
type NameConstraintForm = {
|
|
400
|
+
export type NameConstraintForm = {
|
|
330
401
|
/** DNS domain constraint (dNSName [2]). */
|
|
331
402
|
readonly type: "dns";
|
|
332
403
|
/** Domain suffix, e.g. `".example.com"` or `"example.com"`. */
|
|
@@ -353,14 +424,22 @@ type NameConstraintForm = {
|
|
|
353
424
|
readonly type: "directoryName";
|
|
354
425
|
/** Hex-encoded DER of the Name SEQUENCE. */
|
|
355
426
|
readonly derHex: string;
|
|
427
|
+
} | {
|
|
428
|
+
/** SRVName constraint (otherName id-on-dnsSRV, RFC 4985 §4). */
|
|
429
|
+
readonly type: "srv";
|
|
430
|
+
/** `_Service.Name`, `_Service`, or `Name`, e.g. `"_mail.example.com"`. */
|
|
431
|
+
readonly value: string;
|
|
356
432
|
};
|
|
357
433
|
/**
|
|
358
434
|
* Name constraint forms parsed from DER but not supported for encoding or
|
|
359
435
|
* validation. Preserved for diagnostic round-tripping.
|
|
360
436
|
*/
|
|
361
|
-
type UnsupportedNameConstraintForm = {
|
|
362
|
-
/** otherName [0]
|
|
437
|
+
export type UnsupportedNameConstraintForm = {
|
|
438
|
+
/** otherName [0] of a type-id without defined constraint semantics. */
|
|
363
439
|
readonly type: "otherName";
|
|
440
|
+
/** Dotted-decimal type-id OID. */
|
|
441
|
+
readonly typeId: string;
|
|
442
|
+
/** DER of the single element inside `value [0] EXPLICIT`. */
|
|
364
443
|
readonly value: Uint8Array;
|
|
365
444
|
} | {
|
|
366
445
|
/** x400Address [3] — raw bytes. */
|
|
@@ -376,7 +455,7 @@ type UnsupportedNameConstraintForm = {
|
|
|
376
455
|
readonly value: string;
|
|
377
456
|
};
|
|
378
457
|
/** Union of supported and unsupported name constraint forms as produced by parsing. */
|
|
379
|
-
type ParsedNameConstraintForm = {
|
|
458
|
+
export type ParsedNameConstraintForm = {
|
|
380
459
|
readonly type: "dns";
|
|
381
460
|
readonly value: string;
|
|
382
461
|
} | {
|
|
@@ -392,8 +471,12 @@ type ParsedNameConstraintForm = {
|
|
|
392
471
|
} | {
|
|
393
472
|
readonly type: "directoryName";
|
|
394
473
|
readonly derHex: string;
|
|
474
|
+
} | {
|
|
475
|
+
readonly type: "srv";
|
|
476
|
+
readonly value: string;
|
|
395
477
|
} | {
|
|
396
478
|
readonly type: "otherName";
|
|
479
|
+
readonly typeId: string;
|
|
397
480
|
readonly value: Uint8Array;
|
|
398
481
|
} | {
|
|
399
482
|
readonly type: "x400Address";
|
|
@@ -406,7 +489,7 @@ type ParsedNameConstraintForm = {
|
|
|
406
489
|
readonly value: string;
|
|
407
490
|
};
|
|
408
491
|
/** A single subtree entry in a Name Constraints permitted/excluded list. */
|
|
409
|
-
interface GeneralSubtree<TForm extends ParsedNameConstraintForm = {
|
|
492
|
+
export interface GeneralSubtree<TForm extends ParsedNameConstraintForm = {
|
|
410
493
|
readonly type: "dns";
|
|
411
494
|
readonly value: string;
|
|
412
495
|
} | {
|
|
@@ -422,6 +505,9 @@ interface GeneralSubtree<TForm extends ParsedNameConstraintForm = {
|
|
|
422
505
|
} | {
|
|
423
506
|
readonly type: "directoryName";
|
|
424
507
|
readonly derHex: string;
|
|
508
|
+
} | {
|
|
509
|
+
readonly type: "srv";
|
|
510
|
+
readonly value: string;
|
|
425
511
|
}> {
|
|
426
512
|
/** The name form that defines this constraint boundary. */
|
|
427
513
|
readonly base: TForm;
|
|
@@ -432,7 +518,7 @@ interface GeneralSubtree<TForm extends ParsedNameConstraintForm = {
|
|
|
432
518
|
* A CA certificate may restrict the namespace of all subject names in
|
|
433
519
|
* subsequent certificates in the path.
|
|
434
520
|
*/
|
|
435
|
-
interface NameConstraints<TForm extends ParsedNameConstraintForm = {
|
|
521
|
+
export interface NameConstraints<TForm extends ParsedNameConstraintForm = {
|
|
436
522
|
readonly type: "dns";
|
|
437
523
|
readonly value: string;
|
|
438
524
|
} | {
|
|
@@ -448,6 +534,9 @@ interface NameConstraints<TForm extends ParsedNameConstraintForm = {
|
|
|
448
534
|
} | {
|
|
449
535
|
readonly type: "directoryName";
|
|
450
536
|
readonly derHex: string;
|
|
537
|
+
} | {
|
|
538
|
+
readonly type: "srv";
|
|
539
|
+
readonly value: string;
|
|
451
540
|
}> {
|
|
452
541
|
/** Names that MUST fall within these subtrees to be valid. */
|
|
453
542
|
readonly permittedSubtrees?: readonly GeneralSubtree<TForm>[];
|
|
@@ -455,18 +544,18 @@ interface NameConstraints<TForm extends ParsedNameConstraintForm = {
|
|
|
455
544
|
readonly excludedSubtrees?: readonly GeneralSubtree<TForm>[];
|
|
456
545
|
}
|
|
457
546
|
/** Well-known AIA access methods: OCSP responder or CA issuer certificate. */
|
|
458
|
-
type KnownAuthorityInfoAccessMethod = "ocsp" | "caIssuers";
|
|
547
|
+
export type KnownAuthorityInfoAccessMethod = "ocsp" | "caIssuers";
|
|
459
548
|
/** AIA access method identified by a custom OID not in the well-known set. */
|
|
460
|
-
interface CustomAuthorityInfoAccessMethod {
|
|
549
|
+
export interface CustomAuthorityInfoAccessMethod {
|
|
461
550
|
/** Discriminant for the custom-OID access method variant. */
|
|
462
551
|
readonly type: "oid";
|
|
463
552
|
/** Dotted-decimal OID of the access method. */
|
|
464
553
|
readonly value: string;
|
|
465
554
|
}
|
|
466
555
|
/** AIA access method — either a well-known string or a custom OID. */
|
|
467
|
-
type AuthorityInfoAccessMethod = KnownAuthorityInfoAccessMethod | CustomAuthorityInfoAccessMethod;
|
|
556
|
+
export type AuthorityInfoAccessMethod = KnownAuthorityInfoAccessMethod | CustomAuthorityInfoAccessMethod;
|
|
468
557
|
/** A single entry in the Authority Information Access extension (RFC 5280 §4.2.2.1). */
|
|
469
|
-
interface AuthorityInformationAccess {
|
|
558
|
+
export interface AuthorityInformationAccess {
|
|
470
559
|
/** Access method (`'ocsp'`, `'caIssuers'`, or custom OID). */
|
|
471
560
|
readonly method: "ocsp" | "caIssuers" | {
|
|
472
561
|
readonly type: "oid";
|
|
@@ -482,7 +571,7 @@ interface AuthorityInformationAccess {
|
|
|
482
571
|
* an `'ocsp'` entry must supply a URI location, since RFC 6960 §3.1 defines the
|
|
483
572
|
* `id-ad-ocsp` location as a URI; `directoryName` is defined for `caIssuers`.
|
|
484
573
|
*/
|
|
485
|
-
type AuthorityInformationAccessInput = {
|
|
574
|
+
export type AuthorityInformationAccessInput = {
|
|
486
575
|
/** OCSP responder access method. */
|
|
487
576
|
readonly method: "ocsp";
|
|
488
577
|
/** OCSP responder URI (RFC 6960 §3.1). */
|
|
@@ -497,34 +586,34 @@ type AuthorityInformationAccessInput = {
|
|
|
497
586
|
readonly location: GeneralName;
|
|
498
587
|
};
|
|
499
588
|
/** Well-known Extended Key Usage purpose strings (RFC 5280 §4.2.1.12). */
|
|
500
|
-
type KnownExtendedKeyUsage = "serverAuth" | "clientAuth" | "codeSigning" | "emailProtection" | "timeStamping" | "ocspSigning";
|
|
589
|
+
export type KnownExtendedKeyUsage = "serverAuth" | "clientAuth" | "codeSigning" | "emailProtection" | "timeStamping" | "ocspSigning";
|
|
501
590
|
/** Extended Key Usage purpose identified by a custom OID. */
|
|
502
|
-
interface CustomExtendedKeyUsage {
|
|
591
|
+
export interface CustomExtendedKeyUsage {
|
|
503
592
|
/** Discriminant for the custom-OID EKU variant. */
|
|
504
593
|
readonly type: "oid";
|
|
505
594
|
/** Dotted-decimal OID of the usage purpose. */
|
|
506
595
|
readonly value: string;
|
|
507
596
|
}
|
|
508
597
|
/** Extended Key Usage — either a well-known purpose string or a custom OID. */
|
|
509
|
-
type ExtendedKeyUsage = "serverAuth" | "clientAuth" | "codeSigning" | "emailProtection" | "timeStamping" | "ocspSigning" | {
|
|
598
|
+
export type ExtendedKeyUsage = "serverAuth" | "clientAuth" | "codeSigning" | "emailProtection" | "timeStamping" | "ocspSigning" | {
|
|
510
599
|
readonly type: "oid";
|
|
511
600
|
readonly value: string;
|
|
512
601
|
};
|
|
513
602
|
/**
|
|
514
603
|
* Build the v3 extensions block for a certificate.
|
|
515
604
|
*
|
|
516
|
-
* Automatically adds SKI, AKI (when
|
|
605
|
+
* Automatically adds SKI, AKI (when a key identifier is given), and
|
|
517
606
|
* basicConstraints (defaults to `{ ca: false }`). Additional extensions
|
|
518
607
|
* come from the caller's {@linkcode CertificateExtensionsInput}.
|
|
519
608
|
*
|
|
520
609
|
* @param subjectPublicKeyInfo DER-encoded SPKI of the subject.
|
|
521
|
-
* @param
|
|
610
|
+
* @param authorityKeyIdentifier Key identifier for the AKI, or `undefined` to omit it.
|
|
522
611
|
* @param input Optional extension configuration.
|
|
523
612
|
* @param subjectIsEmpty Whether the certificate subject DN is empty. When `true`, a
|
|
524
613
|
* subjectAltName extension is required and marked critical per RFC 5280 §4.2.1.6.
|
|
525
614
|
* @returns Array of DER-encoded Extension SEQUENCEs.
|
|
526
615
|
*/
|
|
527
|
-
declare function buildCertificateExtensions(subjectPublicKeyInfo: Uint8Array,
|
|
616
|
+
export declare function buildCertificateExtensions(subjectPublicKeyInfo: Uint8Array, authorityKeyIdentifier: Uint8Array | undefined, input: CertificateExtensionsInput | undefined, subjectIsEmpty?: boolean): Uint8Array[];
|
|
528
617
|
/**
|
|
529
618
|
* Build the extensions for a CSR's extensionRequest attribute.
|
|
530
619
|
*
|
|
@@ -533,7 +622,7 @@ declare function buildCertificateExtensions(subjectPublicKeyInfo: Uint8Array, is
|
|
|
533
622
|
* @param input Optional extension configuration.
|
|
534
623
|
* @returns Array of DER-encoded Extension SEQUENCEs.
|
|
535
624
|
*/
|
|
536
|
-
declare function buildRequestedExtensions(input: CertificateExtensionsInput | undefined): Uint8Array[];
|
|
625
|
+
export declare function buildRequestedExtensions(input: CertificateExtensionsInput | undefined): Uint8Array[];
|
|
537
626
|
/**
|
|
538
627
|
* Encode a single X.509 Extension SEQUENCE (OID + optional critical BOOLEAN + OCTET STRING).
|
|
539
628
|
*
|
|
@@ -541,105 +630,104 @@ declare function buildRequestedExtensions(input: CertificateExtensionsInput | un
|
|
|
541
630
|
* @param extnValue DER-encoded extension payload.
|
|
542
631
|
* @param critical Whether to mark the extension as critical. Default `false`.
|
|
543
632
|
*/
|
|
544
|
-
declare function encodeExtension(oid: string, extnValue: Uint8Array, critical?: boolean): Uint8Array;
|
|
633
|
+
export declare function encodeExtension(oid: string, extnValue: Uint8Array, critical?: boolean): Uint8Array;
|
|
545
634
|
/**
|
|
546
635
|
* DER-encode a {@linkcode BasicConstraints} value.
|
|
547
636
|
*
|
|
548
637
|
* @param input CA flag and optional pathLength.
|
|
549
638
|
* @returns DER SEQUENCE suitable for wrapping in an Extension OCTET STRING.
|
|
550
639
|
*/
|
|
551
|
-
declare function encodeBasicConstraints(input: BasicConstraints): Uint8Array;
|
|
640
|
+
export declare function encodeBasicConstraints(input: BasicConstraints): Uint8Array;
|
|
552
641
|
/**
|
|
553
642
|
* DER-encode a Key Usage BIT STRING from an array of {@linkcode KeyUsage} flags.
|
|
554
643
|
*
|
|
555
644
|
* @param usages Flags to set in the bit string.
|
|
556
645
|
*/
|
|
557
|
-
declare function encodeKeyUsage(usages: readonly KeyUsage[]): Uint8Array;
|
|
646
|
+
export declare function encodeKeyUsage(usages: readonly KeyUsage[]): Uint8Array;
|
|
558
647
|
/**
|
|
559
648
|
* DER-encode a single {@linkcode SubjectAltName} GeneralName element.
|
|
560
649
|
*
|
|
561
650
|
* @param value The SAN entry to encode.
|
|
562
651
|
*/
|
|
563
|
-
declare function encodeSubjectAltName(value: SubjectAltName): Uint8Array;
|
|
652
|
+
export declare function encodeSubjectAltName(value: SubjectAltName): Uint8Array;
|
|
564
653
|
/**
|
|
565
654
|
* DER-encode an Extended Key Usage SEQUENCE OF OIDs.
|
|
566
655
|
*
|
|
567
656
|
* @param usages EKU purposes to encode.
|
|
568
657
|
*/
|
|
569
|
-
declare function encodeExtendedKeyUsage(usages: readonly ExtendedKeyUsage[]): Uint8Array;
|
|
658
|
+
export declare function encodeExtendedKeyUsage(usages: readonly ExtendedKeyUsage[]): Uint8Array;
|
|
570
659
|
/**
|
|
571
660
|
* DER-encode an Authority Information Access SEQUENCE.
|
|
572
661
|
*
|
|
573
662
|
* @param entries AIA entries (OCSP, caIssuers, or custom) to encode.
|
|
574
663
|
*/
|
|
575
|
-
declare function encodeAuthorityInfoAccess(entries: readonly AuthorityInformationAccessInput[]): Uint8Array;
|
|
664
|
+
export declare function encodeAuthorityInfoAccess(entries: readonly AuthorityInformationAccessInput[]): Uint8Array;
|
|
576
665
|
/**
|
|
577
666
|
* DER-encode a CRL Distribution Points SEQUENCE.
|
|
578
667
|
*
|
|
579
668
|
* @param points Distribution points to encode.
|
|
580
669
|
*/
|
|
581
|
-
declare function encodeCrlDistributionPoints(points: readonly DistributionPoint[]): Uint8Array;
|
|
670
|
+
export declare function encodeCrlDistributionPoints(points: readonly DistributionPoint[]): Uint8Array;
|
|
582
671
|
/**
|
|
583
672
|
* DER-encode a Name Constraints extension value.
|
|
584
673
|
*
|
|
585
674
|
* @param constraints Permitted and/or excluded subtrees.
|
|
586
675
|
*/
|
|
587
|
-
declare function encodeNameConstraints(constraints: NameConstraints): Uint8Array;
|
|
676
|
+
export declare function encodeNameConstraints(constraints: NameConstraints): Uint8Array;
|
|
588
677
|
/**
|
|
589
678
|
* DER-encode a Certificate Policies extension value.
|
|
590
679
|
*
|
|
591
680
|
* @param policies Non-empty array of policy information entries.
|
|
592
681
|
*/
|
|
593
|
-
declare function encodeCertificatePolicies(policies: CertificatePolicies): Uint8Array;
|
|
682
|
+
export declare function encodeCertificatePolicies(policies: CertificatePolicies): Uint8Array;
|
|
594
683
|
/**
|
|
595
684
|
* DER-encode a Policy Mappings extension value.
|
|
596
685
|
*
|
|
597
686
|
* @param mappings Non-empty array of issuer-to-subject policy pairs. Neither OID may be anyPolicy.
|
|
598
687
|
*/
|
|
599
|
-
declare function encodePolicyMappings(mappings: PolicyMappings): Uint8Array;
|
|
688
|
+
export declare function encodePolicyMappings(mappings: PolicyMappings): Uint8Array;
|
|
600
689
|
/**
|
|
601
690
|
* DER-encode a Policy Constraints extension value.
|
|
602
691
|
*
|
|
603
692
|
* @param constraints At least one of `requireExplicitPolicy` or `inhibitPolicyMapping` must be set.
|
|
604
693
|
*/
|
|
605
|
-
declare function encodePolicyConstraints(constraints: PolicyConstraints): Uint8Array;
|
|
694
|
+
export declare function encodePolicyConstraints(constraints: PolicyConstraints): Uint8Array;
|
|
606
695
|
/**
|
|
607
696
|
* DER-encode an Inhibit anyPolicy extension value (single INTEGER).
|
|
608
697
|
*
|
|
609
698
|
* @param input The skipCerts threshold.
|
|
610
699
|
*/
|
|
611
|
-
declare function encodeInhibitAnyPolicy(input: InhibitAnyPolicy): Uint8Array;
|
|
700
|
+
export declare function encodeInhibitAnyPolicy(input: InhibitAnyPolicy): Uint8Array;
|
|
612
701
|
/**
|
|
613
702
|
* Resolve an {@linkcode ExtendedKeyUsage} to its dotted-decimal OID.
|
|
614
703
|
*
|
|
615
704
|
* @param usage Well-known string or custom OID object.
|
|
616
705
|
*/
|
|
617
|
-
declare function getExtendedKeyUsageOid(usage: ExtendedKeyUsage): string;
|
|
706
|
+
export declare function getExtendedKeyUsageOid(usage: ExtendedKeyUsage): string;
|
|
618
707
|
/**
|
|
619
708
|
* Map a dotted-decimal OID to an {@linkcode ExtendedKeyUsage} value.
|
|
620
709
|
*
|
|
621
710
|
* Returns a well-known string for recognized OIDs, or `{ type: 'oid', value }` otherwise.
|
|
622
711
|
*/
|
|
623
|
-
declare function parseExtendedKeyUsageOid(oid: string): ExtendedKeyUsage;
|
|
712
|
+
export declare function parseExtendedKeyUsageOid(oid: string): ExtendedKeyUsage;
|
|
624
713
|
/**
|
|
625
714
|
* Resolve an {@linkcode AuthorityInfoAccessMethod} to its dotted-decimal OID.
|
|
626
715
|
*
|
|
627
716
|
* @param method Well-known string or custom OID object.
|
|
628
717
|
*/
|
|
629
|
-
declare function getAuthorityInfoAccessMethodOid(method: AuthorityInfoAccessMethod): string;
|
|
718
|
+
export declare function getAuthorityInfoAccessMethodOid(method: AuthorityInfoAccessMethod): string;
|
|
630
719
|
/**
|
|
631
720
|
* Map a dotted-decimal OID to an {@linkcode AuthorityInfoAccessMethod} value.
|
|
632
721
|
*
|
|
633
722
|
* Returns `'ocsp'` or `'caIssuers'` for recognized OIDs, or `{ type: 'oid', value }` otherwise.
|
|
634
723
|
*/
|
|
635
|
-
declare function parseAuthorityInfoAccessMethodOid(oid: string): AuthorityInfoAccessMethod;
|
|
724
|
+
export declare function parseAuthorityInfoAccessMethodOid(oid: string): AuthorityInfoAccessMethod;
|
|
636
725
|
/**
|
|
637
726
|
* Computes a key identifier from a DER `SubjectPublicKeyInfo` using method (1)
|
|
638
727
|
* of RFC 5280 §4.2.1.2: "the 160-bit SHA-1 hash of the value of the BIT STRING
|
|
639
728
|
* subjectPublicKey (excluding the tag, length, and number of unused bits)".
|
|
640
729
|
* A parsed certificate carries the input as `subjectPublicKeyInfoDer`.
|
|
641
730
|
*/
|
|
642
|
-
declare function buildSubjectKeyIdentifier(subjectPublicKeyInfo: Uint8Array): Uint8Array;
|
|
643
|
-
|
|
644
|
-
export { AuthorityInfoAccessMethod, AuthorityInformationAccess, AuthorityInformationAccessInput, BasicConstraints, CertificateExtensionsInput, CertificatePolicies, CpsPolicyQualifierInfo, CustomAuthorityInfoAccessMethod, CustomExtendedKeyUsage, CustomExtension, CustomPolicyQualifierInfo, DistributionPoint, DistributionPointName, DistributionPointReason, ExtendedKeyUsage, type ExtensionEncoderErrorCode, GeneralName, GeneralSubtree, InhibitAnyPolicy, IssuingDistributionPoint, IssuingDistributionPointBase, IssuingDistributionPointForAttributeCerts, IssuingDistributionPointForCaCerts, IssuingDistributionPointForUserCerts, KeyUsage, KnownAuthorityInfoAccessMethod, KnownExtendedKeyUsage, NameConstraintForm, NameConstraints, ParsedBitFlags, ParsedNameConstraintForm, PolicyConstraints, PolicyInformation, PolicyMapping, PolicyMappings, PolicyNoticeReference, PolicyQualifierInfo, SubjectAltName, UnsupportedNameConstraintForm, UserNoticePolicyQualifierInfo, allOnesMaskForIpAddress, buildCertificateExtensions, buildRequestedExtensions, buildSubjectKeyIdentifier, decodeIpAddress, encodeAuthorityInfoAccess, encodeBasicConstraints, encodeCertificatePolicies, encodeCrlDistributionPoints, encodeExtendedKeyUsage, encodeExtension, encodeInhibitAnyPolicy, encodeKeyUsage, encodeNameConstraints, encodePolicyConstraints, encodePolicyMappings, encodeSubjectAltName, getAuthorityInfoAccessMethodOid, getExtendedKeyUsageOid, normalizeIpAddress, parseAuthorityInfoAccessMethodOid, parseExtendedKeyUsageOid, parseIpAddressToBytes };
|
|
731
|
+
export declare function buildSubjectKeyIdentifier(subjectPublicKeyInfo: Uint8Array): Uint8Array;
|
|
732
|
+
export { type ExtensionEncoderErrorCode, allOnesMaskForIpAddress, decodeIpAddress, normalizeIpAddress, parseIpAddressToBytes };
|
|
645
733
|
//# sourceMappingURL=extensions.d.ts.map
|