micro509 0.14.0 → 0.15.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 (161) hide show
  1. package/CHANGELOG.md +2064 -0
  2. package/README.md +105 -225
  3. package/dist/crypto/crypto.d.ts +42 -11
  4. package/dist/crypto/crypto.js +53 -22
  5. package/dist/crypto/crypto.js.map +1 -1
  6. package/dist/crypto.d.ts +2 -2
  7. package/dist/crypto.js +1 -2
  8. package/dist/der/der.d.ts +41 -33
  9. package/dist/der/der.js +26 -24
  10. package/dist/der/der.js.map +1 -1
  11. package/dist/index.d.ts +10 -10
  12. package/dist/index.js +19 -19
  13. package/dist/internal/asn1/asn1.d.ts +3 -6
  14. package/dist/internal/asn1/asn1.js +343 -43
  15. package/dist/internal/asn1/asn1.js.map +1 -1
  16. package/dist/internal/asn1/ber.js +146 -0
  17. package/dist/internal/asn1/ber.js.map +1 -0
  18. package/dist/internal/asn1/decode-refusal.js +29 -0
  19. package/dist/internal/asn1/decode-refusal.js.map +1 -0
  20. package/dist/internal/asn1/der.d.ts +38 -41
  21. package/dist/internal/asn1/der.js +131 -52
  22. package/dist/internal/asn1/der.js.map +1 -1
  23. package/dist/internal/asn1/oids.js +83 -53
  24. package/dist/internal/asn1/oids.js.map +1 -1
  25. package/dist/internal/asn1/oids2.js +1 -2
  26. package/dist/internal/asn1/oids2.js.map +1 -1
  27. package/dist/internal/crypto/algorithm-names.js +1 -2
  28. package/dist/internal/crypto/algorithm-names.js.map +1 -1
  29. package/dist/internal/crypto/ecdsa.js +13 -8
  30. package/dist/internal/crypto/ecdsa.js.map +1 -1
  31. package/dist/internal/crypto/hash.js +1 -2
  32. package/dist/internal/crypto/hash.js.map +1 -1
  33. package/dist/internal/crypto/pbes2.d.ts +24 -11
  34. package/dist/internal/crypto/pbes2.js +79 -26
  35. package/dist/internal/crypto/pbes2.js.map +1 -1
  36. package/dist/internal/crypto/rsa-pss.js +46 -44
  37. package/dist/internal/crypto/rsa-pss.js.map +1 -1
  38. package/dist/internal/crypto/sig-verify.d.ts +4 -7
  39. package/dist/internal/crypto/sig-verify.js +107 -60
  40. package/dist/internal/crypto/sig-verify.js.map +1 -1
  41. package/dist/internal/crypto/signing.d.ts +1 -4
  42. package/dist/internal/crypto/signing.js +28 -29
  43. package/dist/internal/crypto/signing.js.map +1 -1
  44. package/dist/internal/crypto/webcrypto.js +1 -2
  45. package/dist/internal/crypto/webcrypto.js.map +1 -1
  46. package/dist/internal/shared/base64.js +1 -2
  47. package/dist/internal/shared/base64.js.map +1 -1
  48. package/dist/internal/shared/dn.d.ts +3 -6
  49. package/dist/internal/shared/dn.js +99 -53
  50. package/dist/internal/shared/dn.js.map +1 -1
  51. package/dist/internal/shared/idna-tables.js +7217 -0
  52. package/dist/internal/shared/idna-tables.js.map +1 -0
  53. package/dist/internal/shared/idna.js +296 -0
  54. package/dist/internal/shared/idna.js.map +1 -0
  55. package/dist/internal/shared/ip.d.ts +4 -7
  56. package/dist/internal/shared/ip.js +1 -2
  57. package/dist/internal/shared/ip.js.map +1 -1
  58. package/dist/internal/shared/mailbox.js +26 -0
  59. package/dist/internal/shared/mailbox.js.map +1 -0
  60. package/dist/internal/shared/punycode.js +101 -0
  61. package/dist/internal/shared/punycode.js.map +1 -0
  62. package/dist/internal/shared/rfc3454-tables.js +1 -2
  63. package/dist/internal/shared/rfc3454-tables.js.map +1 -1
  64. package/dist/internal/shared/rfc4518-tables.js +119 -0
  65. package/dist/internal/shared/rfc4518-tables.js.map +1 -0
  66. package/dist/internal/shared/uri-host.js +102 -0
  67. package/dist/internal/shared/uri-host.js.map +1 -0
  68. package/dist/internal/verify/name-constraints-engine.js +246 -131
  69. package/dist/internal/verify/name-constraints-engine.js.map +1 -1
  70. package/dist/internal/verify/policy-engine.js +6 -21
  71. package/dist/internal/verify/policy-engine.js.map +1 -1
  72. package/dist/internal/verify/verify-path.d.ts +1 -4
  73. package/dist/internal/verify/verify-path.js +267 -131
  74. package/dist/internal/verify/verify-path.js.map +1 -1
  75. package/dist/internal/x509/directory-name.js +1 -2
  76. package/dist/internal/x509/directory-name.js.map +1 -1
  77. package/dist/internal/x509/extension-bits.js +2 -3
  78. package/dist/internal/x509/extension-bits.js.map +1 -1
  79. package/dist/internal/x509/extension-errors.d.ts +1 -4
  80. package/dist/internal/x509/extension-errors.js +1 -2
  81. package/dist/internal/x509/extension-errors.js.map +1 -1
  82. package/dist/internal/x509/extension-registry.js +107 -89
  83. package/dist/internal/x509/extension-registry.js.map +1 -1
  84. package/dist/internal/x509/general-name-profile.js +129 -0
  85. package/dist/internal/x509/general-name-profile.js.map +1 -0
  86. package/dist/internal/x509/general-name-tags.js +1 -2
  87. package/dist/internal/x509/general-name-tags.js.map +1 -1
  88. package/dist/internal/x509/general-name.js +128 -42
  89. package/dist/internal/x509/general-name.js.map +1 -1
  90. package/dist/internal/x509/name-fields.js +1 -2
  91. package/dist/internal/x509/name-fields.js.map +1 -1
  92. package/dist/internal/x509/or-address.js +217 -0
  93. package/dist/internal/x509/or-address.js.map +1 -0
  94. package/dist/keys/keys.d.ts +112 -97
  95. package/dist/keys/keys.js +211 -204
  96. package/dist/keys/keys.js.map +1 -1
  97. package/dist/keys.d.ts +3 -3
  98. package/dist/pem/pem.d.ts +14 -17
  99. package/dist/pem/pem.js +16 -17
  100. package/dist/pem/pem.js.map +1 -1
  101. package/dist/pem.js +1 -2
  102. package/dist/pkcs/pfx.d.ts +57 -32
  103. package/dist/pkcs/pfx.js +209 -173
  104. package/dist/pkcs/pfx.js.map +1 -1
  105. package/dist/pkcs/pkcs12-mac.d.ts +104 -27
  106. package/dist/pkcs/pkcs12-mac.js +266 -79
  107. package/dist/pkcs/pkcs12-mac.js.map +1 -1
  108. package/dist/pkcs/pkcs7.d.ts +43 -37
  109. package/dist/pkcs/pkcs7.js +218 -217
  110. package/dist/pkcs/pkcs7.js.map +1 -1
  111. package/dist/pkcs.d.ts +4 -3
  112. package/dist/result/result.d.ts +27 -20
  113. package/dist/result/result.js +8 -3
  114. package/dist/result/result.js.map +1 -1
  115. package/dist/result.d.ts +2 -2
  116. package/dist/result.js +1 -2
  117. package/dist/revocation/chain.d.ts +101 -23
  118. package/dist/revocation/chain.js +436 -182
  119. package/dist/revocation/chain.js.map +1 -1
  120. package/dist/revocation/crl.d.ts +131 -67
  121. package/dist/revocation/crl.js +444 -323
  122. package/dist/revocation/crl.js.map +1 -1
  123. package/dist/revocation/ocsp.d.ts +94 -59
  124. package/dist/revocation/ocsp.js +331 -293
  125. package/dist/revocation/ocsp.js.map +1 -1
  126. package/dist/revocation/revocation.d.ts +47 -35
  127. package/dist/revocation/revocation.js +88 -57
  128. package/dist/revocation/revocation.js.map +1 -1
  129. package/dist/revocation.d.ts +3 -3
  130. package/dist/verify/identity.d.ts +16 -19
  131. package/dist/verify/identity.js +118 -89
  132. package/dist/verify/identity.js.map +1 -1
  133. package/dist/verify/name-constraints.d.ts +1 -4
  134. package/dist/verify/policy.d.ts +9 -7
  135. package/dist/verify/verify.d.ts +84 -46
  136. package/dist/verify/verify.js +300 -152
  137. package/dist/verify/verify.js.map +1 -1
  138. package/dist/verify.d.ts +2 -2
  139. package/dist/x509/certificate.d.ts +20 -21
  140. package/dist/x509/certificate.js +62 -46
  141. package/dist/x509/certificate.js.map +1 -1
  142. package/dist/x509/csr.d.ts +5 -7
  143. package/dist/x509/csr.js +10 -11
  144. package/dist/x509/csr.js.map +1 -1
  145. package/dist/x509/extensions.d.ts +154 -66
  146. package/dist/x509/extensions.js +317 -151
  147. package/dist/x509/extensions.js.map +1 -1
  148. package/dist/x509/fingerprint.d.ts +4 -7
  149. package/dist/x509/fingerprint.js +1 -2
  150. package/dist/x509/fingerprint.js.map +1 -1
  151. package/dist/x509/name-text.d.ts +7 -9
  152. package/dist/x509/name-text.js +18 -4
  153. package/dist/x509/name-text.js.map +1 -1
  154. package/dist/x509/name.d.ts +9 -11
  155. package/dist/x509/name.js +18 -19
  156. package/dist/x509/name.js.map +1 -1
  157. package/dist/x509/parse.d.ts +84 -69
  158. package/dist/x509/parse.js +421 -400
  159. package/dist/x509/parse.js.map +1 -1
  160. package/dist/x509.d.ts +2 -2
  161. package/package.json +76 -59
package/dist/crypto.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { VerifySignatureConfigFailure, VerifySignedDataFailure, VerifySignedDataResult, VerifySignedDataSuccess } from "./internal/crypto/sig-verify.js";
2
2
  import { SignatureProfileInput } from "./internal/crypto/signing.js";
3
- import { SignDataResult, VerifySignatureInput, ecdsaSignatureDerToRaw, ecdsaSignatureRawToDer, signData, verifySignature } from "./crypto/crypto.js";
4
- export { type SignDataResult, type SignatureProfileInput, type VerifySignatureConfigFailure, type VerifySignatureInput, type VerifySignedDataFailure, type VerifySignedDataResult, type VerifySignedDataSuccess, ecdsaSignatureDerToRaw, ecdsaSignatureRawToDer, signData, verifySignature };
3
+ import { SignDataResult, VerifySignatureInput, VerifySignatureLimitFailure, VerifySignatureResult, VerifySignatureWithKeyInput, ecdsaSignatureDerToRaw, ecdsaSignatureRawToDer, signData, verifySignature, verifySignatureWithKey } from "./crypto/crypto.js";
4
+ export { type SignDataResult, type SignatureProfileInput, type VerifySignatureConfigFailure, type VerifySignatureInput, type VerifySignatureLimitFailure, type VerifySignatureResult, type VerifySignatureWithKeyInput, type VerifySignedDataFailure, type VerifySignedDataResult, type VerifySignedDataSuccess, ecdsaSignatureDerToRaw, ecdsaSignatureRawToDer, signData, verifySignature, verifySignatureWithKey };
package/dist/crypto.js CHANGED
@@ -1,2 +1 @@
1
- import { ecdsaSignatureDerToRaw as e, ecdsaSignatureRawToDer as t, signData as n, verifySignature as r } from "./crypto/crypto.js";
2
- export { e as ecdsaSignatureDerToRaw, t as ecdsaSignatureRawToDer, n as signData, r as verifySignature };
1
+ export { ecdsaSignatureDerToRaw, ecdsaSignatureRawToDer, signData, verifySignature, verifySignatureWithKey } from "./crypto/crypto.js";
package/dist/der/der.d.ts CHANGED
@@ -1,16 +1,24 @@
1
- import { ErrorResult, Micro509Error } from "../result/result.js";
1
+ import { DecodeFailureCode, ErrorResult, Micro509Error } from "../result/result.js";
2
2
  import { DerElement, ReadRootElementOptions, ReadSequenceChildrenOptions } from "../internal/asn1/der.js";
3
3
  import { DerBitString } from "../internal/asn1/asn1.js";
4
- //#region src/der/der.d.ts
5
- /** Machine-readable failure reason for the DER readers and decoders. */
6
- type DecodeDerErrorCode = "malformed";
4
+ /**
5
+ * Machine-readable failure reason for the DER readers and decoders.
6
+ *
7
+ * `malformed` is input that breaks DER or the decoder's ASN.1 type.
8
+ * `unsupported` is input the type may allow but micro509 does not decode: a
9
+ * TeletexString octet outside the X.690 §8.23.5.2 initial state.
10
+ * `limit_exceeded` is an implementation limit: an OBJECT IDENTIFIER
11
+ * sub-identifier encoded in more than 64 octets, a tag number of 2^53 or more,
12
+ * or DER nested deeper than 64 levels.
13
+ */
14
+ export type DecodeDerErrorCode = DecodeFailureCode;
7
15
  /** Structured failure payload for DER reading and decoding. */
8
- interface DecodeDerFailure extends Micro509Error<DecodeDerErrorCode> {
16
+ export interface DecodeDerFailure extends Micro509Error<DecodeDerErrorCode> {
9
17
  /** Always `false` for failures. */
10
18
  readonly ok: false;
11
19
  }
12
20
  /** Success-or-failure result from a DER reader or decoder. */
13
- type DecodeDerResult<TValue> = {
21
+ export type DecodeDerResult<TValue> = {
14
22
  readonly ok: true;
15
23
  readonly value: TValue;
16
24
  } | ErrorResult<DecodeDerErrorCode, Record<never, never>, DecodeDerFailure>;
@@ -20,70 +28,70 @@ type DecodeDerResult<TValue> = {
20
28
  * @param offset Byte position of the tag octet. Defaults to 0.
21
29
  * @throws if the element is truncated, indefinite-length, or non-minimally encoded.
22
30
  */
23
- declare function readDerElementOrThrow(bytes: Uint8Array, offset?: number): DerElement;
31
+ export declare function readDerElementOrThrow(bytes: Uint8Array, offset?: number): DerElement;
24
32
  /**
25
33
  * Reads one TLV element from {@linkcode bytes} starting at {@linkcode offset}.
26
34
  *
27
35
  * @param offset Byte position of the tag octet. Defaults to 0.
28
36
  */
29
- declare function readDerElement(bytes: Uint8Array, offset?: number): DecodeDerResult<DerElement>;
37
+ export declare function readDerElement(bytes: Uint8Array, offset?: number): DecodeDerResult<DerElement>;
30
38
  /**
31
39
  * Reads the single top-level TLV element from {@linkcode bytes}.
32
40
  *
33
41
  * @throws if {@linkcode bytes} carries trailing data, or nesting exceeds the depth guard.
34
42
  */
35
- declare function readDerRootOrThrow(bytes: Uint8Array, options?: ReadRootElementOptions): DerElement;
43
+ export declare function readDerRootOrThrow(bytes: Uint8Array, options?: ReadRootElementOptions): DerElement;
36
44
  /** Reads the single top-level TLV element from {@linkcode bytes}. */
37
- declare function readDerRoot(bytes: Uint8Array, options?: ReadRootElementOptions): DecodeDerResult<DerElement>;
45
+ export declare function readDerRoot(bytes: Uint8Array, options?: ReadRootElementOptions): DecodeDerResult<DerElement>;
38
46
  /**
39
47
  * Reads a DER-encoded SEQUENCE from {@linkcode bytes} and returns its direct children.
40
48
  *
41
49
  * @throws if the root element is not a SEQUENCE, or if child boundaries are inconsistent.
42
50
  */
43
- declare function readDerSequenceOrThrow(bytes: Uint8Array, options?: ReadSequenceChildrenOptions): DerElement[];
51
+ export declare function readDerSequenceOrThrow(bytes: Uint8Array, options?: ReadSequenceChildrenOptions): DerElement[];
44
52
  /** Reads a DER-encoded SEQUENCE from {@linkcode bytes} and returns its direct children. */
45
- declare function readDerSequence(bytes: Uint8Array, options?: ReadSequenceChildrenOptions): DecodeDerResult<DerElement[]>;
53
+ export declare function readDerSequence(bytes: Uint8Array, options?: ReadSequenceChildrenOptions): DecodeDerResult<DerElement[]>;
46
54
  /**
47
55
  * Reads the direct children of a constructed {@linkcode parent} within {@linkcode source}.
48
56
  *
49
57
  * @throws if a child overflows {@linkcode parent}, or data is left between the last child and its end.
50
58
  */
51
- declare function derChildrenOrThrow(source: Uint8Array, parent: DerElement): DerElement[];
59
+ export declare function derChildrenOrThrow(source: Uint8Array, parent: DerElement): DerElement[];
52
60
  /** Reads the direct children of a constructed {@linkcode parent} within {@linkcode source}. */
53
- declare function derChildren(source: Uint8Array, parent: DerElement): DecodeDerResult<DerElement[]>;
61
+ export declare function derChildren(source: Uint8Array, parent: DerElement): DecodeDerResult<DerElement[]>;
54
62
  /**
55
63
  * Decodes a BOOLEAN element (tag `0x01`).
56
64
  *
57
65
  * @throws if {@linkcode element} is mis-tagged, or holds anything but `0x00` or `0xff`.
58
66
  */
59
- declare function decodeDerBooleanOrThrow(element: DerElement): boolean;
67
+ export declare function decodeDerBooleanOrThrow(element: DerElement): boolean;
60
68
  /** Decodes a BOOLEAN element (tag `0x01`). */
61
- declare function decodeDerBoolean(element: DerElement): DecodeDerResult<boolean>;
69
+ export declare function decodeDerBoolean(element: DerElement): DecodeDerResult<boolean>;
62
70
  /**
63
71
  * Decodes an INTEGER element (tag `0x02`) into a `number`.
64
72
  *
65
73
  * @throws if {@linkcode element} is mis-tagged, negative, non-minimally encoded,
66
74
  * or exceeds {@linkcode Number.MAX_SAFE_INTEGER}.
67
75
  */
68
- declare function decodeDerIntegerOrThrow(element: DerElement): number;
76
+ export declare function decodeDerIntegerOrThrow(element: DerElement): number;
69
77
  /** Decodes an INTEGER element (tag `0x02`) into a `number`. */
70
- declare function decodeDerInteger(element: DerElement): DecodeDerResult<number>;
78
+ export declare function decodeDerInteger(element: DerElement): DecodeDerResult<number>;
71
79
  /**
72
80
  * Decodes an OCTET STRING element (tag `0x04`) into its payload bytes.
73
81
  *
74
82
  * @throws if {@linkcode element} is mis-tagged.
75
83
  */
76
- declare function decodeDerOctetStringOrThrow(element: DerElement): Uint8Array;
84
+ export declare function decodeDerOctetStringOrThrow(element: DerElement): Uint8Array;
77
85
  /** Decodes an OCTET STRING element (tag `0x04`) into its payload bytes. */
78
- declare function decodeDerOctetString(element: DerElement): DecodeDerResult<Uint8Array>;
86
+ export declare function decodeDerOctetString(element: DerElement): DecodeDerResult<Uint8Array>;
79
87
  /**
80
88
  * Decodes an OBJECT IDENTIFIER element (tag `0x06`) into dotted-decimal form.
81
89
  *
82
90
  * @throws if {@linkcode element} is mis-tagged, or holds a malformed sub-identifier.
83
91
  */
84
- declare function decodeDerOidOrThrow(element: DerElement): string;
92
+ export declare function decodeDerOidOrThrow(element: DerElement): string;
85
93
  /** Decodes an OBJECT IDENTIFIER element (tag `0x06`) into dotted-decimal form. */
86
- declare function decodeDerOid(element: DerElement): DecodeDerResult<string>;
94
+ export declare function decodeDerOid(element: DerElement): DecodeDerResult<string>;
87
95
  /**
88
96
  * Decodes a BIT STRING element (tag `0x03`) into a {@linkcode DerBitString}.
89
97
  *
@@ -92,36 +100,36 @@ declare function decodeDerOid(element: DerElement): DecodeDerResult<string>;
92
100
  *
93
101
  * @throws if {@linkcode element} is mis-tagged, or claims more than seven unused bits.
94
102
  */
95
- declare function decodeDerBitStringOrThrow(element: DerElement): DerBitString;
103
+ export declare function decodeDerBitStringOrThrow(element: DerElement): DerBitString;
96
104
  /**
97
105
  * Decodes a BIT STRING element (tag `0x03`) into a {@linkcode DerBitString}.
98
106
  *
99
107
  * Unused trailing bits are returned as encoded, with a violation of {@linkcode https://www.itu.int/rec/T-REC-X.690-202102-I/en | X.690 §11.2.1} reported
100
108
  * through {@linkcode DerBitString.nonZeroPadding}, since certificates in the wild carry them.
101
109
  */
102
- declare function decodeDerBitString(element: DerElement): DecodeDerResult<DerBitString>;
110
+ export declare function decodeDerBitString(element: DerElement): DecodeDerResult<DerBitString>;
103
111
  /**
104
112
  * Decodes a string element into text, dispatching on its tag.
105
113
  *
106
- * Supports UTF8String, PrintableString, IA5String, UniversalString, and BMPString.
114
+ * Supports UTF8String, PrintableString, TeletexString, IA5String, UniversalString, and BMPString.
115
+ * A TeletexString decodes only in its X.690 §8.23.5.2 initial state.
107
116
  *
108
- * @throws on TeletexString, and on every other string tag.
117
+ * @throws on every other string tag, and on a TeletexString octet outside that state.
109
118
  */
110
- declare function decodeDerStringOrThrow(element: DerElement): string;
119
+ export declare function decodeDerStringOrThrow(element: DerElement): string;
111
120
  /**
112
121
  * Decodes a string element into text, dispatching on its tag.
113
122
  *
114
- * Supports UTF8String, PrintableString, IA5String, UniversalString, and BMPString.
123
+ * Supports UTF8String, PrintableString, TeletexString, IA5String, UniversalString, and BMPString.
124
+ * A TeletexString decodes only in its X.690 §8.23.5.2 initial state.
115
125
  */
116
- declare function decodeDerString(element: DerElement): DecodeDerResult<string>;
126
+ export declare function decodeDerString(element: DerElement): DecodeDerResult<string>;
117
127
  /**
118
128
  * Decodes a UTCTime (tag `0x17`) or GeneralizedTime (tag `0x18`) element into a {@linkcode Date}.
119
129
  *
120
130
  * @throws if {@linkcode element} carries any other tag, or a malformed time value.
121
131
  */
122
- declare function decodeDerTimeOrThrow(element: DerElement): Date;
132
+ export declare function decodeDerTimeOrThrow(element: DerElement): Date;
123
133
  /** Decodes a UTCTime (tag `0x17`) or GeneralizedTime (tag `0x18`) element into a {@linkcode Date}. */
124
- declare function decodeDerTime(element: DerElement): DecodeDerResult<Date>;
125
- //#endregion
126
- export { DecodeDerErrorCode, DecodeDerFailure, DecodeDerResult, decodeDerBitString, decodeDerBitStringOrThrow, decodeDerBoolean, decodeDerBooleanOrThrow, decodeDerInteger, decodeDerIntegerOrThrow, decodeDerOctetString, decodeDerOctetStringOrThrow, decodeDerOid, decodeDerOidOrThrow, decodeDerString, decodeDerStringOrThrow, decodeDerTime, decodeDerTimeOrThrow, derChildren, derChildrenOrThrow, readDerElement, readDerElementOrThrow, readDerRoot, readDerRootOrThrow, readDerSequence, readDerSequenceOrThrow };
134
+ export declare function decodeDerTime(element: DerElement): DecodeDerResult<Date>;
127
135
  //# sourceMappingURL=der.d.ts.map
package/dist/der/der.js CHANGED
@@ -1,12 +1,13 @@
1
- import { readElement as e, readRootElement as t, readSequenceChildren as n } from "../internal/asn1/der.js";
2
- import { childrenOf as r, decodeBitString as i, decodeBoolean as a, decodeIntegerNumber as o, decodeObjectIdentifier as s, decodeString as c, parseTime as l } from "../internal/asn1/asn1.js";
3
- import { failureResult as u, rethrowIfInvariant as d, successResult as f } from "../result/result.js";
4
- //#region src/der/der.ts
5
- function attempt(e, t) {
1
+ import { DECODE_REFUSAL_CODES as e, rethrowIfInvariant as t, successResult as n } from "../result/result.js";
2
+ import { decodeFailureResult as r } from "../internal/asn1/decode-refusal.js";
3
+ import { readElement as i, readRootElement as a, readSequenceChildren as o } from "../internal/asn1/der.js";
4
+ import { childrenOf as s, decodeBitString as c, decodeBoolean as l, decodeIntegerNumber as u, decodeObjectIdentifier as d, decodeString as f, parseTime as p } from "../internal/asn1/asn1.js";
5
+ // src/der/der.ts
6
+ function attempt(i, a) {
6
7
  try {
7
- return f(e());
8
- } catch (e) {
9
- return d(e), u("malformed", e instanceof Error ? e.message : t);
8
+ return n(i());
9
+ } catch (n) {
10
+ return t(n), r(n, e, a);
10
11
  }
11
12
  }
12
13
  function requireTag(e, t, n) {
@@ -19,8 +20,8 @@ function requireTag(e, t, n) {
19
20
  * @param offset Byte position of the tag octet. Defaults to 0.
20
21
  * @throws if the element is truncated, indefinite-length, or non-minimally encoded.
21
22
  */
22
- function readDerElementOrThrow(t, n = 0) {
23
- return e(t, n);
23
+ function readDerElementOrThrow(e, t = 0) {
24
+ return i(e, t);
24
25
  }
25
26
  /**
26
27
  * Reads one TLV element from {@linkcode bytes} starting at {@linkcode offset}.
@@ -35,8 +36,8 @@ function readDerElement(e, t = 0) {
35
36
  *
36
37
  * @throws if {@linkcode bytes} carries trailing data, or nesting exceeds the depth guard.
37
38
  */
38
- function readDerRootOrThrow(e, n) {
39
- return t(e, n);
39
+ function readDerRootOrThrow(e, t) {
40
+ return a(e, t);
40
41
  }
41
42
  /** Reads the single top-level TLV element from {@linkcode bytes}. */
42
43
  function readDerRoot(e, t) {
@@ -48,7 +49,7 @@ function readDerRoot(e, t) {
48
49
  * @throws if the root element is not a SEQUENCE, or if child boundaries are inconsistent.
49
50
  */
50
51
  function readDerSequenceOrThrow(e, t) {
51
- return n(e, t);
52
+ return o(e, t);
52
53
  }
53
54
  /** Reads a DER-encoded SEQUENCE from {@linkcode bytes} and returns its direct children. */
54
55
  function readDerSequence(e, t) {
@@ -60,7 +61,7 @@ function readDerSequence(e, t) {
60
61
  * @throws if a child overflows {@linkcode parent}, or data is left between the last child and its end.
61
62
  */
62
63
  function derChildrenOrThrow(e, t) {
63
- return r(e, t);
64
+ return s(e, t);
64
65
  }
65
66
  /** Reads the direct children of a constructed {@linkcode parent} within {@linkcode source}. */
66
67
  function derChildren(e, t) {
@@ -72,7 +73,7 @@ function derChildren(e, t) {
72
73
  * @throws if {@linkcode element} is mis-tagged, or holds anything but `0x00` or `0xff`.
73
74
  */
74
75
  function decodeDerBooleanOrThrow(e) {
75
- return a(requireTag(e, 1, "BOOLEAN").value);
76
+ return l(requireTag(e, 1, "BOOLEAN").value);
76
77
  }
77
78
  /** Decodes a BOOLEAN element (tag `0x01`). */
78
79
  function decodeDerBoolean(e) {
@@ -85,7 +86,7 @@ function decodeDerBoolean(e) {
85
86
  * or exceeds {@linkcode Number.MAX_SAFE_INTEGER}.
86
87
  */
87
88
  function decodeDerIntegerOrThrow(e) {
88
- return o(requireTag(e, 2, "INTEGER").value);
89
+ return u(requireTag(e, 2, "INTEGER").value);
89
90
  }
90
91
  /** Decodes an INTEGER element (tag `0x02`) into a `number`. */
91
92
  function decodeDerInteger(e) {
@@ -109,7 +110,7 @@ function decodeDerOctetString(e) {
109
110
  * @throws if {@linkcode element} is mis-tagged, or holds a malformed sub-identifier.
110
111
  */
111
112
  function decodeDerOidOrThrow(e) {
112
- return s(requireTag(e, 6, "OBJECT IDENTIFIER").value);
113
+ return d(requireTag(e, 6, "OBJECT IDENTIFIER").value);
113
114
  }
114
115
  /** Decodes an OBJECT IDENTIFIER element (tag `0x06`) into dotted-decimal form. */
115
116
  function decodeDerOid(e) {
@@ -124,7 +125,7 @@ function decodeDerOid(e) {
124
125
  * @throws if {@linkcode element} is mis-tagged, or claims more than seven unused bits.
125
126
  */
126
127
  function decodeDerBitStringOrThrow(e) {
127
- return i(e);
128
+ return c(e);
128
129
  }
129
130
  /**
130
131
  * Decodes a BIT STRING element (tag `0x03`) into a {@linkcode DerBitString}.
@@ -138,17 +139,19 @@ function decodeDerBitString(e) {
138
139
  /**
139
140
  * Decodes a string element into text, dispatching on its tag.
140
141
  *
141
- * Supports UTF8String, PrintableString, IA5String, UniversalString, and BMPString.
142
+ * Supports UTF8String, PrintableString, TeletexString, IA5String, UniversalString, and BMPString.
143
+ * A TeletexString decodes only in its X.690 §8.23.5.2 initial state.
142
144
  *
143
- * @throws on TeletexString, and on every other string tag.
145
+ * @throws on every other string tag, and on a TeletexString octet outside that state.
144
146
  */
145
147
  function decodeDerStringOrThrow(e) {
146
- return c(e.tag, e.value);
148
+ return f(e.tag, e.value);
147
149
  }
148
150
  /**
149
151
  * Decodes a string element into text, dispatching on its tag.
150
152
  *
151
- * Supports UTF8String, PrintableString, IA5String, UniversalString, and BMPString.
153
+ * Supports UTF8String, PrintableString, TeletexString, IA5String, UniversalString, and BMPString.
154
+ * A TeletexString decodes only in its X.690 §8.23.5.2 initial state.
152
155
  */
153
156
  function decodeDerString(e) {
154
157
  return attempt(() => decodeDerStringOrThrow(e), "Malformed string");
@@ -159,13 +162,12 @@ function decodeDerString(e) {
159
162
  * @throws if {@linkcode element} carries any other tag, or a malformed time value.
160
163
  */
161
164
  function decodeDerTimeOrThrow(e) {
162
- return l(e);
165
+ return p(e);
163
166
  }
164
167
  /** Decodes a UTCTime (tag `0x17`) or GeneralizedTime (tag `0x18`) element into a {@linkcode Date}. */
165
168
  function decodeDerTime(e) {
166
169
  return attempt(() => decodeDerTimeOrThrow(e), "Malformed time");
167
170
  }
168
- //#endregion
169
171
  export { decodeDerBitString, decodeDerBitStringOrThrow, decodeDerBoolean, decodeDerBooleanOrThrow, decodeDerInteger, decodeDerIntegerOrThrow, decodeDerOctetString, decodeDerOctetStringOrThrow, decodeDerOid, decodeDerOidOrThrow, decodeDerString, decodeDerStringOrThrow, decodeDerTime, decodeDerTimeOrThrow, derChildren, derChildrenOrThrow, readDerElement, readDerElementOrThrow, readDerRoot, readDerRootOrThrow, readDerSequence, readDerSequenceOrThrow };
170
172
 
171
173
  //# sourceMappingURL=der.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"der.js","names":[],"sources":["../../src/der/der.ts"],"sourcesContent":["/**\n * Element-oriented DER readers and decoders.\n *\n * Each decoder validates the element's tag before reading its value, so a\n * mis-tagged element fails instead of yielding a wrong value.\n *\n * The `OrThrow` variants throw on malformed input.\n * The plain variants return a {@linkcode DecodeDerResult}.\n *\n * @module\n */\n\nimport type { DerBitString } from '#micro509/internal/asn1/asn1';\nimport {\n\tchildrenOf,\n\tdecodeBitString,\n\tdecodeBoolean,\n\tdecodeIntegerNumber,\n\tdecodeObjectIdentifier,\n\tdecodeString,\n\tparseTime,\n} from '#micro509/internal/asn1/asn1';\nimport type {\n\tDerElement,\n\tReadRootElementOptions,\n\tReadSequenceChildrenOptions,\n} from '#micro509/internal/asn1/der';\nimport { readElement, readRootElement, readSequenceChildren } from '#micro509/internal/asn1/der';\nimport type { ErrorResult, Micro509Error } from '#micro509/result/result';\nimport { failureResult, rethrowIfInvariant, successResult } from '#micro509/result/result';\n\n/** Machine-readable failure reason for the DER readers and decoders. */\nexport type DecodeDerErrorCode = 'malformed';\n\n/** Structured failure payload for DER reading and decoding. */\nexport interface DecodeDerFailure extends Micro509Error<DecodeDerErrorCode> {\n\t/** Always `false` for failures. */\n\treadonly ok: false;\n}\n\n/** Success-or-failure result from a DER reader or decoder. */\nexport type DecodeDerResult<TValue> =\n\t| { readonly ok: true; readonly value: TValue }\n\t| ErrorResult<DecodeDerErrorCode, Record<never, never>, DecodeDerFailure>;\n\nfunction attempt<TValue>(decode: () => TValue, fallback: string): DecodeDerResult<TValue> {\n\ttry {\n\t\treturn successResult(decode());\n\t} catch (error) {\n\t\trethrowIfInvariant(error);\n\t\treturn failureResult('malformed', error instanceof Error ? error.message : fallback);\n\t}\n}\n\nfunction requireTag(element: DerElement, tag: number, label: string): DerElement {\n\tif (element.tag !== tag) {\n\t\tthrow new Error(`Expected ${label}`);\n\t}\n\treturn element;\n}\n\n/**\n * Reads one TLV element from {@linkcode bytes} starting at {@linkcode offset}.\n *\n * @param offset Byte position of the tag octet. Defaults to 0.\n * @throws if the element is truncated, indefinite-length, or non-minimally encoded.\n */\nexport function readDerElementOrThrow(bytes: Uint8Array, offset = 0): DerElement {\n\treturn readElement(bytes, offset);\n}\n\n/**\n * Reads one TLV element from {@linkcode bytes} starting at {@linkcode offset}.\n *\n * @param offset Byte position of the tag octet. Defaults to 0.\n */\nexport function readDerElement(bytes: Uint8Array, offset = 0): DecodeDerResult<DerElement> {\n\treturn attempt(() => readDerElementOrThrow(bytes, offset), 'Malformed DER element');\n}\n\n/**\n * Reads the single top-level TLV element from {@linkcode bytes}.\n *\n * @throws if {@linkcode bytes} carries trailing data, or nesting exceeds the depth guard.\n */\nexport function readDerRootOrThrow(\n\tbytes: Uint8Array,\n\toptions?: ReadRootElementOptions,\n): DerElement {\n\treturn readRootElement(bytes, options);\n}\n\n/** Reads the single top-level TLV element from {@linkcode bytes}. */\nexport function readDerRoot(\n\tbytes: Uint8Array,\n\toptions?: ReadRootElementOptions,\n): DecodeDerResult<DerElement> {\n\treturn attempt(() => readDerRootOrThrow(bytes, options), 'Malformed DER element');\n}\n\n/**\n * Reads a DER-encoded SEQUENCE from {@linkcode bytes} and returns its direct children.\n *\n * @throws if the root element is not a SEQUENCE, or if child boundaries are inconsistent.\n */\nexport function readDerSequenceOrThrow(\n\tbytes: Uint8Array,\n\toptions?: ReadSequenceChildrenOptions,\n): DerElement[] {\n\treturn readSequenceChildren(bytes, options);\n}\n\n/** Reads a DER-encoded SEQUENCE from {@linkcode bytes} and returns its direct children. */\nexport function readDerSequence(\n\tbytes: Uint8Array,\n\toptions?: ReadSequenceChildrenOptions,\n): DecodeDerResult<DerElement[]> {\n\treturn attempt(() => readDerSequenceOrThrow(bytes, options), 'Malformed DER sequence');\n}\n\n/**\n * Reads the direct children of a constructed {@linkcode parent} within {@linkcode source}.\n *\n * @throws if a child overflows {@linkcode parent}, or data is left between the last child and its end.\n */\nexport function derChildrenOrThrow(source: Uint8Array, parent: DerElement): DerElement[] {\n\treturn childrenOf(source, parent);\n}\n\n/** Reads the direct children of a constructed {@linkcode parent} within {@linkcode source}. */\nexport function derChildren(source: Uint8Array, parent: DerElement): DecodeDerResult<DerElement[]> {\n\treturn attempt(() => derChildrenOrThrow(source, parent), 'Malformed DER container');\n}\n\n/**\n * Decodes a BOOLEAN element (tag `0x01`).\n *\n * @throws if {@linkcode element} is mis-tagged, or holds anything but `0x00` or `0xff`.\n */\nexport function decodeDerBooleanOrThrow(element: DerElement): boolean {\n\treturn decodeBoolean(requireTag(element, 0x01, 'BOOLEAN').value);\n}\n\n/** Decodes a BOOLEAN element (tag `0x01`). */\nexport function decodeDerBoolean(element: DerElement): DecodeDerResult<boolean> {\n\treturn attempt(() => decodeDerBooleanOrThrow(element), 'Malformed BOOLEAN');\n}\n\n/**\n * Decodes an INTEGER element (tag `0x02`) into a `number`.\n *\n * @throws if {@linkcode element} is mis-tagged, negative, non-minimally encoded,\n * or exceeds {@linkcode Number.MAX_SAFE_INTEGER}.\n */\nexport function decodeDerIntegerOrThrow(element: DerElement): number {\n\treturn decodeIntegerNumber(requireTag(element, 0x02, 'INTEGER').value);\n}\n\n/** Decodes an INTEGER element (tag `0x02`) into a `number`. */\nexport function decodeDerInteger(element: DerElement): DecodeDerResult<number> {\n\treturn attempt(() => decodeDerIntegerOrThrow(element), 'Malformed INTEGER');\n}\n\n/**\n * Decodes an OCTET STRING element (tag `0x04`) into its payload bytes.\n *\n * @throws if {@linkcode element} is mis-tagged.\n */\nexport function decodeDerOctetStringOrThrow(element: DerElement): Uint8Array {\n\treturn requireTag(element, 0x04, 'OCTET STRING').value;\n}\n\n/** Decodes an OCTET STRING element (tag `0x04`) into its payload bytes. */\nexport function decodeDerOctetString(element: DerElement): DecodeDerResult<Uint8Array> {\n\treturn attempt(() => decodeDerOctetStringOrThrow(element), 'Malformed OCTET STRING');\n}\n\n/**\n * Decodes an OBJECT IDENTIFIER element (tag `0x06`) into dotted-decimal form.\n *\n * @throws if {@linkcode element} is mis-tagged, or holds a malformed sub-identifier.\n */\nexport function decodeDerOidOrThrow(element: DerElement): string {\n\treturn decodeObjectIdentifier(requireTag(element, 0x06, 'OBJECT IDENTIFIER').value);\n}\n\n/** Decodes an OBJECT IDENTIFIER element (tag `0x06`) into dotted-decimal form. */\nexport function decodeDerOid(element: DerElement): DecodeDerResult<string> {\n\treturn attempt(() => decodeDerOidOrThrow(element), 'Malformed OBJECT IDENTIFIER');\n}\n\n/**\n * Decodes a BIT STRING element (tag `0x03`) into a {@linkcode DerBitString}.\n *\n * Unused trailing bits are returned as encoded, with a violation of {@linkcode https://www.itu.int/rec/T-REC-X.690-202102-I/en | X.690 §11.2.1} reported\n * through {@linkcode DerBitString.nonZeroPadding}, since certificates in the wild carry them.\n *\n * @throws if {@linkcode element} is mis-tagged, or claims more than seven unused bits.\n */\nexport function decodeDerBitStringOrThrow(element: DerElement): DerBitString {\n\treturn decodeBitString(element);\n}\n\n/**\n * Decodes a BIT STRING element (tag `0x03`) into a {@linkcode DerBitString}.\n *\n * Unused trailing bits are returned as encoded, with a violation of {@linkcode https://www.itu.int/rec/T-REC-X.690-202102-I/en | X.690 §11.2.1} reported\n * through {@linkcode DerBitString.nonZeroPadding}, since certificates in the wild carry them.\n */\nexport function decodeDerBitString(element: DerElement): DecodeDerResult<DerBitString> {\n\treturn attempt(() => decodeDerBitStringOrThrow(element), 'Malformed BIT STRING');\n}\n\n/**\n * Decodes a string element into text, dispatching on its tag.\n *\n * Supports UTF8String, PrintableString, IA5String, UniversalString, and BMPString.\n *\n * @throws on TeletexString, and on every other string tag.\n */\nexport function decodeDerStringOrThrow(element: DerElement): string {\n\treturn decodeString(element.tag, element.value);\n}\n\n/**\n * Decodes a string element into text, dispatching on its tag.\n *\n * Supports UTF8String, PrintableString, IA5String, UniversalString, and BMPString.\n */\nexport function decodeDerString(element: DerElement): DecodeDerResult<string> {\n\treturn attempt(() => decodeDerStringOrThrow(element), 'Malformed string');\n}\n\n/**\n * Decodes a UTCTime (tag `0x17`) or GeneralizedTime (tag `0x18`) element into a {@linkcode Date}.\n *\n * @throws if {@linkcode element} carries any other tag, or a malformed time value.\n */\nexport function decodeDerTimeOrThrow(element: DerElement): Date {\n\treturn parseTime(element);\n}\n\n/** Decodes a UTCTime (tag `0x17`) or GeneralizedTime (tag `0x18`) element into a {@linkcode Date}. */\nexport function decodeDerTime(element: DerElement): DecodeDerResult<Date> {\n\treturn attempt(() => decodeDerTimeOrThrow(element), 'Malformed time');\n}\n"],"mappings":";;;;AA6CA,SAAS,QAAgB,GAAsB,GAA2C;CACzF,IAAI;EACH,OAAO,EAAc,EAAO,CAAC;CAC9B,SAAS,GAAO;EAEf,OADA,EAAmB,CAAK,GACjB,EAAc,aAAa,aAAiB,QAAQ,EAAM,UAAU,CAAQ;CACpF;AACD;AAEA,SAAS,WAAW,GAAqB,GAAa,GAA2B;CAChF,IAAI,EAAQ,QAAQ,GACnB,MAAU,MAAM,YAAY,GAAO;CAEpC,OAAO;AACR;;;;;;;AAQA,SAAgB,sBAAsB,GAAmB,IAAS,GAAe;CAChF,OAAO,EAAY,GAAO,CAAM;AACjC;;;;;;AAOA,SAAgB,eAAe,GAAmB,IAAS,GAAgC;CAC1F,OAAO,cAAc,sBAAsB,GAAO,CAAM,GAAG,uBAAuB;AACnF;;;;;;AAOA,SAAgB,mBACf,GACA,GACa;CACb,OAAO,EAAgB,GAAO,CAAO;AACtC;;AAGA,SAAgB,YACf,GACA,GAC8B;CAC9B,OAAO,cAAc,mBAAmB,GAAO,CAAO,GAAG,uBAAuB;AACjF;;;;;;AAOA,SAAgB,uBACf,GACA,GACe;CACf,OAAO,EAAqB,GAAO,CAAO;AAC3C;;AAGA,SAAgB,gBACf,GACA,GACgC;CAChC,OAAO,cAAc,uBAAuB,GAAO,CAAO,GAAG,wBAAwB;AACtF;;;;;;AAOA,SAAgB,mBAAmB,GAAoB,GAAkC;CACxF,OAAO,EAAW,GAAQ,CAAM;AACjC;;AAGA,SAAgB,YAAY,GAAoB,GAAmD;CAClG,OAAO,cAAc,mBAAmB,GAAQ,CAAM,GAAG,yBAAyB;AACnF;;;;;;AAOA,SAAgB,wBAAwB,GAA8B;CACrE,OAAO,EAAc,WAAW,GAAS,GAAM,SAAS,CAAC,CAAC,KAAK;AAChE;;AAGA,SAAgB,iBAAiB,GAA+C;CAC/E,OAAO,cAAc,wBAAwB,CAAO,GAAG,mBAAmB;AAC3E;;;;;;;AAQA,SAAgB,wBAAwB,GAA6B;CACpE,OAAO,EAAoB,WAAW,GAAS,GAAM,SAAS,CAAC,CAAC,KAAK;AACtE;;AAGA,SAAgB,iBAAiB,GAA8C;CAC9E,OAAO,cAAc,wBAAwB,CAAO,GAAG,mBAAmB;AAC3E;;;;;;AAOA,SAAgB,4BAA4B,GAAiC;CAC5E,OAAO,WAAW,GAAS,GAAM,cAAc,CAAC,CAAC;AAClD;;AAGA,SAAgB,qBAAqB,GAAkD;CACtF,OAAO,cAAc,4BAA4B,CAAO,GAAG,wBAAwB;AACpF;;;;;;AAOA,SAAgB,oBAAoB,GAA6B;CAChE,OAAO,EAAuB,WAAW,GAAS,GAAM,mBAAmB,CAAC,CAAC,KAAK;AACnF;;AAGA,SAAgB,aAAa,GAA8C;CAC1E,OAAO,cAAc,oBAAoB,CAAO,GAAG,6BAA6B;AACjF;;;;;;;;;AAUA,SAAgB,0BAA0B,GAAmC;CAC5E,OAAO,EAAgB,CAAO;AAC/B;;;;;;;AAQA,SAAgB,mBAAmB,GAAoD;CACtF,OAAO,cAAc,0BAA0B,CAAO,GAAG,sBAAsB;AAChF;;;;;;;;AASA,SAAgB,uBAAuB,GAA6B;CACnE,OAAO,EAAa,EAAQ,KAAK,EAAQ,KAAK;AAC/C;;;;;;AAOA,SAAgB,gBAAgB,GAA8C;CAC7E,OAAO,cAAc,uBAAuB,CAAO,GAAG,kBAAkB;AACzE;;;;;;AAOA,SAAgB,qBAAqB,GAA2B;CAC/D,OAAO,EAAU,CAAO;AACzB;;AAGA,SAAgB,cAAc,GAA4C;CACzE,OAAO,cAAc,qBAAqB,CAAO,GAAG,gBAAgB;AACrE"}
1
+ {"version":3,"file":"der.js","names":["successResult","decode","error","rethrowIfInvariant","decodeFailureResult","DECODE_REFUSAL_CODES","fallback","element","tag","label","readElement","bytes","offset","readRootElement","options","readSequenceChildren","childrenOf","source","parent","decodeBoolean","decodeIntegerNumber","decodeObjectIdentifier","decodeBitString","decodeString","parseTime"],"sources":["../../src/der/der.ts"],"sourcesContent":["/**\n * Element-oriented DER readers and decoders.\n *\n * Each decoder validates the element's tag before reading its value, so a\n * mis-tagged element fails instead of yielding a wrong value.\n *\n * The `OrThrow` variants throw on malformed input.\n * The plain variants return a {@linkcode DecodeDerResult}.\n *\n * @module\n */\n\nimport type { DerBitString } from '#micro509/internal/asn1/asn1';\nimport {\n\tchildrenOf,\n\tdecodeBitString,\n\tdecodeBoolean,\n\tdecodeIntegerNumber,\n\tdecodeObjectIdentifier,\n\tdecodeString,\n\tparseTime,\n} from '#micro509/internal/asn1/asn1';\nimport { DECODE_REFUSAL_CODES, decodeFailureResult } from '#micro509/internal/asn1/decode-refusal';\nimport type {\n\tDerElement,\n\tReadRootElementOptions,\n\tReadSequenceChildrenOptions,\n} from '#micro509/internal/asn1/der';\nimport { readElement, readRootElement, readSequenceChildren } from '#micro509/internal/asn1/der';\nimport type { DecodeFailureCode, ErrorResult, Micro509Error } from '#micro509/result/result';\nimport { rethrowIfInvariant, successResult } from '#micro509/result/result';\n\n/**\n * Machine-readable failure reason for the DER readers and decoders.\n *\n * `malformed` is input that breaks DER or the decoder's ASN.1 type.\n * `unsupported` is input the type may allow but micro509 does not decode: a\n * TeletexString octet outside the X.690 §8.23.5.2 initial state.\n * `limit_exceeded` is an implementation limit: an OBJECT IDENTIFIER\n * sub-identifier encoded in more than 64 octets, a tag number of 2^53 or more,\n * or DER nested deeper than 64 levels.\n */\nexport type DecodeDerErrorCode = DecodeFailureCode;\n\n/** Structured failure payload for DER reading and decoding. */\nexport interface DecodeDerFailure extends Micro509Error<DecodeDerErrorCode> {\n\t/** Always `false` for failures. */\n\treadonly ok: false;\n}\n\n/** Success-or-failure result from a DER reader or decoder. */\nexport type DecodeDerResult<TValue> =\n\t| { readonly ok: true; readonly value: TValue }\n\t| ErrorResult<DecodeDerErrorCode, Record<never, never>, DecodeDerFailure>;\n\nfunction attempt<TValue>(decode: () => TValue, fallback: string): DecodeDerResult<TValue> {\n\ttry {\n\t\treturn successResult(decode());\n\t} catch (error) {\n\t\trethrowIfInvariant(error);\n\t\treturn decodeFailureResult(error, DECODE_REFUSAL_CODES, fallback);\n\t}\n}\n\nfunction requireTag(element: DerElement, tag: number, label: string): DerElement {\n\tif (element.tag !== tag) {\n\t\tthrow new Error(`Expected ${label}`);\n\t}\n\treturn element;\n}\n\n/**\n * Reads one TLV element from {@linkcode bytes} starting at {@linkcode offset}.\n *\n * @param offset Byte position of the tag octet. Defaults to 0.\n * @throws if the element is truncated, indefinite-length, or non-minimally encoded.\n */\nexport function readDerElementOrThrow(bytes: Uint8Array, offset = 0): DerElement {\n\treturn readElement(bytes, offset);\n}\n\n/**\n * Reads one TLV element from {@linkcode bytes} starting at {@linkcode offset}.\n *\n * @param offset Byte position of the tag octet. Defaults to 0.\n */\nexport function readDerElement(bytes: Uint8Array, offset = 0): DecodeDerResult<DerElement> {\n\treturn attempt(() => readDerElementOrThrow(bytes, offset), 'Malformed DER element');\n}\n\n/**\n * Reads the single top-level TLV element from {@linkcode bytes}.\n *\n * @throws if {@linkcode bytes} carries trailing data, or nesting exceeds the depth guard.\n */\nexport function readDerRootOrThrow(\n\tbytes: Uint8Array,\n\toptions?: ReadRootElementOptions,\n): DerElement {\n\treturn readRootElement(bytes, options);\n}\n\n/** Reads the single top-level TLV element from {@linkcode bytes}. */\nexport function readDerRoot(\n\tbytes: Uint8Array,\n\toptions?: ReadRootElementOptions,\n): DecodeDerResult<DerElement> {\n\treturn attempt(() => readDerRootOrThrow(bytes, options), 'Malformed DER element');\n}\n\n/**\n * Reads a DER-encoded SEQUENCE from {@linkcode bytes} and returns its direct children.\n *\n * @throws if the root element is not a SEQUENCE, or if child boundaries are inconsistent.\n */\nexport function readDerSequenceOrThrow(\n\tbytes: Uint8Array,\n\toptions?: ReadSequenceChildrenOptions,\n): DerElement[] {\n\treturn readSequenceChildren(bytes, options);\n}\n\n/** Reads a DER-encoded SEQUENCE from {@linkcode bytes} and returns its direct children. */\nexport function readDerSequence(\n\tbytes: Uint8Array,\n\toptions?: ReadSequenceChildrenOptions,\n): DecodeDerResult<DerElement[]> {\n\treturn attempt(() => readDerSequenceOrThrow(bytes, options), 'Malformed DER sequence');\n}\n\n/**\n * Reads the direct children of a constructed {@linkcode parent} within {@linkcode source}.\n *\n * @throws if a child overflows {@linkcode parent}, or data is left between the last child and its end.\n */\nexport function derChildrenOrThrow(source: Uint8Array, parent: DerElement): DerElement[] {\n\treturn childrenOf(source, parent);\n}\n\n/** Reads the direct children of a constructed {@linkcode parent} within {@linkcode source}. */\nexport function derChildren(source: Uint8Array, parent: DerElement): DecodeDerResult<DerElement[]> {\n\treturn attempt(() => derChildrenOrThrow(source, parent), 'Malformed DER container');\n}\n\n/**\n * Decodes a BOOLEAN element (tag `0x01`).\n *\n * @throws if {@linkcode element} is mis-tagged, or holds anything but `0x00` or `0xff`.\n */\nexport function decodeDerBooleanOrThrow(element: DerElement): boolean {\n\treturn decodeBoolean(requireTag(element, 0x01, 'BOOLEAN').value);\n}\n\n/** Decodes a BOOLEAN element (tag `0x01`). */\nexport function decodeDerBoolean(element: DerElement): DecodeDerResult<boolean> {\n\treturn attempt(() => decodeDerBooleanOrThrow(element), 'Malformed BOOLEAN');\n}\n\n/**\n * Decodes an INTEGER element (tag `0x02`) into a `number`.\n *\n * @throws if {@linkcode element} is mis-tagged, negative, non-minimally encoded,\n * or exceeds {@linkcode Number.MAX_SAFE_INTEGER}.\n */\nexport function decodeDerIntegerOrThrow(element: DerElement): number {\n\treturn decodeIntegerNumber(requireTag(element, 0x02, 'INTEGER').value);\n}\n\n/** Decodes an INTEGER element (tag `0x02`) into a `number`. */\nexport function decodeDerInteger(element: DerElement): DecodeDerResult<number> {\n\treturn attempt(() => decodeDerIntegerOrThrow(element), 'Malformed INTEGER');\n}\n\n/**\n * Decodes an OCTET STRING element (tag `0x04`) into its payload bytes.\n *\n * @throws if {@linkcode element} is mis-tagged.\n */\nexport function decodeDerOctetStringOrThrow(element: DerElement): Uint8Array {\n\treturn requireTag(element, 0x04, 'OCTET STRING').value;\n}\n\n/** Decodes an OCTET STRING element (tag `0x04`) into its payload bytes. */\nexport function decodeDerOctetString(element: DerElement): DecodeDerResult<Uint8Array> {\n\treturn attempt(() => decodeDerOctetStringOrThrow(element), 'Malformed OCTET STRING');\n}\n\n/**\n * Decodes an OBJECT IDENTIFIER element (tag `0x06`) into dotted-decimal form.\n *\n * @throws if {@linkcode element} is mis-tagged, or holds a malformed sub-identifier.\n */\nexport function decodeDerOidOrThrow(element: DerElement): string {\n\treturn decodeObjectIdentifier(requireTag(element, 0x06, 'OBJECT IDENTIFIER').value);\n}\n\n/** Decodes an OBJECT IDENTIFIER element (tag `0x06`) into dotted-decimal form. */\nexport function decodeDerOid(element: DerElement): DecodeDerResult<string> {\n\treturn attempt(() => decodeDerOidOrThrow(element), 'Malformed OBJECT IDENTIFIER');\n}\n\n/**\n * Decodes a BIT STRING element (tag `0x03`) into a {@linkcode DerBitString}.\n *\n * Unused trailing bits are returned as encoded, with a violation of {@linkcode https://www.itu.int/rec/T-REC-X.690-202102-I/en | X.690 §11.2.1} reported\n * through {@linkcode DerBitString.nonZeroPadding}, since certificates in the wild carry them.\n *\n * @throws if {@linkcode element} is mis-tagged, or claims more than seven unused bits.\n */\nexport function decodeDerBitStringOrThrow(element: DerElement): DerBitString {\n\treturn decodeBitString(element);\n}\n\n/**\n * Decodes a BIT STRING element (tag `0x03`) into a {@linkcode DerBitString}.\n *\n * Unused trailing bits are returned as encoded, with a violation of {@linkcode https://www.itu.int/rec/T-REC-X.690-202102-I/en | X.690 §11.2.1} reported\n * through {@linkcode DerBitString.nonZeroPadding}, since certificates in the wild carry them.\n */\nexport function decodeDerBitString(element: DerElement): DecodeDerResult<DerBitString> {\n\treturn attempt(() => decodeDerBitStringOrThrow(element), 'Malformed BIT STRING');\n}\n\n/**\n * Decodes a string element into text, dispatching on its tag.\n *\n * Supports UTF8String, PrintableString, TeletexString, IA5String, UniversalString, and BMPString.\n * A TeletexString decodes only in its X.690 §8.23.5.2 initial state.\n *\n * @throws on every other string tag, and on a TeletexString octet outside that state.\n */\nexport function decodeDerStringOrThrow(element: DerElement): string {\n\treturn decodeString(element.tag, element.value);\n}\n\n/**\n * Decodes a string element into text, dispatching on its tag.\n *\n * Supports UTF8String, PrintableString, TeletexString, IA5String, UniversalString, and BMPString.\n * A TeletexString decodes only in its X.690 §8.23.5.2 initial state.\n */\nexport function decodeDerString(element: DerElement): DecodeDerResult<string> {\n\treturn attempt(() => decodeDerStringOrThrow(element), 'Malformed string');\n}\n\n/**\n * Decodes a UTCTime (tag `0x17`) or GeneralizedTime (tag `0x18`) element into a {@linkcode Date}.\n *\n * @throws if {@linkcode element} carries any other tag, or a malformed time value.\n */\nexport function decodeDerTimeOrThrow(element: DerElement): Date {\n\treturn parseTime(element);\n}\n\n/** Decodes a UTCTime (tag `0x17`) or GeneralizedTime (tag `0x18`) element into a {@linkcode Date}. */\nexport function decodeDerTime(element: DerElement): DecodeDerResult<Date> {\n\treturn attempt(() => decodeDerTimeOrThrow(element), 'Malformed time');\n}\n"],"mappings":";;;;;AAuDA,SAAS,QAAgB,GAAsB,GAA2C;CACzF,IAAI;EACH,OAAOA,EAAcC,EAAO,CAAC;CAC9B,SAASC,GAAO;EAEf,OADAC,EAAmBD,CAAK,GACjBE,EAAoBF,GAAOG,GAAsBC,CAAQ;CACjE;AACD;AAEA,SAAS,WAAW,GAAqB,GAAa,GAA2B;CAChF,IAAIC,EAAQ,QAAQC,GACnB,MAAU,MAAM,YAAYC,GAAO;CAEpC,OAAOF;AACR;;;;;;;AAQA,SAAgB,sBAAsB,GAAmB,IAAS,GAAe;CAChF,OAAOG,EAAYC,GAAOC,CAAM;AACjC;;;;;;AAOA,SAAgB,eAAe,GAAmB,IAAS,GAAgC;CAC1F,OAAO,cAAc,sBAAsBD,GAAOC,CAAM,GAAG,uBAAuB;AACnF;;;;;;AAOA,SAAgB,mBACf,GACA,GACa;CACb,OAAOC,EAAgBF,GAAOG,CAAO;AACtC;;AAGA,SAAgB,YACf,GACA,GAC8B;CAC9B,OAAO,cAAc,mBAAmBH,GAAOG,CAAO,GAAG,uBAAuB;AACjF;;;;;;AAOA,SAAgB,uBACf,GACA,GACe;CACf,OAAOC,EAAqBJ,GAAOG,CAAO;AAC3C;;AAGA,SAAgB,gBACf,GACA,GACgC;CAChC,OAAO,cAAc,uBAAuBH,GAAOG,CAAO,GAAG,wBAAwB;AACtF;;;;;;AAOA,SAAgB,mBAAmB,GAAoB,GAAkC;CACxF,OAAOE,EAAWC,GAAQC,CAAM;AACjC;;AAGA,SAAgB,YAAY,GAAoB,GAAmD;CAClG,OAAO,cAAc,mBAAmBD,GAAQC,CAAM,GAAG,yBAAyB;AACnF;;;;;;AAOA,SAAgB,wBAAwB,GAA8B;CACrE,OAAOC,EAAc,WAAWZ,GAAS,GAAM,SAAS,CAAC,CAAC,KAAK;AAChE;;AAGA,SAAgB,iBAAiB,GAA+C;CAC/E,OAAO,cAAc,wBAAwBA,CAAO,GAAG,mBAAmB;AAC3E;;;;;;;AAQA,SAAgB,wBAAwB,GAA6B;CACpE,OAAOa,EAAoB,WAAWb,GAAS,GAAM,SAAS,CAAC,CAAC,KAAK;AACtE;;AAGA,SAAgB,iBAAiB,GAA8C;CAC9E,OAAO,cAAc,wBAAwBA,CAAO,GAAG,mBAAmB;AAC3E;;;;;;AAOA,SAAgB,4BAA4B,GAAiC;CAC5E,OAAO,WAAWA,GAAS,GAAM,cAAc,CAAC,CAAC;AAClD;;AAGA,SAAgB,qBAAqB,GAAkD;CACtF,OAAO,cAAc,4BAA4BA,CAAO,GAAG,wBAAwB;AACpF;;;;;;AAOA,SAAgB,oBAAoB,GAA6B;CAChE,OAAOc,EAAuB,WAAWd,GAAS,GAAM,mBAAmB,CAAC,CAAC,KAAK;AACnF;;AAGA,SAAgB,aAAa,GAA8C;CAC1E,OAAO,cAAc,oBAAoBA,CAAO,GAAG,6BAA6B;AACjF;;;;;;;;;AAUA,SAAgB,0BAA0B,GAAmC;CAC5E,OAAOe,EAAgBf,CAAO;AAC/B;;;;;;;AAQA,SAAgB,mBAAmB,GAAoD;CACtF,OAAO,cAAc,0BAA0BA,CAAO,GAAG,sBAAsB;AAChF;;;;;;;;;AAUA,SAAgB,uBAAuB,GAA6B;CACnE,OAAOgB,EAAahB,EAAQ,KAAKA,EAAQ,KAAK;AAC/C;;;;;;;AAQA,SAAgB,gBAAgB,GAA8C;CAC7E,OAAO,cAAc,uBAAuBA,CAAO,GAAG,kBAAkB;AACzE;;;;;;AAOA,SAAgB,qBAAqB,GAA2B;CAC/D,OAAOiB,EAAUjB,CAAO;AACzB;;AAGA,SAAgB,cAAc,GAA4C;CACzE,OAAO,cAAc,qBAAqBA,CAAO,GAAG,gBAAgB;AACrE"}
package/dist/index.d.ts CHANGED
@@ -1,26 +1,26 @@
1
- import { Pbes2Parameters } from "./internal/crypto/pbes2.js";
2
- import { ErrorResult, IndexedErrorResult, IndexedMicro509Error, Micro509Error, Result, ResultError, isResultError, unwrap, unwrapOr } from "./result/result.js";
3
- import { DecryptRsaOaepErrorCode, DecryptRsaOaepFailure, DecryptRsaOaepResult, EcKeyAlgorithmInput, EcNamedCurve, Ed25519KeyAlgorithmInput, EncryptRsaOaepErrorCode, EncryptRsaOaepFailure, EncryptRsaOaepResult, EncryptedPkcs8Options, ImportEcKeyInput, ImportEd25519KeyInput, ImportEncryptedKeyErrorCode, ImportEncryptedKeyFailure, ImportEncryptedKeyResult, ImportKeyErrorCode, ImportKeyFailure, ImportKeyResult, ImportRsaKeyInput, KeyAlgorithmInput, KeyPairMaterial, LegacyPemEncryptionOptions, PrivateKeyImportInput, PublicKeyImportInput, RsaHash, RsaKeyAlgorithmInput, RsaOaepOptions, RsaScheme, RsaSignatureScheme, decryptRsaOaep, decryptRsaOaepOrThrow, derivePublicKey, encryptRsaOaep, encryptRsaOaepOrThrow, exportBinaryBase64, exportEncryptedPkcs1Pem, exportEncryptedPkcs8Der, exportEncryptedPkcs8Pem, exportEncryptedSec1Pem, exportPkcs1Der, exportPkcs1Pem, exportPkcs8Der, exportPkcs8Pem, exportPrivateJwk, exportPublicJwk, exportSec1Der, exportSec1Pem, exportSpkiDer, exportSpkiPem, generateKeyPair, importEncryptedPkcs1Pem, importEncryptedPkcs1PemOrThrow, importEncryptedPkcs8Der, importEncryptedPkcs8DerOrThrow, importEncryptedPkcs8Pem, importEncryptedPkcs8PemOrThrow, importEncryptedSec1Pem, importEncryptedSec1PemOrThrow, importPkcs1Der, importPkcs1DerOrThrow, importPkcs1Pem, importPkcs1PemOrThrow, importPkcs8Base64, importPkcs8Base64OrThrow, importPkcs8Der, importPkcs8DerOrThrow, importPkcs8Pem, importPkcs8PemOrThrow, importPrivateJwk, importPrivateJwkOrThrow, importPublicJwk, importPublicJwkOrThrow, importSec1Der, importSec1DerOrThrow, importSec1Pem, importSec1PemOrThrow, importSpkiBase64, importSpkiBase64OrThrow, importSpkiDer, importSpkiDerOrThrow, importSpkiPem, importSpkiPemOrThrow, inspectEncryptedPkcs8Der } from "./keys/keys.js";
1
+ import { KdfLimitOptions, Pbes2Parameters } from "./internal/crypto/pbes2.js";
2
+ import { DECODE_REFUSAL_CODES, DecodeFailureCode, DecodeRefusalCode, ErrorResult, IndexedErrorResult, IndexedMicro509Error, Micro509Error, Result, ResultError, isResultError, unwrap, unwrapOr } from "./result/result.js";
3
+ import { DecryptRsaOaepErrorCode, DecryptRsaOaepFailure, DecryptRsaOaepResult, EcKeyAlgorithmInput, EcNamedCurve, Ed25519KeyAlgorithmInput, EncryptRsaOaepErrorCode, EncryptRsaOaepFailure, EncryptRsaOaepResult, EncryptedPkcs8Options, ImportEcKeyInput, ImportEd25519KeyInput, ImportEncryptedKeyErrorCode, ImportEncryptedKeyFailure, ImportEncryptedKeyOptions, ImportEncryptedKeyResult, ImportKeyErrorCode, ImportKeyFailure, ImportKeyResult, ImportRsaKeyInput, KeyAlgorithmInput, KeyPairMaterial, LegacyPemEncryptionOptions, PrivateKeyImportInput, PublicKeyImportInput, RsaHash, RsaKeyAlgorithmInput, RsaOaepOptions, RsaScheme, RsaSignatureScheme, decryptRsaOaep, decryptRsaOaepOrThrow, derivePublicKey, encryptRsaOaep, encryptRsaOaepOrThrow, exportBinaryBase64, exportEncryptedPkcs1Pem, exportEncryptedPkcs8Der, exportEncryptedPkcs8Pem, exportEncryptedSec1Pem, exportPkcs1Der, exportPkcs1Pem, exportPkcs8Der, exportPkcs8Pem, exportPrivateJwk, exportPublicJwk, exportSec1Der, exportSec1Pem, exportSpkiDer, exportSpkiPem, generateKeyPair, importEncryptedPkcs1Pem, importEncryptedPkcs1PemOrThrow, importEncryptedPkcs8Der, importEncryptedPkcs8DerOrThrow, importEncryptedPkcs8Pem, importEncryptedPkcs8PemOrThrow, importEncryptedSec1Pem, importEncryptedSec1PemOrThrow, importPkcs1Der, importPkcs1DerOrThrow, importPkcs1Pem, importPkcs1PemOrThrow, importPkcs8Base64, importPkcs8Base64OrThrow, importPkcs8Der, importPkcs8DerOrThrow, importPkcs8Pem, importPkcs8PemOrThrow, importPrivateJwk, importPrivateJwkOrThrow, importPublicJwk, importPublicJwkOrThrow, importSec1Der, importSec1DerOrThrow, importSec1Pem, importSec1PemOrThrow, importSpkiBase64, importSpkiBase64OrThrow, importSpkiDer, importSpkiDerOrThrow, importSpkiPem, importSpkiPemOrThrow, inspectEncryptedPkcs8Der } from "./keys/keys.js";
4
4
  import { CategorizePemBlocksResult, CategorizedPemBlocks, PemBlock, PemDecodeResult, PemErrorCode, PemFailure, SplitPemBlocksResult, categorizePemBlocks, categorizePemBlocksOrThrow, pemDecode, pemDecodeOrThrow, pemEncode, splitPemBlocks, splitPemBlocksOrThrow } from "./pem/pem.js";
5
- import { ParsePkcs12MacDataErrorCode, ParsePkcs12MacDataFailure, ParsePkcs12MacDataResult, ParsedPkcs12MacData, Pkcs12MacOptions } from "./pkcs/pkcs12-mac.js";
5
+ import { CreatePkcs12MacDataErrorCode, ParsePkcs12MacDataErrorCode, ParsePkcs12MacDataFailure, ParsePkcs12MacDataOptions, ParsePkcs12MacDataResult, ParsedPkcs12MacData, Pkcs12MacOptions } from "./pkcs/pkcs12-mac.js";
6
6
  import { compareDistinguishedNames } from "./internal/shared/dn.js";
7
7
  import { NameAttribute, NameEncoderErrorCode, NameFieldKey, NameInput, NameObject, RelativeDistinguishedNameInput } from "./x509/name.js";
8
8
  import { ExtensionEncoderErrorCode } from "./internal/x509/extension-errors.js";
9
- import { AuthorityInformationAccess, AuthorityInformationAccessInput, BasicConstraints, CertificateExtensionsInput, CertificatePolicies, DistributionPoint, DistributionPointName, ExtendedKeyUsage, GeneralName, GeneralSubtree, InhibitAnyPolicy, IssuingDistributionPoint, IssuingDistributionPointBase, IssuingDistributionPointForAttributeCerts, IssuingDistributionPointForCaCerts, IssuingDistributionPointForUserCerts, KeyUsage, NameConstraintForm, NameConstraints, ParsedBitFlags, ParsedNameConstraintForm, PolicyConstraints, PolicyInformation, PolicyMapping, PolicyMappings, PolicyQualifierInfo, SubjectAltName } from "./x509/extensions.js";
9
+ import { AuthorityInformationAccess, AuthorityInformationAccessInput, BasicConstraints, CertificateExtensionsInput, CertificatePolicies, DisplayTextType, DistributionPoint, DistributionPointName, ExtendedKeyUsage, GeneralName, GeneralSubtree, InhibitAnyPolicy, IssuingDistributionPoint, IssuingDistributionPointBase, IssuingDistributionPointForAttributeCerts, IssuingDistributionPointForCaCerts, IssuingDistributionPointForUserCerts, KeyUsage, NameConstraintForm, NameConstraints, OversizedDisplayText, ParsedBitFlags, ParsedNameConstraintForm, PolicyConstraints, PolicyInformation, PolicyMapping, PolicyMappings, PolicyQualifierInfo, SubjectAltName } from "./x509/extensions.js";
10
10
  import { DecodedExtensionMap, DecodedExtensionValue, ExtensionDecoder, ExtensionDecoderMap, MatchCertificatePrivateKeyErrorCode, MatchCertificatePrivateKeyFailure, MatchCertificatePrivateKeyFailureResult, MatchCertificatePrivateKeyResult, MatchCertificatePrivateKeySuccess, ParseCertificateChainResult, ParseCertificateErrorCode, ParseCertificateFailure, ParseCertificateResult, ParseCertificateSigningRequestErrorCode, ParseCertificateSigningRequestFailure, ParseCertificateSigningRequestResult, ParseOptions, ParsedCertificate, ParsedCertificateSigningRequest, ParsedDistributionPoint, ParsedDistributionPointName, ParsedExtension, ParsedIssuingDistributionPoint, ParsedIssuingDistributionPointBase, ParsedIssuingDistributionPointScope, ParsedName, ParsedNameAttribute, ParsedRelativeDistinguishedName, certificateMatchesPrivateKey, decodeExtension, decodeExtensionMap, decodeExtensions, defineExtensionDecoder, defineExtensionDecoderMap, findExtension, getSubjectPublicKey, getSubjectPublicKeyOrThrow, matchCertificatePrivateKey, parseCertificateChainPem, parseCertificateChainPemOrThrow, parseCertificateDer, parseCertificateDerOrThrow, parseCertificateFromSource, parseCertificatePem, parseCertificatePemOrThrow, parseCertificateSigningRequestDer, parseCertificateSigningRequestDerOrThrow, parseCertificateSigningRequestPem, parseCertificateSigningRequestPemOrThrow, parseCertificatesFromSource, parseDistinguishedNameDer } from "./x509/parse.js";
11
- import { CreatePfxErrorCode, CreatePfxFailure, CreatePfxInput, CreatePfxResult, ParsePfxErrorCode, ParsePfxFailure, ParsePfxOptions, ParsePfxResult, ParsedPfx, ParsedPfxAttribute, ParsedPfxBag, ParsedPfxBagAttributes, PfxBagAttributesInput, PfxCertificateBagInput, PfxCertificateSource, PfxEncryptionOptions, PfxMaterial, PfxPrivateKeyBagInput, PfxPrivateKeySource, createPfx, parsePfxDer, parsePfxPem } from "./pkcs/pfx.js";
11
+ import { CreatePfxErrorCode, CreatePfxFailure, CreatePfxInput, CreatePfxResult, ParsePfxErrorCode, ParsePfxFailure, ParsePfxOptions, ParsePfxResult, ParsedPfx, ParsedPfxAttribute, ParsedPfxBag, ParsedPfxBagAttributes, PfxBagAttributesInput, PfxCertificateBagInput, PfxCertificateSource, PfxEncoderErrorCode, PfxEncryptionOptions, PfxMaterial, PfxPrivateKeyBagInput, PfxPrivateKeySource, createPfx, parsePfxDer, parsePfxPem } from "./pkcs/pfx.js";
12
12
  import { CertificateMaterial, CreateCertificateErrorCode, CreateCertificateInput, CreateSelfSignedCertificateBase, CreateSelfSignedCertificateInput, SelfSignedCertificateResult, SelfSignedKeySource, ValidityInput, createCertificate, createSelfSignedCertificate } from "./x509/certificate.js";
13
13
  import { CreatePkcs7CertBagErrorCode, CreatePkcs7CertBagFailure, CreatePkcs7CertBagResult, CreatePkcs7SignedDataErrorCode, CreatePkcs7SignedDataFailure, CreatePkcs7SignedDataInput, CreatePkcs7SignedDataResult, ParsePkcs7CertBagResult, ParsePkcs7ErrorCode, ParsePkcs7Failure, ParsePkcs7SignedDataResult, ParsedCertificateChoice, ParsedPkcs7SignedData, ParsedPkcs7SignerInfo, ParsedPkcs7SignerInfoBase, ParsedSignerIdentifier, Pkcs7CertBagMaterial, Pkcs7CertificateSource, Pkcs7SignedDataMaterial, Pkcs7Signer, VerifiedPkcs7Signer, VerifyPkcs7SignedDataErrorCode, VerifyPkcs7SignedDataFailure, VerifyPkcs7SignedDataOptions, VerifyPkcs7SignedDataResult, createPkcs7CertBag, createPkcs7SignedData, parsePkcs7CertBagDer, parsePkcs7CertBagPem, parsePkcs7SignedDataDer, parsePkcs7SignedDataPem, verifyPkcs7SignedData } from "./pkcs/pkcs7.js";
14
- import { CertificateRevocationListMaterial, CheckCertificateRevocationAgainstCrlErrorCode, CheckCertificateRevocationAgainstCrlFailure, CheckCertificateRevocationAgainstCrlFailureDetails, CheckCertificateRevocationAgainstCrlGoodValue, CheckCertificateRevocationAgainstCrlInput, CheckCertificateRevocationAgainstCrlResult, CheckCertificateRevocationAgainstCrlRevokedValue, CheckCertificateRevocationAgainstCrlValue, CreateCertificateRevocationListInput, CrlApplicabilityFailureReason, CrlCertificateSource, CrlEncoderErrorCode, CrlSource, ParseCertificateRevocationListErrorCode, ParseCertificateRevocationListFailure, ParseCertificateRevocationListResult, ParsedCertificateRevocationList, ParsedRevokedCertificate, RevocationReason, RevokedCertificateInput, ValidateCertificateRevocationListFailure, ValidateCertificateRevocationListInput, ValidateCertificateRevocationListResult, VerifyCertificateRevocationListSignatureFailure, VerifyCertificateRevocationListSignatureResult, checkCertificateRevocationAgainstCrl, createCertificateRevocationList, isCertificateRevoked, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, revocationReasonFromCode, validateCertificateRevocationList, verifyCertificateRevocationListSignature } from "./revocation/crl.js";
14
+ import { CertificateRevocationListMaterial, CheckCertificateRevocationAgainstCrlErrorCode, CheckCertificateRevocationAgainstCrlFailure, CheckCertificateRevocationAgainstCrlFailureDetails, CheckCertificateRevocationAgainstCrlGoodValue, CheckCertificateRevocationAgainstCrlInput, CheckCertificateRevocationAgainstCrlResult, CheckCertificateRevocationAgainstCrlRevokedValue, CheckCertificateRevocationAgainstCrlValue, CreateCertificateRevocationListInput, CrlApplicabilityFailureReason, CrlCertificateSource, CrlEncoderErrorCode, CrlSource, ParseCertificateRevocationListErrorCode, ParseCertificateRevocationListFailure, ParseCertificateRevocationListResult, ParsedCertificateRevocationList, ParsedRevocationReason, ParsedRevokedCertificate, RevocationReason, RevokedCertificateInput, UnrecognizedReasonCodePolicy, UnrecognizedRevocationReason, ValidateCertificateRevocationListFailure, ValidateCertificateRevocationListInput, ValidateCertificateRevocationListResult, VerifyCertificateRevocationListSignatureFailure, VerifyCertificateRevocationListSignatureResult, checkCertificateRevocationAgainstCrl, createCertificateRevocationList, isCertificateRevoked, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, revocationReasonFromCode, validateCertificateRevocationList, verifyCertificateRevocationListSignature } from "./revocation/crl.js";
15
15
  import { CreateOcspCertStatusInput, CreateOcspRequestInput, CreateOcspRequestItemInput, CreateOcspResponseInput, CreateOcspSingleResponseInput, OcspCertStatus, OcspCertificateSource, OcspEncoderErrorCode, OcspHashAlgorithm, OcspRequestMaterial, OcspRequestSource, OcspResponderRevocationPolicy, OcspResponseMaterial, OcspResponseStatus, ParseOcspRequestErrorCode, ParseOcspRequestFailure, ParseOcspRequestResult, ParseOcspResponseErrorCode, ParseOcspResponseFailure, ParseOcspResponseResult, ParsedOcspCertId, ParsedOcspCertStatus, ParsedOcspRequest, ParsedOcspResponderId, ParsedOcspResponse, ParsedOcspSingleResponse, ValidateOcspResponseErrorCode, ValidateOcspResponseFailure, ValidateOcspResponseInput, ValidateOcspResponseResult, VerifyOcspResponseSignatureFailure, VerifyOcspResponseSignatureResult, createOcspRequest, createOcspResponse, hasOcspNoCheckExtension, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, validateOcspResponse, verifyOcspResponseSignature } from "./revocation/ocsp.js";
16
16
  import { CheckCertificateRevocationErrorCode, CheckCertificateRevocationFailureDetails, CheckCertificateRevocationInput, CheckCertificateRevocationResult, CheckCertificateRevocationValue, ConfiguredOcspResponder, ConfiguredOcspResponderCertificate, OcspResponderCandidate, OcspResponderSource, REVOCATION_INDETERMINATE_REASON_CODES, ResolveOcspResponderCandidatesInput, RevocationCertificateSource, RevocationCheckGoodValue, RevocationCheckIndeterminateValue, RevocationCheckRevokedValue, RevocationCrlEvidenceInput, RevocationEvidenceInput, RevocationEvidenceKind, RevocationIndeterminateEvidence, RevocationIndeterminateReasonCode, RevocationOcspEvidenceInput, RevocationStatus, checkCertificateRevocation, getCertificateOcspResponderUris, resolveOcspResponderCandidates } from "./revocation/revocation.js";
17
- import { CertificateRevocationStatus, CheckChainRevocationInput, CheckChainRevocationResult, CheckChainRevocationValue, OcspResponseSource, REVOCATION_INDETERMINATE_REASONS, RevocationExecutionError, RevocationIndeterminateReason, RevocationPolicy, RevocationSource, checkChainRevocation } from "./revocation/chain.js";
17
+ import { CertificateRevocationStatus, CheckChainRevocationInput, CheckChainRevocationResult, CheckChainRevocationValue, OcspResponseSource, REVOCATION_INDETERMINATE_REASONS, RevocationExecutionError, RevocationIndeterminateReason, RevocationParseError, RevocationPolicy, RevocationProcessingError, RevocationSource, TrustedOcspResponder, checkChainRevocation } from "./revocation/chain.js";
18
18
  import { DnsServiceIdentityInput, IpServiceIdentityInput, MatchServiceIdentityErrorCode, MatchServiceIdentityFailure, MatchServiceIdentityFailureDetails, MatchServiceIdentityFailureResult, MatchServiceIdentityInput, MatchServiceIdentityResult, MatchServiceIdentitySuccess, ServiceIdentityInput, ServiceIdentityType, SrvServiceIdentityInput, UriServiceIdentityInput, matchCertificateServiceIdentity, matchServiceIdentity } from "./verify/identity.js";
19
19
  import { InitialNameConstraintsInput } from "./verify/name-constraints.js";
20
20
  import { ConstrainedPolicy, PolicyValidationInput, PolicyValidationOutcome } from "./verify/policy.js";
21
21
  import { isSelfIssued } from "./internal/verify/verify-path.js";
22
- import { BuildCandidatePathInput, BuildCandidatePathResult, CandidatePath, CertificateSource, ChainRevocationInput, CsrSource, EkuCheckFailure, EkuCheckPurpose, EkuCheckResult, TrustAnchor, VERIFY_ERROR_CODES, ValidateCandidatePathInput, ValidateCandidatePathResult, ValidateCandidatePathSuccess, ValidateForCaInput, ValidateForCodeSigningInput, ValidateForTlsClientInput, ValidateForTlsServerInput, VerifiedCertificateChain, VerifyCertificateChainInput, VerifyChainFailure, VerifyChainResult, VerifyErrorCode, VerifyFailureDetails, VerifyPurpose, VerifyRequestFailure, VerifyRequestResult, buildCandidatePath, checkExtendedKeyUsage, trustAnchorFromCertificate, validateCandidatePath, validateForCa, validateForCodeSigning, validateForTlsClient, validateForTlsServer, verifyCertificateChain, verifyCertificateSigningRequest } from "./verify/verify.js";
22
+ import { BuildCandidatePathInput, BuildCandidatePathResult, CandidatePath, CertificateSource, ChainRevocationInput, CsrSource, EkuCheckFailure, EkuCheckPurpose, EkuCheckResult, TrustAnchor, VERIFY_ERROR_CODES, ValidateCandidatePathInput, ValidateCandidatePathResult, ValidateCandidatePathSuccess, ValidateForCaInput, ValidateForCodeSigningInput, ValidateForTlsClientInput, ValidateForTlsServerInput, VerifiedCertificateChain, VerifyCertificateChainInput, VerifyChainFailure, VerifyChainResult, VerifyErrorCode, VerifyFailureDetails, VerifyFailureSource, VerifyPurpose, VerifyRequestFailure, VerifyRequestResult, buildCandidatePath, checkExtendedKeyUsage, trustAnchorFromCertificate, validateCandidatePath, validateForCa, validateForCodeSigning, validateForTlsClient, validateForTlsServer, verifyCertificateChain, verifyCertificateSigningRequest } from "./verify/verify.js";
23
23
  import { CreateCsrInput, CsrMaterial, createCertificateSigningRequest } from "./x509/csr.js";
24
24
  import { CertificateFingerprint, CertificateFingerprintAlgorithm, CertificateFingerprintSource, certificateFingerprint } from "./x509/fingerprint.js";
25
25
  import { SubjectAltNameTextOptions, distinguishedNameToString, relativeDistinguishedNameToString, subjectAltNameLabel, subjectAltNameToString } from "./x509/name-text.js";
26
- export { type AuthorityInformationAccess, type AuthorityInformationAccessInput, type BasicConstraints, type BuildCandidatePathInput, type BuildCandidatePathResult, type CandidatePath, type CategorizePemBlocksResult, type CategorizedPemBlocks, type CertificateExtensionsInput, type CertificateFingerprint, type CertificateFingerprintAlgorithm, type CertificateFingerprintSource, type CertificateMaterial, type CertificatePolicies, type CertificateRevocationListMaterial, type CertificateRevocationStatus, type CertificateSource, type ChainRevocationInput, type CheckCertificateRevocationAgainstCrlErrorCode, type CheckCertificateRevocationAgainstCrlFailure, type CheckCertificateRevocationAgainstCrlFailureDetails, type CheckCertificateRevocationAgainstCrlGoodValue, type CheckCertificateRevocationAgainstCrlInput, type CheckCertificateRevocationAgainstCrlResult, type CheckCertificateRevocationAgainstCrlRevokedValue, type CheckCertificateRevocationAgainstCrlValue, type CheckCertificateRevocationErrorCode, type CheckCertificateRevocationFailureDetails, type CheckCertificateRevocationInput, type CheckCertificateRevocationResult, type CheckCertificateRevocationValue, type CheckChainRevocationInput, type CheckChainRevocationResult, type CheckChainRevocationValue, type ConfiguredOcspResponder, type ConfiguredOcspResponderCertificate, type ConstrainedPolicy, type CreateCertificateErrorCode, type CreateCertificateInput, type CreateCertificateRevocationListInput, type CreateCsrInput, type CreateOcspCertStatusInput, type CreateOcspRequestInput, type CreateOcspRequestItemInput, type CreateOcspResponseInput, type CreateOcspSingleResponseInput, type CreatePfxErrorCode, type CreatePfxFailure, type CreatePfxInput, type CreatePfxResult, type CreatePkcs7CertBagErrorCode, type CreatePkcs7CertBagFailure, type CreatePkcs7CertBagResult, type CreatePkcs7SignedDataErrorCode, type CreatePkcs7SignedDataFailure, type CreatePkcs7SignedDataInput, type CreatePkcs7SignedDataResult, type CreateSelfSignedCertificateBase, type CreateSelfSignedCertificateInput, type CrlApplicabilityFailureReason, type CrlCertificateSource, type CrlEncoderErrorCode, type CrlSource, type CsrMaterial, type CsrSource, type DecodedExtensionMap, type DecodedExtensionValue, type DecryptRsaOaepErrorCode, type DecryptRsaOaepFailure, type DecryptRsaOaepResult, type DistributionPoint, type DistributionPointName, type DnsServiceIdentityInput, type EcKeyAlgorithmInput, type EcNamedCurve, type Ed25519KeyAlgorithmInput, type EkuCheckFailure, type EkuCheckPurpose, type EkuCheckResult, type EncryptRsaOaepErrorCode, type EncryptRsaOaepFailure, type EncryptRsaOaepResult, type EncryptedPkcs8Options, type ErrorResult, type ExtendedKeyUsage, type ExtensionDecoder, type ExtensionDecoderMap, type ExtensionEncoderErrorCode, type GeneralName, type GeneralSubtree, type ImportEcKeyInput, type ImportEd25519KeyInput, type ImportEncryptedKeyErrorCode, type ImportEncryptedKeyFailure, type ImportEncryptedKeyResult, type ImportKeyErrorCode, type ImportKeyFailure, type ImportKeyResult, type ImportRsaKeyInput, type IndexedErrorResult, type IndexedMicro509Error, type InhibitAnyPolicy, type InitialNameConstraintsInput, type IpServiceIdentityInput, type IssuingDistributionPoint, type IssuingDistributionPointBase, type IssuingDistributionPointForAttributeCerts, type IssuingDistributionPointForCaCerts, type IssuingDistributionPointForUserCerts, type KeyAlgorithmInput, type KeyPairMaterial, type KeyUsage, type LegacyPemEncryptionOptions, type MatchCertificatePrivateKeyErrorCode, type MatchCertificatePrivateKeyFailure, type MatchCertificatePrivateKeyFailureResult, type MatchCertificatePrivateKeyResult, type MatchCertificatePrivateKeySuccess, type MatchServiceIdentityErrorCode, type MatchServiceIdentityFailure, type MatchServiceIdentityFailureDetails, type MatchServiceIdentityFailureResult, type MatchServiceIdentityInput, type MatchServiceIdentityResult, type MatchServiceIdentitySuccess, type Micro509Error, type NameAttribute, type NameConstraintForm, type NameConstraints, type NameEncoderErrorCode, type NameFieldKey, type NameInput, type NameObject, type OcspCertStatus, type OcspCertificateSource, type OcspEncoderErrorCode, type OcspHashAlgorithm, type OcspRequestMaterial, type OcspRequestSource, type OcspResponderCandidate, type OcspResponderRevocationPolicy, type OcspResponderSource, type OcspResponseMaterial, type OcspResponseSource, type OcspResponseStatus, type ParseCertificateChainResult, type ParseCertificateErrorCode, type ParseCertificateFailure, type ParseCertificateResult, type ParseCertificateRevocationListErrorCode, type ParseCertificateRevocationListFailure, type ParseCertificateRevocationListResult, type ParseCertificateSigningRequestErrorCode, type ParseCertificateSigningRequestFailure, type ParseCertificateSigningRequestResult, type ParseOcspRequestErrorCode, type ParseOcspRequestFailure, type ParseOcspRequestResult, type ParseOcspResponseErrorCode, type ParseOcspResponseFailure, type ParseOcspResponseResult, type ParseOptions, type ParsePfxErrorCode, type ParsePfxFailure, type ParsePfxOptions, type ParsePfxResult, type ParsePkcs12MacDataErrorCode, type ParsePkcs12MacDataFailure, type ParsePkcs12MacDataResult, type ParsePkcs7CertBagResult, type ParsePkcs7ErrorCode, type ParsePkcs7Failure, type ParsePkcs7SignedDataResult, type ParsedBitFlags, type ParsedCertificate, type ParsedCertificateChoice, type ParsedCertificateRevocationList, type ParsedCertificateSigningRequest, type ParsedDistributionPoint, type ParsedDistributionPointName, type ParsedExtension, type ParsedIssuingDistributionPoint, type ParsedIssuingDistributionPointBase, type ParsedIssuingDistributionPointScope, type ParsedName, type ParsedNameAttribute, type ParsedNameConstraintForm, type ParsedOcspCertId, type ParsedOcspCertStatus, type ParsedOcspRequest, type ParsedOcspResponderId, type ParsedOcspResponse, type ParsedOcspSingleResponse, type ParsedPfx, type ParsedPfxAttribute, type ParsedPfxBag, type ParsedPfxBagAttributes, type ParsedPkcs12MacData, type ParsedPkcs7SignedData, type ParsedPkcs7SignerInfo, type ParsedPkcs7SignerInfoBase, type ParsedRelativeDistinguishedName, type ParsedRevokedCertificate, type ParsedSignerIdentifier, type Pbes2Parameters, type PemBlock, type PemDecodeResult, type PemErrorCode, type PemFailure, type PfxBagAttributesInput, type PfxCertificateBagInput, type PfxCertificateSource, type PfxEncryptionOptions, type PfxMaterial, type PfxPrivateKeyBagInput, type PfxPrivateKeySource, type Pkcs12MacOptions, type Pkcs7CertBagMaterial, type Pkcs7CertificateSource, type Pkcs7SignedDataMaterial, type Pkcs7Signer, type PolicyConstraints, type PolicyInformation, type PolicyMapping, type PolicyMappings, type PolicyQualifierInfo, type PolicyValidationInput, type PolicyValidationOutcome, type PrivateKeyImportInput, type PublicKeyImportInput, REVOCATION_INDETERMINATE_REASONS, REVOCATION_INDETERMINATE_REASON_CODES, type RelativeDistinguishedNameInput, type ResolveOcspResponderCandidatesInput, type Result, type ResultError, type RevocationCertificateSource, type RevocationCheckGoodValue, type RevocationCheckIndeterminateValue, type RevocationCheckRevokedValue, type RevocationCrlEvidenceInput, type RevocationEvidenceInput, type RevocationEvidenceKind, type RevocationExecutionError, type RevocationIndeterminateEvidence, type RevocationIndeterminateReason, type RevocationIndeterminateReasonCode, type RevocationOcspEvidenceInput, type RevocationPolicy, type RevocationReason, type RevocationSource, type RevocationStatus, type RevokedCertificateInput, type RsaHash, type RsaKeyAlgorithmInput, type RsaOaepOptions, type RsaScheme, type RsaSignatureScheme, type SelfSignedCertificateResult, type SelfSignedKeySource, type ServiceIdentityInput, type ServiceIdentityType, type SplitPemBlocksResult, type SrvServiceIdentityInput, type SubjectAltName, type SubjectAltNameTextOptions, type TrustAnchor, type UriServiceIdentityInput, VERIFY_ERROR_CODES, type ValidateCandidatePathInput, type ValidateCandidatePathResult, type ValidateCandidatePathSuccess, type ValidateCertificateRevocationListFailure, type ValidateCertificateRevocationListInput, type ValidateCertificateRevocationListResult, type ValidateForCaInput, type ValidateForCodeSigningInput, type ValidateForTlsClientInput, type ValidateForTlsServerInput, type ValidateOcspResponseErrorCode, type ValidateOcspResponseFailure, type ValidateOcspResponseInput, type ValidateOcspResponseResult, type ValidityInput, type VerifiedCertificateChain, type VerifiedPkcs7Signer, type VerifyCertificateChainInput, type VerifyCertificateRevocationListSignatureFailure, type VerifyCertificateRevocationListSignatureResult, type VerifyChainFailure, type VerifyChainResult, type VerifyErrorCode, type VerifyFailureDetails, type VerifyOcspResponseSignatureFailure, type VerifyOcspResponseSignatureResult, type VerifyPkcs7SignedDataErrorCode, type VerifyPkcs7SignedDataFailure, type VerifyPkcs7SignedDataOptions, type VerifyPkcs7SignedDataResult, type VerifyPurpose, type VerifyRequestFailure, type VerifyRequestResult, buildCandidatePath, categorizePemBlocks, categorizePemBlocksOrThrow, certificateFingerprint, certificateMatchesPrivateKey, checkCertificateRevocation, checkCertificateRevocationAgainstCrl, checkChainRevocation, checkExtendedKeyUsage, compareDistinguishedNames, createCertificate, createCertificateRevocationList, createCertificateSigningRequest, createOcspRequest, createOcspResponse, createPfx, createPkcs7CertBag, createPkcs7SignedData, createSelfSignedCertificate, decodeExtension, decodeExtensionMap, decodeExtensions, decryptRsaOaep, decryptRsaOaepOrThrow, defineExtensionDecoder, defineExtensionDecoderMap, derivePublicKey, distinguishedNameToString, encryptRsaOaep, encryptRsaOaepOrThrow, exportBinaryBase64, exportEncryptedPkcs1Pem, exportEncryptedPkcs8Der, exportEncryptedPkcs8Pem, exportEncryptedSec1Pem, exportPkcs1Der, exportPkcs1Pem, exportPkcs8Der, exportPkcs8Pem, exportPrivateJwk, exportPublicJwk, exportSec1Der, exportSec1Pem, exportSpkiDer, exportSpkiPem, findExtension, generateKeyPair, getCertificateOcspResponderUris, getSubjectPublicKey, getSubjectPublicKeyOrThrow, hasOcspNoCheckExtension, importEncryptedPkcs1Pem, importEncryptedPkcs1PemOrThrow, importEncryptedPkcs8Der, importEncryptedPkcs8DerOrThrow, importEncryptedPkcs8Pem, importEncryptedPkcs8PemOrThrow, importEncryptedSec1Pem, importEncryptedSec1PemOrThrow, importPkcs1Der, importPkcs1DerOrThrow, importPkcs1Pem, importPkcs1PemOrThrow, importPkcs8Base64, importPkcs8Base64OrThrow, importPkcs8Der, importPkcs8DerOrThrow, importPkcs8Pem, importPkcs8PemOrThrow, importPrivateJwk, importPrivateJwkOrThrow, importPublicJwk, importPublicJwkOrThrow, importSec1Der, importSec1DerOrThrow, importSec1Pem, importSec1PemOrThrow, importSpkiBase64, importSpkiBase64OrThrow, importSpkiDer, importSpkiDerOrThrow, importSpkiPem, importSpkiPemOrThrow, inspectEncryptedPkcs8Der, isCertificateRevoked, isResultError, isSelfIssued as isSelfIssuedCertificate, matchCertificatePrivateKey, matchCertificateServiceIdentity, matchServiceIdentity, parseCertificateChainPem, parseCertificateChainPemOrThrow, parseCertificateDer, parseCertificateDerOrThrow, parseCertificateFromSource, parseCertificatePem, parseCertificatePemOrThrow, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, parseCertificateSigningRequestDer, parseCertificateSigningRequestDerOrThrow, parseCertificateSigningRequestPem, parseCertificateSigningRequestPemOrThrow, parseCertificatesFromSource, parseDistinguishedNameDer, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, parsePfxDer, parsePfxPem, parsePkcs7CertBagDer, parsePkcs7CertBagPem, parsePkcs7SignedDataDer, parsePkcs7SignedDataPem, pemDecode, pemDecodeOrThrow, pemEncode, relativeDistinguishedNameToString, resolveOcspResponderCandidates, revocationReasonFromCode, splitPemBlocks, splitPemBlocksOrThrow, subjectAltNameLabel, subjectAltNameToString, trustAnchorFromCertificate, unwrap, unwrapOr, validateCandidatePath, validateCertificateRevocationList, validateForCa, validateForCodeSigning, validateForTlsClient, validateForTlsServer, validateOcspResponse, verifyCertificateChain, verifyCertificateRevocationListSignature, verifyCertificateSigningRequest, verifyOcspResponseSignature, verifyPkcs7SignedData };
26
+ export { type AuthorityInformationAccess, type AuthorityInformationAccessInput, type BasicConstraints, type BuildCandidatePathInput, type BuildCandidatePathResult, type CandidatePath, type CategorizePemBlocksResult, type CategorizedPemBlocks, type CertificateExtensionsInput, type CertificateFingerprint, type CertificateFingerprintAlgorithm, type CertificateFingerprintSource, type CertificateMaterial, type CertificatePolicies, type CertificateRevocationListMaterial, type CertificateRevocationStatus, type CertificateSource, type ChainRevocationInput, type CheckCertificateRevocationAgainstCrlErrorCode, type CheckCertificateRevocationAgainstCrlFailure, type CheckCertificateRevocationAgainstCrlFailureDetails, type CheckCertificateRevocationAgainstCrlGoodValue, type CheckCertificateRevocationAgainstCrlInput, type CheckCertificateRevocationAgainstCrlResult, type CheckCertificateRevocationAgainstCrlRevokedValue, type CheckCertificateRevocationAgainstCrlValue, type CheckCertificateRevocationErrorCode, type CheckCertificateRevocationFailureDetails, type CheckCertificateRevocationInput, type CheckCertificateRevocationResult, type CheckCertificateRevocationValue, type CheckChainRevocationInput, type CheckChainRevocationResult, type CheckChainRevocationValue, type ConfiguredOcspResponder, type ConfiguredOcspResponderCertificate, type ConstrainedPolicy, type CreateCertificateErrorCode, type CreateCertificateInput, type CreateCertificateRevocationListInput, type CreateCsrInput, type CreateOcspCertStatusInput, type CreateOcspRequestInput, type CreateOcspRequestItemInput, type CreateOcspResponseInput, type CreateOcspSingleResponseInput, type CreatePfxErrorCode, type CreatePfxFailure, type CreatePfxInput, type CreatePfxResult, type CreatePkcs12MacDataErrorCode, type CreatePkcs7CertBagErrorCode, type CreatePkcs7CertBagFailure, type CreatePkcs7CertBagResult, type CreatePkcs7SignedDataErrorCode, type CreatePkcs7SignedDataFailure, type CreatePkcs7SignedDataInput, type CreatePkcs7SignedDataResult, type CreateSelfSignedCertificateBase, type CreateSelfSignedCertificateInput, type CrlApplicabilityFailureReason, type CrlCertificateSource, type CrlEncoderErrorCode, type CrlSource, type CsrMaterial, type CsrSource, DECODE_REFUSAL_CODES, type DecodeFailureCode, type DecodeRefusalCode, type DecodedExtensionMap, type DecodedExtensionValue, type DecryptRsaOaepErrorCode, type DecryptRsaOaepFailure, type DecryptRsaOaepResult, type DisplayTextType, type DistributionPoint, type DistributionPointName, type DnsServiceIdentityInput, type EcKeyAlgorithmInput, type EcNamedCurve, type Ed25519KeyAlgorithmInput, type EkuCheckFailure, type EkuCheckPurpose, type EkuCheckResult, type EncryptRsaOaepErrorCode, type EncryptRsaOaepFailure, type EncryptRsaOaepResult, type EncryptedPkcs8Options, type ErrorResult, type ExtendedKeyUsage, type ExtensionDecoder, type ExtensionDecoderMap, type ExtensionEncoderErrorCode, type GeneralName, type GeneralSubtree, type ImportEcKeyInput, type ImportEd25519KeyInput, type ImportEncryptedKeyErrorCode, type ImportEncryptedKeyFailure, type ImportEncryptedKeyOptions, type ImportEncryptedKeyResult, type ImportKeyErrorCode, type ImportKeyFailure, type ImportKeyResult, type ImportRsaKeyInput, type IndexedErrorResult, type IndexedMicro509Error, type InhibitAnyPolicy, type InitialNameConstraintsInput, type IpServiceIdentityInput, type IssuingDistributionPoint, type IssuingDistributionPointBase, type IssuingDistributionPointForAttributeCerts, type IssuingDistributionPointForCaCerts, type IssuingDistributionPointForUserCerts, type KdfLimitOptions, type KeyAlgorithmInput, type KeyPairMaterial, type KeyUsage, type LegacyPemEncryptionOptions, type MatchCertificatePrivateKeyErrorCode, type MatchCertificatePrivateKeyFailure, type MatchCertificatePrivateKeyFailureResult, type MatchCertificatePrivateKeyResult, type MatchCertificatePrivateKeySuccess, type MatchServiceIdentityErrorCode, type MatchServiceIdentityFailure, type MatchServiceIdentityFailureDetails, type MatchServiceIdentityFailureResult, type MatchServiceIdentityInput, type MatchServiceIdentityResult, type MatchServiceIdentitySuccess, type Micro509Error, type NameAttribute, type NameConstraintForm, type NameConstraints, type NameEncoderErrorCode, type NameFieldKey, type NameInput, type NameObject, type OcspCertStatus, type OcspCertificateSource, type OcspEncoderErrorCode, type OcspHashAlgorithm, type OcspRequestMaterial, type OcspRequestSource, type OcspResponderCandidate, type OcspResponderRevocationPolicy, type OcspResponderSource, type OcspResponseMaterial, type OcspResponseSource, type OcspResponseStatus, type OversizedDisplayText, type ParseCertificateChainResult, type ParseCertificateErrorCode, type ParseCertificateFailure, type ParseCertificateResult, type ParseCertificateRevocationListErrorCode, type ParseCertificateRevocationListFailure, type ParseCertificateRevocationListResult, type ParseCertificateSigningRequestErrorCode, type ParseCertificateSigningRequestFailure, type ParseCertificateSigningRequestResult, type ParseOcspRequestErrorCode, type ParseOcspRequestFailure, type ParseOcspRequestResult, type ParseOcspResponseErrorCode, type ParseOcspResponseFailure, type ParseOcspResponseResult, type ParseOptions, type ParsePfxErrorCode, type ParsePfxFailure, type ParsePfxOptions, type ParsePfxResult, type ParsePkcs12MacDataErrorCode, type ParsePkcs12MacDataFailure, type ParsePkcs12MacDataOptions, type ParsePkcs12MacDataResult, type ParsePkcs7CertBagResult, type ParsePkcs7ErrorCode, type ParsePkcs7Failure, type ParsePkcs7SignedDataResult, type ParsedBitFlags, type ParsedCertificate, type ParsedCertificateChoice, type ParsedCertificateRevocationList, type ParsedCertificateSigningRequest, type ParsedDistributionPoint, type ParsedDistributionPointName, type ParsedExtension, type ParsedIssuingDistributionPoint, type ParsedIssuingDistributionPointBase, type ParsedIssuingDistributionPointScope, type ParsedName, type ParsedNameAttribute, type ParsedNameConstraintForm, type ParsedOcspCertId, type ParsedOcspCertStatus, type ParsedOcspRequest, type ParsedOcspResponderId, type ParsedOcspResponse, type ParsedOcspSingleResponse, type ParsedPfx, type ParsedPfxAttribute, type ParsedPfxBag, type ParsedPfxBagAttributes, type ParsedPkcs12MacData, type ParsedPkcs7SignedData, type ParsedPkcs7SignerInfo, type ParsedPkcs7SignerInfoBase, type ParsedRelativeDistinguishedName, type ParsedRevocationReason, type ParsedRevokedCertificate, type ParsedSignerIdentifier, type Pbes2Parameters, type PemBlock, type PemDecodeResult, type PemErrorCode, type PemFailure, type PfxBagAttributesInput, type PfxCertificateBagInput, type PfxCertificateSource, type PfxEncoderErrorCode, type PfxEncryptionOptions, type PfxMaterial, type PfxPrivateKeyBagInput, type PfxPrivateKeySource, type Pkcs12MacOptions, type Pkcs7CertBagMaterial, type Pkcs7CertificateSource, type Pkcs7SignedDataMaterial, type Pkcs7Signer, type PolicyConstraints, type PolicyInformation, type PolicyMapping, type PolicyMappings, type PolicyQualifierInfo, type PolicyValidationInput, type PolicyValidationOutcome, type PrivateKeyImportInput, type PublicKeyImportInput, REVOCATION_INDETERMINATE_REASONS, REVOCATION_INDETERMINATE_REASON_CODES, type RelativeDistinguishedNameInput, type ResolveOcspResponderCandidatesInput, type Result, type ResultError, type RevocationCertificateSource, type RevocationCheckGoodValue, type RevocationCheckIndeterminateValue, type RevocationCheckRevokedValue, type RevocationCrlEvidenceInput, type RevocationEvidenceInput, type RevocationEvidenceKind, type RevocationExecutionError, type RevocationIndeterminateEvidence, type RevocationIndeterminateReason, type RevocationIndeterminateReasonCode, type RevocationOcspEvidenceInput, type RevocationParseError, type RevocationPolicy, type RevocationProcessingError, type RevocationReason, type RevocationSource, type RevocationStatus, type RevokedCertificateInput, type RsaHash, type RsaKeyAlgorithmInput, type RsaOaepOptions, type RsaScheme, type RsaSignatureScheme, type SelfSignedCertificateResult, type SelfSignedKeySource, type ServiceIdentityInput, type ServiceIdentityType, type SplitPemBlocksResult, type SrvServiceIdentityInput, type SubjectAltName, type SubjectAltNameTextOptions, type TrustAnchor, type TrustedOcspResponder, type UnrecognizedReasonCodePolicy, type UnrecognizedRevocationReason, type UriServiceIdentityInput, VERIFY_ERROR_CODES, type ValidateCandidatePathInput, type ValidateCandidatePathResult, type ValidateCandidatePathSuccess, type ValidateCertificateRevocationListFailure, type ValidateCertificateRevocationListInput, type ValidateCertificateRevocationListResult, type ValidateForCaInput, type ValidateForCodeSigningInput, type ValidateForTlsClientInput, type ValidateForTlsServerInput, type ValidateOcspResponseErrorCode, type ValidateOcspResponseFailure, type ValidateOcspResponseInput, type ValidateOcspResponseResult, type ValidityInput, type VerifiedCertificateChain, type VerifiedPkcs7Signer, type VerifyCertificateChainInput, type VerifyCertificateRevocationListSignatureFailure, type VerifyCertificateRevocationListSignatureResult, type VerifyChainFailure, type VerifyChainResult, type VerifyErrorCode, type VerifyFailureDetails, type VerifyFailureSource, type VerifyOcspResponseSignatureFailure, type VerifyOcspResponseSignatureResult, type VerifyPkcs7SignedDataErrorCode, type VerifyPkcs7SignedDataFailure, type VerifyPkcs7SignedDataOptions, type VerifyPkcs7SignedDataResult, type VerifyPurpose, type VerifyRequestFailure, type VerifyRequestResult, buildCandidatePath, categorizePemBlocks, categorizePemBlocksOrThrow, certificateFingerprint, certificateMatchesPrivateKey, checkCertificateRevocation, checkCertificateRevocationAgainstCrl, checkChainRevocation, checkExtendedKeyUsage, compareDistinguishedNames, createCertificate, createCertificateRevocationList, createCertificateSigningRequest, createOcspRequest, createOcspResponse, createPfx, createPkcs7CertBag, createPkcs7SignedData, createSelfSignedCertificate, decodeExtension, decodeExtensionMap, decodeExtensions, decryptRsaOaep, decryptRsaOaepOrThrow, defineExtensionDecoder, defineExtensionDecoderMap, derivePublicKey, distinguishedNameToString, encryptRsaOaep, encryptRsaOaepOrThrow, exportBinaryBase64, exportEncryptedPkcs1Pem, exportEncryptedPkcs8Der, exportEncryptedPkcs8Pem, exportEncryptedSec1Pem, exportPkcs1Der, exportPkcs1Pem, exportPkcs8Der, exportPkcs8Pem, exportPrivateJwk, exportPublicJwk, exportSec1Der, exportSec1Pem, exportSpkiDer, exportSpkiPem, findExtension, generateKeyPair, getCertificateOcspResponderUris, getSubjectPublicKey, getSubjectPublicKeyOrThrow, hasOcspNoCheckExtension, importEncryptedPkcs1Pem, importEncryptedPkcs1PemOrThrow, importEncryptedPkcs8Der, importEncryptedPkcs8DerOrThrow, importEncryptedPkcs8Pem, importEncryptedPkcs8PemOrThrow, importEncryptedSec1Pem, importEncryptedSec1PemOrThrow, importPkcs1Der, importPkcs1DerOrThrow, importPkcs1Pem, importPkcs1PemOrThrow, importPkcs8Base64, importPkcs8Base64OrThrow, importPkcs8Der, importPkcs8DerOrThrow, importPkcs8Pem, importPkcs8PemOrThrow, importPrivateJwk, importPrivateJwkOrThrow, importPublicJwk, importPublicJwkOrThrow, importSec1Der, importSec1DerOrThrow, importSec1Pem, importSec1PemOrThrow, importSpkiBase64, importSpkiBase64OrThrow, importSpkiDer, importSpkiDerOrThrow, importSpkiPem, importSpkiPemOrThrow, inspectEncryptedPkcs8Der, isCertificateRevoked, isResultError, isSelfIssued as isSelfIssuedCertificate, matchCertificatePrivateKey, matchCertificateServiceIdentity, matchServiceIdentity, parseCertificateChainPem, parseCertificateChainPemOrThrow, parseCertificateDer, parseCertificateDerOrThrow, parseCertificateFromSource, parseCertificatePem, parseCertificatePemOrThrow, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, parseCertificateSigningRequestDer, parseCertificateSigningRequestDerOrThrow, parseCertificateSigningRequestPem, parseCertificateSigningRequestPemOrThrow, parseCertificatesFromSource, parseDistinguishedNameDer, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, parsePfxDer, parsePfxPem, parsePkcs7CertBagDer, parsePkcs7CertBagPem, parsePkcs7SignedDataDer, parsePkcs7SignedDataPem, pemDecode, pemDecodeOrThrow, pemEncode, relativeDistinguishedNameToString, resolveOcspResponderCandidates, revocationReasonFromCode, splitPemBlocks, splitPemBlocksOrThrow, subjectAltNameLabel, subjectAltNameToString, trustAnchorFromCertificate, unwrap, unwrapOr, validateCandidatePath, validateCertificateRevocationList, validateForCa, validateForCodeSigning, validateForTlsClient, validateForTlsServer, validateOcspResponse, verifyCertificateChain, verifyCertificateRevocationListSignature, verifyCertificateSigningRequest, verifyOcspResponseSignature, verifyPkcs7SignedData };
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
- import { isResultError as e, unwrap as t, unwrapOr as n } from "./result/result.js";
2
- import { categorizePemBlocks as r, categorizePemBlocksOrThrow as i, pemDecode as a, pemDecodeOrThrow as o, pemEncode as s, splitPemBlocks as c, splitPemBlocksOrThrow as l } from "./pem/pem.js";
3
- import { decryptRsaOaep as u, decryptRsaOaepOrThrow as d, derivePublicKey as f, encryptRsaOaep as p, encryptRsaOaepOrThrow as m, exportBinaryBase64 as h, exportEncryptedPkcs1Pem as g, exportEncryptedPkcs8Der as _, exportEncryptedPkcs8Pem as v, exportEncryptedSec1Pem as y, exportPkcs1Der as b, exportPkcs1Pem as x, exportPkcs8Der as S, exportPkcs8Pem as C, exportPrivateJwk as w, exportPublicJwk as T, exportSec1Der as E, exportSec1Pem as D, exportSpkiDer as O, exportSpkiPem as k, generateKeyPair as A, importEncryptedPkcs1Pem as j, importEncryptedPkcs1PemOrThrow as M, importEncryptedPkcs8Der as N, importEncryptedPkcs8DerOrThrow as P, importEncryptedPkcs8Pem as F, importEncryptedPkcs8PemOrThrow as I, importEncryptedSec1Pem as L, importEncryptedSec1PemOrThrow as R, importPkcs1Der as z, importPkcs1DerOrThrow as B, importPkcs1Pem as V, importPkcs1PemOrThrow as H, importPkcs8Base64 as U, importPkcs8Base64OrThrow as W, importPkcs8Der as G, importPkcs8DerOrThrow as K, importPkcs8Pem as q, importPkcs8PemOrThrow as J, importPrivateJwk as Y, importPrivateJwkOrThrow as X, importPublicJwk as Z, importPublicJwkOrThrow as Q, importSec1Der as $, importSec1DerOrThrow as ee, importSec1Pem as te, importSec1PemOrThrow as ne, importSpkiBase64 as re, importSpkiBase64OrThrow as ie, importSpkiDer as ae, importSpkiDerOrThrow as oe, importSpkiPem as se, importSpkiPemOrThrow as ce, inspectEncryptedPkcs8Der as le } from "./keys/keys.js";
4
- import { compareDistinguishedNames as ue } from "./internal/shared/dn.js";
5
- import { certificateMatchesPrivateKey as de, decodeExtension as fe, decodeExtensionMap as pe, decodeExtensions as me, defineExtensionDecoder as he, defineExtensionDecoderMap as ge, findExtension as _e, getSubjectPublicKey as ve, getSubjectPublicKeyOrThrow as ye, matchCertificatePrivateKey as be, parseCertificateChainPem as xe, parseCertificateChainPemOrThrow as Se, parseCertificateDer as Ce, parseCertificateDerOrThrow as we, parseCertificateFromSource as Te, parseCertificatePem as Ee, parseCertificatePemOrThrow as De, parseCertificateSigningRequestDer as Oe, parseCertificateSigningRequestDerOrThrow as ke, parseCertificateSigningRequestPem as Ae, parseCertificateSigningRequestPemOrThrow as je, parseCertificatesFromSource as Me, parseDistinguishedNameDer as Ne } from "./x509/parse.js";
6
- import { createPfx as Pe, parsePfxDer as Fe, parsePfxPem as Ie } from "./pkcs/pfx.js";
7
- import { createPkcs7CertBag as Le, createPkcs7SignedData as Re, parsePkcs7CertBagDer as ze, parsePkcs7CertBagPem as Be, parsePkcs7SignedDataDer as Ve, parsePkcs7SignedDataPem as He, verifyPkcs7SignedData as Ue } from "./pkcs/pkcs7.js";
8
- import { checkCertificateRevocationAgainstCrl as We, createCertificateRevocationList as Ge, isCertificateRevoked as Ke, parseCertificateRevocationListDer as qe, parseCertificateRevocationListDerOrThrow as Je, parseCertificateRevocationListPem as Ye, parseCertificateRevocationListPemOrThrow as Xe, revocationReasonFromCode as Ze, validateCertificateRevocationList as Qe, verifyCertificateRevocationListSignature as $e } from "./revocation/crl.js";
9
- import { isSelfIssued as et } from "./internal/verify/verify-path.js";
10
- import { matchCertificateServiceIdentity as tt, matchServiceIdentity as nt } from "./verify/identity.js";
11
- import { VERIFY_ERROR_CODES as rt, buildCandidatePath as it, checkExtendedKeyUsage as at, trustAnchorFromCertificate as ot, validateCandidatePath as st, validateForCa as ct, validateForCodeSigning as lt, validateForTlsClient as ut, validateForTlsServer as dt, verifyCertificateChain as ft, verifyCertificateSigningRequest as pt } from "./verify/verify.js";
12
- import { createOcspRequest as mt, createOcspResponse as ht, hasOcspNoCheckExtension as gt, parseOcspRequestDer as _t, parseOcspRequestDerOrThrow as vt, parseOcspRequestPem as yt, parseOcspRequestPemOrThrow as bt, parseOcspResponseDer as xt, parseOcspResponseDerOrThrow as St, parseOcspResponsePem as Ct, parseOcspResponsePemOrThrow as wt, validateOcspResponse as Tt, verifyOcspResponseSignature as Et } from "./revocation/ocsp.js";
13
- import { REVOCATION_INDETERMINATE_REASONS as Dt, checkChainRevocation as Ot } from "./revocation/chain.js";
14
- import { REVOCATION_INDETERMINATE_REASON_CODES as kt, checkCertificateRevocation as At, getCertificateOcspResponderUris as jt, resolveOcspResponderCandidates as Mt } from "./revocation/revocation.js";
15
- import { createCertificate as Nt, createSelfSignedCertificate as Pt } from "./x509/certificate.js";
16
- import { createCertificateSigningRequest as Ft } from "./x509/csr.js";
17
- import { certificateFingerprint as It } from "./x509/fingerprint.js";
18
- import { distinguishedNameToString as Lt, relativeDistinguishedNameToString as Rt, subjectAltNameLabel as zt, subjectAltNameToString as Bt } from "./x509/name-text.js";
19
- export { Dt as REVOCATION_INDETERMINATE_REASONS, kt as REVOCATION_INDETERMINATE_REASON_CODES, rt as VERIFY_ERROR_CODES, it as buildCandidatePath, r as categorizePemBlocks, i as categorizePemBlocksOrThrow, It as certificateFingerprint, de as certificateMatchesPrivateKey, At as checkCertificateRevocation, We as checkCertificateRevocationAgainstCrl, Ot as checkChainRevocation, at as checkExtendedKeyUsage, ue as compareDistinguishedNames, Nt as createCertificate, Ge as createCertificateRevocationList, Ft as createCertificateSigningRequest, mt as createOcspRequest, ht as createOcspResponse, Pe as createPfx, Le as createPkcs7CertBag, Re as createPkcs7SignedData, Pt as createSelfSignedCertificate, fe as decodeExtension, pe as decodeExtensionMap, me as decodeExtensions, u as decryptRsaOaep, d as decryptRsaOaepOrThrow, he as defineExtensionDecoder, ge as defineExtensionDecoderMap, f as derivePublicKey, Lt as distinguishedNameToString, p as encryptRsaOaep, m as encryptRsaOaepOrThrow, h as exportBinaryBase64, g as exportEncryptedPkcs1Pem, _ as exportEncryptedPkcs8Der, v as exportEncryptedPkcs8Pem, y as exportEncryptedSec1Pem, b as exportPkcs1Der, x as exportPkcs1Pem, S as exportPkcs8Der, C as exportPkcs8Pem, w as exportPrivateJwk, T as exportPublicJwk, E as exportSec1Der, D as exportSec1Pem, O as exportSpkiDer, k as exportSpkiPem, _e as findExtension, A as generateKeyPair, jt as getCertificateOcspResponderUris, ve as getSubjectPublicKey, ye as getSubjectPublicKeyOrThrow, gt as hasOcspNoCheckExtension, j as importEncryptedPkcs1Pem, M as importEncryptedPkcs1PemOrThrow, N as importEncryptedPkcs8Der, P as importEncryptedPkcs8DerOrThrow, F as importEncryptedPkcs8Pem, I as importEncryptedPkcs8PemOrThrow, L as importEncryptedSec1Pem, R as importEncryptedSec1PemOrThrow, z as importPkcs1Der, B as importPkcs1DerOrThrow, V as importPkcs1Pem, H as importPkcs1PemOrThrow, U as importPkcs8Base64, W as importPkcs8Base64OrThrow, G as importPkcs8Der, K as importPkcs8DerOrThrow, q as importPkcs8Pem, J as importPkcs8PemOrThrow, Y as importPrivateJwk, X as importPrivateJwkOrThrow, Z as importPublicJwk, Q as importPublicJwkOrThrow, $ as importSec1Der, ee as importSec1DerOrThrow, te as importSec1Pem, ne as importSec1PemOrThrow, re as importSpkiBase64, ie as importSpkiBase64OrThrow, ae as importSpkiDer, oe as importSpkiDerOrThrow, se as importSpkiPem, ce as importSpkiPemOrThrow, le as inspectEncryptedPkcs8Der, Ke as isCertificateRevoked, e as isResultError, et as isSelfIssuedCertificate, be as matchCertificatePrivateKey, tt as matchCertificateServiceIdentity, nt as matchServiceIdentity, xe as parseCertificateChainPem, Se as parseCertificateChainPemOrThrow, Ce as parseCertificateDer, we as parseCertificateDerOrThrow, Te as parseCertificateFromSource, Ee as parseCertificatePem, De as parseCertificatePemOrThrow, qe as parseCertificateRevocationListDer, Je as parseCertificateRevocationListDerOrThrow, Ye as parseCertificateRevocationListPem, Xe as parseCertificateRevocationListPemOrThrow, Oe as parseCertificateSigningRequestDer, ke as parseCertificateSigningRequestDerOrThrow, Ae as parseCertificateSigningRequestPem, je as parseCertificateSigningRequestPemOrThrow, Me as parseCertificatesFromSource, Ne as parseDistinguishedNameDer, _t as parseOcspRequestDer, vt as parseOcspRequestDerOrThrow, yt as parseOcspRequestPem, bt as parseOcspRequestPemOrThrow, xt as parseOcspResponseDer, St as parseOcspResponseDerOrThrow, Ct as parseOcspResponsePem, wt as parseOcspResponsePemOrThrow, Fe as parsePfxDer, Ie as parsePfxPem, ze as parsePkcs7CertBagDer, Be as parsePkcs7CertBagPem, Ve as parsePkcs7SignedDataDer, He as parsePkcs7SignedDataPem, a as pemDecode, o as pemDecodeOrThrow, s as pemEncode, Rt as relativeDistinguishedNameToString, Mt as resolveOcspResponderCandidates, Ze as revocationReasonFromCode, c as splitPemBlocks, l as splitPemBlocksOrThrow, zt as subjectAltNameLabel, Bt as subjectAltNameToString, ot as trustAnchorFromCertificate, t as unwrap, n as unwrapOr, st as validateCandidatePath, Qe as validateCertificateRevocationList, ct as validateForCa, lt as validateForCodeSigning, ut as validateForTlsClient, dt as validateForTlsServer, Tt as validateOcspResponse, ft as verifyCertificateChain, $e as verifyCertificateRevocationListSignature, pt as verifyCertificateSigningRequest, Et as verifyOcspResponseSignature, Ue as verifyPkcs7SignedData };
1
+ import { DECODE_REFUSAL_CODES as e, isResultError as t, unwrap as n, unwrapOr as r } from "./result/result.js";
2
+ import { categorizePemBlocks as i, categorizePemBlocksOrThrow as a, pemDecode as o, pemDecodeOrThrow as s, pemEncode as c, splitPemBlocks as l, splitPemBlocksOrThrow as u } from "./pem/pem.js";
3
+ import { decryptRsaOaep as d, decryptRsaOaepOrThrow as f, derivePublicKey as p, encryptRsaOaep as m, encryptRsaOaepOrThrow as h, exportBinaryBase64 as g, exportEncryptedPkcs1Pem as _, exportEncryptedPkcs8Der as v, exportEncryptedPkcs8Pem as y, exportEncryptedSec1Pem as b, exportPkcs1Der as x, exportPkcs1Pem as S, exportPkcs8Der as C, exportPkcs8Pem as w, exportPrivateJwk as T, exportPublicJwk as E, exportSec1Der as D, exportSec1Pem as O, exportSpkiDer as k, exportSpkiPem as A, generateKeyPair as j, importEncryptedPkcs1Pem as M, importEncryptedPkcs1PemOrThrow as N, importEncryptedPkcs8Der as P, importEncryptedPkcs8DerOrThrow as F, importEncryptedPkcs8Pem as I, importEncryptedPkcs8PemOrThrow as L, importEncryptedSec1Pem as R, importEncryptedSec1PemOrThrow as z, importPkcs1Der as B, importPkcs1DerOrThrow as V, importPkcs1Pem as H, importPkcs1PemOrThrow as U, importPkcs8Base64 as W, importPkcs8Base64OrThrow as G, importPkcs8Der as K, importPkcs8DerOrThrow as q, importPkcs8Pem as J, importPkcs8PemOrThrow as Y, importPrivateJwk as X, importPrivateJwkOrThrow as Z, importPublicJwk as Q, importPublicJwkOrThrow as $, importSec1Der as ee, importSec1DerOrThrow as te, importSec1Pem as ne, importSec1PemOrThrow as re, importSpkiBase64 as ie, importSpkiBase64OrThrow as ae, importSpkiDer as oe, importSpkiDerOrThrow as se, importSpkiPem as ce, importSpkiPemOrThrow as le, inspectEncryptedPkcs8Der as ue } from "./keys/keys.js";
4
+ import { compareDistinguishedNames as de } from "./internal/shared/dn.js";
5
+ import { certificateMatchesPrivateKey as fe, decodeExtension as pe, decodeExtensionMap as me, decodeExtensions as he, defineExtensionDecoder as ge, defineExtensionDecoderMap as _e, findExtension as ve, getSubjectPublicKey as ye, getSubjectPublicKeyOrThrow as be, matchCertificatePrivateKey as xe, parseCertificateChainPem as Se, parseCertificateChainPemOrThrow as Ce, parseCertificateDer as we, parseCertificateDerOrThrow as Te, parseCertificateFromSource as Ee, parseCertificatePem as De, parseCertificatePemOrThrow as Oe, parseCertificateSigningRequestDer as ke, parseCertificateSigningRequestDerOrThrow as Ae, parseCertificateSigningRequestPem as je, parseCertificateSigningRequestPemOrThrow as Me, parseCertificatesFromSource as Ne, parseDistinguishedNameDer as Pe } from "./x509/parse.js";
6
+ import { createPfx as Fe, parsePfxDer as Ie, parsePfxPem as Le } from "./pkcs/pfx.js";
7
+ import { createPkcs7CertBag as Re, createPkcs7SignedData as ze, parsePkcs7CertBagDer as Be, parsePkcs7CertBagPem as Ve, parsePkcs7SignedDataDer as He, parsePkcs7SignedDataPem as Ue, verifyPkcs7SignedData as We } from "./pkcs/pkcs7.js";
8
+ import { checkCertificateRevocationAgainstCrl as Ge, createCertificateRevocationList as Ke, isCertificateRevoked as qe, parseCertificateRevocationListDer as Je, parseCertificateRevocationListDerOrThrow as Ye, parseCertificateRevocationListPem as Xe, parseCertificateRevocationListPemOrThrow as Ze, revocationReasonFromCode as Qe, validateCertificateRevocationList as $e, verifyCertificateRevocationListSignature as et } from "./revocation/crl.js";
9
+ import { isSelfIssued as tt } from "./internal/verify/verify-path.js";
10
+ import { matchCertificateServiceIdentity as nt, matchServiceIdentity as rt } from "./verify/identity.js";
11
+ import { VERIFY_ERROR_CODES as it, buildCandidatePath as at, checkExtendedKeyUsage as ot, trustAnchorFromCertificate as st, validateCandidatePath as ct, validateForCa as lt, validateForCodeSigning as ut, validateForTlsClient as dt, validateForTlsServer as ft, verifyCertificateChain as pt, verifyCertificateSigningRequest as mt } from "./verify/verify.js";
12
+ import { createOcspRequest as ht, createOcspResponse as gt, hasOcspNoCheckExtension as _t, parseOcspRequestDer as vt, parseOcspRequestDerOrThrow as yt, parseOcspRequestPem as bt, parseOcspRequestPemOrThrow as xt, parseOcspResponseDer as St, parseOcspResponseDerOrThrow as Ct, parseOcspResponsePem as wt, parseOcspResponsePemOrThrow as Tt, validateOcspResponse as Et, verifyOcspResponseSignature as Dt } from "./revocation/ocsp.js";
13
+ import { REVOCATION_INDETERMINATE_REASONS as Ot, checkChainRevocation as kt } from "./revocation/chain.js";
14
+ import { REVOCATION_INDETERMINATE_REASON_CODES as At, checkCertificateRevocation as jt, getCertificateOcspResponderUris as Mt, resolveOcspResponderCandidates as Nt } from "./revocation/revocation.js";
15
+ import { createCertificate as Pt, createSelfSignedCertificate as Ft } from "./x509/certificate.js";
16
+ import { createCertificateSigningRequest as It } from "./x509/csr.js";
17
+ import { certificateFingerprint as Lt } from "./x509/fingerprint.js";
18
+ import { distinguishedNameToString as Rt, relativeDistinguishedNameToString as zt, subjectAltNameLabel as Bt, subjectAltNameToString as Vt } from "./x509/name-text.js";
19
+ export { e as DECODE_REFUSAL_CODES, Ot as REVOCATION_INDETERMINATE_REASONS, At as REVOCATION_INDETERMINATE_REASON_CODES, it as VERIFY_ERROR_CODES, at as buildCandidatePath, i as categorizePemBlocks, a as categorizePemBlocksOrThrow, Lt as certificateFingerprint, fe as certificateMatchesPrivateKey, jt as checkCertificateRevocation, Ge as checkCertificateRevocationAgainstCrl, kt as checkChainRevocation, ot as checkExtendedKeyUsage, de as compareDistinguishedNames, Pt as createCertificate, Ke as createCertificateRevocationList, It as createCertificateSigningRequest, ht as createOcspRequest, gt as createOcspResponse, Fe as createPfx, Re as createPkcs7CertBag, ze as createPkcs7SignedData, Ft as createSelfSignedCertificate, pe as decodeExtension, me as decodeExtensionMap, he as decodeExtensions, d as decryptRsaOaep, f as decryptRsaOaepOrThrow, ge as defineExtensionDecoder, _e as defineExtensionDecoderMap, p as derivePublicKey, Rt as distinguishedNameToString, m as encryptRsaOaep, h as encryptRsaOaepOrThrow, g as exportBinaryBase64, _ as exportEncryptedPkcs1Pem, v as exportEncryptedPkcs8Der, y as exportEncryptedPkcs8Pem, b as exportEncryptedSec1Pem, x as exportPkcs1Der, S as exportPkcs1Pem, C as exportPkcs8Der, w as exportPkcs8Pem, T as exportPrivateJwk, E as exportPublicJwk, D as exportSec1Der, O as exportSec1Pem, k as exportSpkiDer, A as exportSpkiPem, ve as findExtension, j as generateKeyPair, Mt as getCertificateOcspResponderUris, ye as getSubjectPublicKey, be as getSubjectPublicKeyOrThrow, _t as hasOcspNoCheckExtension, M as importEncryptedPkcs1Pem, N as importEncryptedPkcs1PemOrThrow, P as importEncryptedPkcs8Der, F as importEncryptedPkcs8DerOrThrow, I as importEncryptedPkcs8Pem, L as importEncryptedPkcs8PemOrThrow, R as importEncryptedSec1Pem, z as importEncryptedSec1PemOrThrow, B as importPkcs1Der, V as importPkcs1DerOrThrow, H as importPkcs1Pem, U as importPkcs1PemOrThrow, W as importPkcs8Base64, G as importPkcs8Base64OrThrow, K as importPkcs8Der, q as importPkcs8DerOrThrow, J as importPkcs8Pem, Y as importPkcs8PemOrThrow, X as importPrivateJwk, Z as importPrivateJwkOrThrow, Q as importPublicJwk, $ as importPublicJwkOrThrow, ee as importSec1Der, te as importSec1DerOrThrow, ne as importSec1Pem, re as importSec1PemOrThrow, ie as importSpkiBase64, ae as importSpkiBase64OrThrow, oe as importSpkiDer, se as importSpkiDerOrThrow, ce as importSpkiPem, le as importSpkiPemOrThrow, ue as inspectEncryptedPkcs8Der, qe as isCertificateRevoked, t as isResultError, tt as isSelfIssuedCertificate, xe as matchCertificatePrivateKey, nt as matchCertificateServiceIdentity, rt as matchServiceIdentity, Se as parseCertificateChainPem, Ce as parseCertificateChainPemOrThrow, we as parseCertificateDer, Te as parseCertificateDerOrThrow, Ee as parseCertificateFromSource, De as parseCertificatePem, Oe as parseCertificatePemOrThrow, Je as parseCertificateRevocationListDer, Ye as parseCertificateRevocationListDerOrThrow, Xe as parseCertificateRevocationListPem, Ze as parseCertificateRevocationListPemOrThrow, ke as parseCertificateSigningRequestDer, Ae as parseCertificateSigningRequestDerOrThrow, je as parseCertificateSigningRequestPem, Me as parseCertificateSigningRequestPemOrThrow, Ne as parseCertificatesFromSource, Pe as parseDistinguishedNameDer, vt as parseOcspRequestDer, yt as parseOcspRequestDerOrThrow, bt as parseOcspRequestPem, xt as parseOcspRequestPemOrThrow, St as parseOcspResponseDer, Ct as parseOcspResponseDerOrThrow, wt as parseOcspResponsePem, Tt as parseOcspResponsePemOrThrow, Ie as parsePfxDer, Le as parsePfxPem, Be as parsePkcs7CertBagDer, Ve as parsePkcs7CertBagPem, He as parsePkcs7SignedDataDer, Ue as parsePkcs7SignedDataPem, o as pemDecode, s as pemDecodeOrThrow, c as pemEncode, zt as relativeDistinguishedNameToString, Nt as resolveOcspResponderCandidates, Qe as revocationReasonFromCode, l as splitPemBlocks, u as splitPemBlocksOrThrow, Bt as subjectAltNameLabel, Vt as subjectAltNameToString, st as trustAnchorFromCertificate, n as unwrap, r as unwrapOr, ct as validateCandidatePath, $e as validateCertificateRevocationList, lt as validateForCa, ut as validateForCodeSigning, dt as validateForTlsClient, ft as validateForTlsServer, Et as validateOcspResponse, pt as verifyCertificateChain, et as verifyCertificateRevocationListSignature, mt as verifyCertificateSigningRequest, Dt as verifyOcspResponseSignature, We as verifyPkcs7SignedData };