micro509 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -3
- package/dist/der/der.d.ts +127 -0
- package/dist/der/der.js +171 -0
- package/dist/der/der.js.map +1 -0
- package/dist/der.d.ts +4 -0
- package/dist/der.js +4 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/internal/asn1/asn1.d.ts +20 -0
- package/dist/internal/asn1/asn1.js +60 -28
- package/dist/internal/asn1/asn1.js.map +1 -1
- package/dist/internal/asn1/der.d.ts +171 -0
- package/dist/internal/asn1/der.js +101 -36
- package/dist/internal/asn1/der.js.map +1 -1
- package/dist/internal/asn1/oids.js +22 -0
- package/dist/internal/asn1/oids2.js +9 -2
- package/dist/internal/asn1/oids2.js.map +1 -1
- package/dist/internal/shared/dn.js +143 -13
- package/dist/internal/shared/dn.js.map +1 -1
- package/dist/internal/shared/rfc3454-tables.js +1782 -0
- package/dist/internal/shared/rfc3454-tables.js.map +1 -0
- package/dist/internal/verify/name-constraints-engine.js +47 -15
- package/dist/internal/verify/name-constraints-engine.js.map +1 -1
- package/dist/internal/verify/policy-engine.js +86 -95
- package/dist/internal/verify/policy-engine.js.map +1 -1
- package/dist/internal/verify/verify-path.js +18 -14
- package/dist/internal/verify/verify-path.js.map +1 -1
- package/dist/internal/x509/extension-bits.js +1 -1
- package/dist/internal/x509/extension-bits.js.map +1 -1
- package/dist/internal/x509/name-fields.js +19 -4
- package/dist/internal/x509/name-fields.js.map +1 -1
- package/dist/revocation/chain.js +110 -55
- package/dist/revocation/chain.js.map +1 -1
- package/dist/revocation/crl.js +2 -2
- package/dist/revocation/crl.js.map +1 -1
- package/dist/revocation/ocsp.js +2 -2
- package/dist/revocation/ocsp.js.map +1 -1
- package/dist/verify/verify.d.ts +14 -1
- package/dist/verify/verify.js +39 -32
- package/dist/verify/verify.js.map +1 -1
- package/dist/x509/extensions.d.ts +1 -1
- package/dist/x509/extensions.js.map +1 -1
- package/dist/x509/fingerprint.d.ts +3 -0
- package/dist/x509/fingerprint.js +3 -0
- package/dist/x509/fingerprint.js.map +1 -1
- package/dist/x509/name-text.d.ts +50 -0
- package/dist/x509/name-text.js +111 -0
- package/dist/x509/name-text.js.map +1 -0
- package/dist/x509/parse.d.ts +3 -0
- package/dist/x509/parse.js +10 -1
- package/dist/x509/parse.js.map +1 -1
- package/dist/x509.d.ts +2 -1
- package/dist/x509.js +2 -1
- package/package.json +46 -25
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<picture>
|
|
2
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/kjanat/micro509/raw/
|
|
3
|
-
<source media="(prefers-color-scheme: light)" srcset="https://github.com/kjanat/micro509/raw/
|
|
4
|
-
<img alt="" src="https://github.com/kjanat/micro509/raw/
|
|
2
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/kjanat/micro509/raw/e7e2007bfd7a18f6f247864b14ef60d54ed91dd6/site/assets/icon-light.svg">
|
|
3
|
+
<source media="(prefers-color-scheme: light)" srcset="https://github.com/kjanat/micro509/raw/e7e2007bfd7a18f6f247864b14ef60d54ed91dd6/site/assets/icon.svg">
|
|
4
|
+
<img alt="" src="https://github.com/kjanat/micro509/raw/e7e2007bfd7a18f6f247864b14ef60d54ed91dd6/site/assets/icon.svg" width="64" height="64" align="left">
|
|
5
5
|
</picture>
|
|
6
6
|
|
|
7
7
|
# micro509
|
|
@@ -26,6 +26,20 @@ Zero dependencies. Tree-shakeable subpath entrypoints. Pure WebCrypto. Runs ever
|
|
|
26
26
|
npm install micro509
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
In a browser, no build step — it is WebCrypto and nothing else:
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<script type="module">
|
|
33
|
+
import { createSelfSignedCertificate } from 'https://esm.run/micro509';
|
|
34
|
+
</script>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Two runnable examples: [`examples/browser`] is one HTML file you can open, and
|
|
38
|
+
[`examples/vite`] is the same demo with types and a dev server. Both open in StackBlitz.
|
|
39
|
+
|
|
40
|
+
[`examples/browser`]: ./examples/browser/README.md
|
|
41
|
+
[`examples/vite`]: ./examples/vite/README.md
|
|
42
|
+
|
|
29
43
|
## Why micro509
|
|
30
44
|
|
|
31
45
|
JavaScript PKI libraries usually force a bad tradeoff:
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { DerElement, ReadRootElementOptions, ReadSequenceChildrenOptions } from "../internal/asn1/der.js";
|
|
2
|
+
import { DerBitString } from "../internal/asn1/asn1.js";
|
|
3
|
+
import { ErrorResult, Micro509Error } from "../result/result.js";
|
|
4
|
+
//#region src/der/der.d.ts
|
|
5
|
+
/** Machine-readable failure reason for the DER readers and decoders. */
|
|
6
|
+
type DecodeDerErrorCode = "malformed";
|
|
7
|
+
/** Structured failure payload for DER reading and decoding. */
|
|
8
|
+
interface DecodeDerFailure extends Micro509Error<DecodeDerErrorCode> {
|
|
9
|
+
/** Always `false` for failures. */
|
|
10
|
+
readonly ok: false;
|
|
11
|
+
}
|
|
12
|
+
/** Success-or-failure result from a DER reader or decoder. */
|
|
13
|
+
type DecodeDerResult<TValue> = {
|
|
14
|
+
readonly ok: true;
|
|
15
|
+
readonly value: TValue;
|
|
16
|
+
} | ErrorResult<DecodeDerErrorCode, Record<never, never>, DecodeDerFailure>;
|
|
17
|
+
/**
|
|
18
|
+
* Reads one TLV element from {@linkcode bytes} starting at {@linkcode offset}.
|
|
19
|
+
*
|
|
20
|
+
* @param offset Byte position of the tag octet. Defaults to 0.
|
|
21
|
+
* @throws if the element is truncated, indefinite-length, or non-minimally encoded.
|
|
22
|
+
*/
|
|
23
|
+
declare function readDerElementOrThrow(bytes: Uint8Array, offset?: number): DerElement;
|
|
24
|
+
/**
|
|
25
|
+
* Reads one TLV element from {@linkcode bytes} starting at {@linkcode offset}.
|
|
26
|
+
*
|
|
27
|
+
* @param offset Byte position of the tag octet. Defaults to 0.
|
|
28
|
+
*/
|
|
29
|
+
declare function readDerElement(bytes: Uint8Array, offset?: number): DecodeDerResult<DerElement>;
|
|
30
|
+
/**
|
|
31
|
+
* Reads the single top-level TLV element from {@linkcode bytes}.
|
|
32
|
+
*
|
|
33
|
+
* @throws if {@linkcode bytes} carries trailing data, or nesting exceeds the depth guard.
|
|
34
|
+
*/
|
|
35
|
+
declare function readDerRootOrThrow(bytes: Uint8Array, options?: ReadRootElementOptions): DerElement;
|
|
36
|
+
/** Reads the single top-level TLV element from {@linkcode bytes}. */
|
|
37
|
+
declare function readDerRoot(bytes: Uint8Array, options?: ReadRootElementOptions): DecodeDerResult<DerElement>;
|
|
38
|
+
/**
|
|
39
|
+
* Reads a DER-encoded SEQUENCE from {@linkcode bytes} and returns its direct children.
|
|
40
|
+
*
|
|
41
|
+
* @throws if the root element is not a SEQUENCE, or if child boundaries are inconsistent.
|
|
42
|
+
*/
|
|
43
|
+
declare function readDerSequenceOrThrow(bytes: Uint8Array, options?: ReadSequenceChildrenOptions): DerElement[];
|
|
44
|
+
/** Reads a DER-encoded SEQUENCE from {@linkcode bytes} and returns its direct children. */
|
|
45
|
+
declare function readDerSequence(bytes: Uint8Array, options?: ReadSequenceChildrenOptions): DecodeDerResult<DerElement[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Reads the direct children of a constructed {@linkcode parent} within {@linkcode source}.
|
|
48
|
+
*
|
|
49
|
+
* @throws if a child overflows {@linkcode parent}, or data is left between the last child and its end.
|
|
50
|
+
*/
|
|
51
|
+
declare function derChildrenOrThrow(source: Uint8Array, parent: DerElement): DerElement[];
|
|
52
|
+
/** Reads the direct children of a constructed {@linkcode parent} within {@linkcode source}. */
|
|
53
|
+
declare function derChildren(source: Uint8Array, parent: DerElement): DecodeDerResult<DerElement[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Decodes a BOOLEAN element (tag `0x01`).
|
|
56
|
+
*
|
|
57
|
+
* @throws if {@linkcode element} is mis-tagged, or holds anything but `0x00` or `0xff`.
|
|
58
|
+
*/
|
|
59
|
+
declare function decodeDerBooleanOrThrow(element: DerElement): boolean;
|
|
60
|
+
/** Decodes a BOOLEAN element (tag `0x01`). */
|
|
61
|
+
declare function decodeDerBoolean(element: DerElement): DecodeDerResult<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* Decodes an INTEGER element (tag `0x02`) into a `number`.
|
|
64
|
+
*
|
|
65
|
+
* @throws if {@linkcode element} is mis-tagged, negative, non-minimally encoded,
|
|
66
|
+
* or exceeds {@linkcode Number.MAX_SAFE_INTEGER}.
|
|
67
|
+
*/
|
|
68
|
+
declare function decodeDerIntegerOrThrow(element: DerElement): number;
|
|
69
|
+
/** Decodes an INTEGER element (tag `0x02`) into a `number`. */
|
|
70
|
+
declare function decodeDerInteger(element: DerElement): DecodeDerResult<number>;
|
|
71
|
+
/**
|
|
72
|
+
* Decodes an OCTET STRING element (tag `0x04`) into its payload bytes.
|
|
73
|
+
*
|
|
74
|
+
* @throws if {@linkcode element} is mis-tagged.
|
|
75
|
+
*/
|
|
76
|
+
declare function decodeDerOctetStringOrThrow(element: DerElement): Uint8Array;
|
|
77
|
+
/** Decodes an OCTET STRING element (tag `0x04`) into its payload bytes. */
|
|
78
|
+
declare function decodeDerOctetString(element: DerElement): DecodeDerResult<Uint8Array>;
|
|
79
|
+
/**
|
|
80
|
+
* Decodes an OBJECT IDENTIFIER element (tag `0x06`) into dotted-decimal form.
|
|
81
|
+
*
|
|
82
|
+
* @throws if {@linkcode element} is mis-tagged, or holds a malformed sub-identifier.
|
|
83
|
+
*/
|
|
84
|
+
declare function decodeDerOidOrThrow(element: DerElement): string;
|
|
85
|
+
/** Decodes an OBJECT IDENTIFIER element (tag `0x06`) into dotted-decimal form. */
|
|
86
|
+
declare function decodeDerOid(element: DerElement): DecodeDerResult<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Decodes a BIT STRING element (tag `0x03`) into a {@linkcode DerBitString}.
|
|
89
|
+
*
|
|
90
|
+
* 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
|
|
91
|
+
* through {@linkcode DerBitString.nonZeroPadding}, since certificates in the wild carry them.
|
|
92
|
+
*
|
|
93
|
+
* @throws if {@linkcode element} is mis-tagged, or claims more than seven unused bits.
|
|
94
|
+
*/
|
|
95
|
+
declare function decodeDerBitStringOrThrow(element: DerElement): DerBitString;
|
|
96
|
+
/**
|
|
97
|
+
* Decodes a BIT STRING element (tag `0x03`) into a {@linkcode DerBitString}.
|
|
98
|
+
*
|
|
99
|
+
* 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
|
+
* through {@linkcode DerBitString.nonZeroPadding}, since certificates in the wild carry them.
|
|
101
|
+
*/
|
|
102
|
+
declare function decodeDerBitString(element: DerElement): DecodeDerResult<DerBitString>;
|
|
103
|
+
/**
|
|
104
|
+
* Decodes a string element into text, dispatching on its tag.
|
|
105
|
+
*
|
|
106
|
+
* Supports UTF8String, PrintableString, IA5String, UniversalString, and BMPString.
|
|
107
|
+
*
|
|
108
|
+
* @throws on TeletexString, and on every other string tag.
|
|
109
|
+
*/
|
|
110
|
+
declare function decodeDerStringOrThrow(element: DerElement): string;
|
|
111
|
+
/**
|
|
112
|
+
* Decodes a string element into text, dispatching on its tag.
|
|
113
|
+
*
|
|
114
|
+
* Supports UTF8String, PrintableString, IA5String, UniversalString, and BMPString.
|
|
115
|
+
*/
|
|
116
|
+
declare function decodeDerString(element: DerElement): DecodeDerResult<string>;
|
|
117
|
+
/**
|
|
118
|
+
* Decodes a UTCTime (tag `0x17`) or GeneralizedTime (tag `0x18`) element into a {@linkcode Date}.
|
|
119
|
+
*
|
|
120
|
+
* @throws if {@linkcode element} carries any other tag, or a malformed time value.
|
|
121
|
+
*/
|
|
122
|
+
declare function decodeDerTimeOrThrow(element: DerElement): Date;
|
|
123
|
+
/** 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 };
|
|
127
|
+
//# sourceMappingURL=der.d.ts.map
|
package/dist/der/der.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
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) {
|
|
6
|
+
try {
|
|
7
|
+
return f(e());
|
|
8
|
+
} catch (e) {
|
|
9
|
+
return d(e), u("malformed", e instanceof Error ? e.message : t);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function requireTag(e, t, n) {
|
|
13
|
+
if (e.tag !== t) throw Error(`Expected ${n}`);
|
|
14
|
+
return e;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Reads one TLV element from {@linkcode bytes} starting at {@linkcode offset}.
|
|
18
|
+
*
|
|
19
|
+
* @param offset Byte position of the tag octet. Defaults to 0.
|
|
20
|
+
* @throws if the element is truncated, indefinite-length, or non-minimally encoded.
|
|
21
|
+
*/
|
|
22
|
+
function readDerElementOrThrow(t, n = 0) {
|
|
23
|
+
return e(t, n);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Reads one TLV element from {@linkcode bytes} starting at {@linkcode offset}.
|
|
27
|
+
*
|
|
28
|
+
* @param offset Byte position of the tag octet. Defaults to 0.
|
|
29
|
+
*/
|
|
30
|
+
function readDerElement(e, t = 0) {
|
|
31
|
+
return attempt(() => readDerElementOrThrow(e, t), "Malformed DER element");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Reads the single top-level TLV element from {@linkcode bytes}.
|
|
35
|
+
*
|
|
36
|
+
* @throws if {@linkcode bytes} carries trailing data, or nesting exceeds the depth guard.
|
|
37
|
+
*/
|
|
38
|
+
function readDerRootOrThrow(e, n) {
|
|
39
|
+
return t(e, n);
|
|
40
|
+
}
|
|
41
|
+
/** Reads the single top-level TLV element from {@linkcode bytes}. */
|
|
42
|
+
function readDerRoot(e, t) {
|
|
43
|
+
return attempt(() => readDerRootOrThrow(e, t), "Malformed DER element");
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Reads a DER-encoded SEQUENCE from {@linkcode bytes} and returns its direct children.
|
|
47
|
+
*
|
|
48
|
+
* @throws if the root element is not a SEQUENCE, or if child boundaries are inconsistent.
|
|
49
|
+
*/
|
|
50
|
+
function readDerSequenceOrThrow(e, t) {
|
|
51
|
+
return n(e, t);
|
|
52
|
+
}
|
|
53
|
+
/** Reads a DER-encoded SEQUENCE from {@linkcode bytes} and returns its direct children. */
|
|
54
|
+
function readDerSequence(e, t) {
|
|
55
|
+
return attempt(() => readDerSequenceOrThrow(e, t), "Malformed DER sequence");
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Reads the direct children of a constructed {@linkcode parent} within {@linkcode source}.
|
|
59
|
+
*
|
|
60
|
+
* @throws if a child overflows {@linkcode parent}, or data is left between the last child and its end.
|
|
61
|
+
*/
|
|
62
|
+
function derChildrenOrThrow(e, t) {
|
|
63
|
+
return r(e, t);
|
|
64
|
+
}
|
|
65
|
+
/** Reads the direct children of a constructed {@linkcode parent} within {@linkcode source}. */
|
|
66
|
+
function derChildren(e, t) {
|
|
67
|
+
return attempt(() => derChildrenOrThrow(e, t), "Malformed DER container");
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Decodes a BOOLEAN element (tag `0x01`).
|
|
71
|
+
*
|
|
72
|
+
* @throws if {@linkcode element} is mis-tagged, or holds anything but `0x00` or `0xff`.
|
|
73
|
+
*/
|
|
74
|
+
function decodeDerBooleanOrThrow(e) {
|
|
75
|
+
return a(requireTag(e, 1, "BOOLEAN").value);
|
|
76
|
+
}
|
|
77
|
+
/** Decodes a BOOLEAN element (tag `0x01`). */
|
|
78
|
+
function decodeDerBoolean(e) {
|
|
79
|
+
return attempt(() => decodeDerBooleanOrThrow(e), "Malformed BOOLEAN");
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Decodes an INTEGER element (tag `0x02`) into a `number`.
|
|
83
|
+
*
|
|
84
|
+
* @throws if {@linkcode element} is mis-tagged, negative, non-minimally encoded,
|
|
85
|
+
* or exceeds {@linkcode Number.MAX_SAFE_INTEGER}.
|
|
86
|
+
*/
|
|
87
|
+
function decodeDerIntegerOrThrow(e) {
|
|
88
|
+
return o(requireTag(e, 2, "INTEGER").value);
|
|
89
|
+
}
|
|
90
|
+
/** Decodes an INTEGER element (tag `0x02`) into a `number`. */
|
|
91
|
+
function decodeDerInteger(e) {
|
|
92
|
+
return attempt(() => decodeDerIntegerOrThrow(e), "Malformed INTEGER");
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Decodes an OCTET STRING element (tag `0x04`) into its payload bytes.
|
|
96
|
+
*
|
|
97
|
+
* @throws if {@linkcode element} is mis-tagged.
|
|
98
|
+
*/
|
|
99
|
+
function decodeDerOctetStringOrThrow(e) {
|
|
100
|
+
return requireTag(e, 4, "OCTET STRING").value;
|
|
101
|
+
}
|
|
102
|
+
/** Decodes an OCTET STRING element (tag `0x04`) into its payload bytes. */
|
|
103
|
+
function decodeDerOctetString(e) {
|
|
104
|
+
return attempt(() => decodeDerOctetStringOrThrow(e), "Malformed OCTET STRING");
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Decodes an OBJECT IDENTIFIER element (tag `0x06`) into dotted-decimal form.
|
|
108
|
+
*
|
|
109
|
+
* @throws if {@linkcode element} is mis-tagged, or holds a malformed sub-identifier.
|
|
110
|
+
*/
|
|
111
|
+
function decodeDerOidOrThrow(e) {
|
|
112
|
+
return s(requireTag(e, 6, "OBJECT IDENTIFIER").value);
|
|
113
|
+
}
|
|
114
|
+
/** Decodes an OBJECT IDENTIFIER element (tag `0x06`) into dotted-decimal form. */
|
|
115
|
+
function decodeDerOid(e) {
|
|
116
|
+
return attempt(() => decodeDerOidOrThrow(e), "Malformed OBJECT IDENTIFIER");
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Decodes a BIT STRING element (tag `0x03`) into a {@linkcode DerBitString}.
|
|
120
|
+
*
|
|
121
|
+
* 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
|
|
122
|
+
* through {@linkcode DerBitString.nonZeroPadding}, since certificates in the wild carry them.
|
|
123
|
+
*
|
|
124
|
+
* @throws if {@linkcode element} is mis-tagged, or claims more than seven unused bits.
|
|
125
|
+
*/
|
|
126
|
+
function decodeDerBitStringOrThrow(e) {
|
|
127
|
+
return i(e);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Decodes a BIT STRING element (tag `0x03`) into a {@linkcode DerBitString}.
|
|
131
|
+
*
|
|
132
|
+
* 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
|
|
133
|
+
* through {@linkcode DerBitString.nonZeroPadding}, since certificates in the wild carry them.
|
|
134
|
+
*/
|
|
135
|
+
function decodeDerBitString(e) {
|
|
136
|
+
return attempt(() => decodeDerBitStringOrThrow(e), "Malformed BIT STRING");
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Decodes a string element into text, dispatching on its tag.
|
|
140
|
+
*
|
|
141
|
+
* Supports UTF8String, PrintableString, IA5String, UniversalString, and BMPString.
|
|
142
|
+
*
|
|
143
|
+
* @throws on TeletexString, and on every other string tag.
|
|
144
|
+
*/
|
|
145
|
+
function decodeDerStringOrThrow(e) {
|
|
146
|
+
return c(e.tag, e.value);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Decodes a string element into text, dispatching on its tag.
|
|
150
|
+
*
|
|
151
|
+
* Supports UTF8String, PrintableString, IA5String, UniversalString, and BMPString.
|
|
152
|
+
*/
|
|
153
|
+
function decodeDerString(e) {
|
|
154
|
+
return attempt(() => decodeDerStringOrThrow(e), "Malformed string");
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Decodes a UTCTime (tag `0x17`) or GeneralizedTime (tag `0x18`) element into a {@linkcode Date}.
|
|
158
|
+
*
|
|
159
|
+
* @throws if {@linkcode element} carries any other tag, or a malformed time value.
|
|
160
|
+
*/
|
|
161
|
+
function decodeDerTimeOrThrow(e) {
|
|
162
|
+
return l(e);
|
|
163
|
+
}
|
|
164
|
+
/** Decodes a UTCTime (tag `0x17`) or GeneralizedTime (tag `0x18`) element into a {@linkcode Date}. */
|
|
165
|
+
function decodeDerTime(e) {
|
|
166
|
+
return attempt(() => decodeDerTimeOrThrow(e), "Malformed time");
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
export { decodeDerBitString, decodeDerBitStringOrThrow, decodeDerBoolean, decodeDerBooleanOrThrow, decodeDerInteger, decodeDerIntegerOrThrow, decodeDerOctetString, decodeDerOctetStringOrThrow, decodeDerOid, decodeDerOidOrThrow, decodeDerString, decodeDerStringOrThrow, decodeDerTime, decodeDerTimeOrThrow, derChildren, derChildrenOrThrow, readDerElement, readDerElementOrThrow, readDerRoot, readDerRootOrThrow, readDerSequence, readDerSequenceOrThrow };
|
|
170
|
+
|
|
171
|
+
//# sourceMappingURL=der.js.map
|
|
@@ -0,0 +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"}
|
package/dist/der.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_MAX_DER_DEPTH, DerElement, ReadRootElementOptions, ReadSequenceChildrenOptions, assertDerMaxDepth, bitString, bmpString, bool, concatBytes, explicitContext, generalizedTime, ia5String, implicitConstructedContext, implicitPrimitiveContext, integer, integerFromNumber, nullValue, objectIdentifier, octetString, printableString, sequence, setOf, time, tlv, universalString, utcTime, utf8String } from "./internal/asn1/der.js";
|
|
2
|
+
import { DerBitString, hexToBytes, toHex } from "./internal/asn1/asn1.js";
|
|
3
|
+
import { 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 } from "./der/der.js";
|
|
4
|
+
export { DEFAULT_MAX_DER_DEPTH, type DecodeDerErrorCode, type DecodeDerFailure, type DecodeDerResult, type DerBitString, type DerElement, type ReadRootElementOptions, type ReadSequenceChildrenOptions, assertDerMaxDepth, concatBytes, decodeDerBitString, decodeDerBitStringOrThrow, decodeDerBoolean, decodeDerBooleanOrThrow, decodeDerInteger, decodeDerIntegerOrThrow, decodeDerOctetString, decodeDerOctetStringOrThrow, decodeDerOid, decodeDerOidOrThrow, decodeDerString, decodeDerStringOrThrow, decodeDerTime, decodeDerTimeOrThrow, bitString as derBitString, bmpString as derBmpString, bool as derBoolean, derChildren, derChildrenOrThrow, explicitContext as derExplicitContext, generalizedTime as derGeneralizedTime, ia5String as derIa5String, implicitConstructedContext as derImplicitConstructedContext, implicitPrimitiveContext as derImplicitPrimitiveContext, integer as derInteger, integerFromNumber as derIntegerFromNumber, nullValue as derNull, octetString as derOctetString, objectIdentifier as derOid, printableString as derPrintableString, sequence as derSequence, setOf as derSet, time as derTime, tlv as derTlv, universalString as derUniversalString, utcTime as derUtcTime, utf8String as derUtf8String, hexToBytes, readDerElement, readDerElementOrThrow, readDerRoot, readDerRootOrThrow, readDerSequence, readDerSequenceOrThrow, toHex };
|
package/dist/der.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_MAX_DER_DEPTH as e, assertDerMaxDepth as t, bitString as n, bmpString as r, bool as i, concatBytes as a, explicitContext as o, generalizedTime as s, ia5String as c, implicitConstructedContext as l, implicitPrimitiveContext as u, integer as d, integerFromNumber as f, nullValue as p, objectIdentifier as m, octetString as h, printableString as g, sequence as _, setOf as v, time as y, tlv as b, universalString as x, utcTime as S, utf8String as C } from "./internal/asn1/der.js";
|
|
2
|
+
import { hexToBytes as w, toHex as T } from "./internal/asn1/asn1.js";
|
|
3
|
+
import { decodeDerBitString as E, decodeDerBitStringOrThrow as D, decodeDerBoolean as O, decodeDerBooleanOrThrow as k, decodeDerInteger as A, decodeDerIntegerOrThrow as j, decodeDerOctetString as M, decodeDerOctetStringOrThrow as N, decodeDerOid as P, decodeDerOidOrThrow as F, decodeDerString as I, decodeDerStringOrThrow as L, decodeDerTime as R, decodeDerTimeOrThrow as z, derChildren as B, derChildrenOrThrow as V, readDerElement as H, readDerElementOrThrow as U, readDerRoot as W, readDerRootOrThrow as G, readDerSequence as K, readDerSequenceOrThrow as q } from "./der/der.js";
|
|
4
|
+
export { e as DEFAULT_MAX_DER_DEPTH, t as assertDerMaxDepth, a as concatBytes, E as decodeDerBitString, D as decodeDerBitStringOrThrow, O as decodeDerBoolean, k as decodeDerBooleanOrThrow, A as decodeDerInteger, j as decodeDerIntegerOrThrow, M as decodeDerOctetString, N as decodeDerOctetStringOrThrow, P as decodeDerOid, F as decodeDerOidOrThrow, I as decodeDerString, L as decodeDerStringOrThrow, R as decodeDerTime, z as decodeDerTimeOrThrow, n as derBitString, r as derBmpString, i as derBoolean, B as derChildren, V as derChildrenOrThrow, o as derExplicitContext, s as derGeneralizedTime, c as derIa5String, l as derImplicitConstructedContext, u as derImplicitPrimitiveContext, d as derInteger, f as derIntegerFromNumber, p as derNull, h as derOctetString, m as derOid, g as derPrintableString, _ as derSequence, v as derSet, y as derTime, b as derTlv, x as derUniversalString, S as derUtcTime, C as derUtf8String, w as hexToBytes, H as readDerElement, U as readDerElementOrThrow, W as readDerRoot, G as readDerRootOrThrow, K as readDerSequence, q as readDerSequenceOrThrow, T as toHex };
|
package/dist/index.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ import { ConstrainedPolicy, PolicyValidationInput, PolicyValidationOutcome } fro
|
|
|
18
18
|
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";
|
|
19
19
|
import { CreateCsrInput, CsrMaterial, createCertificateSigningRequest } from "./x509/csr.js";
|
|
20
20
|
import { CertificateFingerprint, CertificateFingerprintAlgorithm, CertificateFingerprintSource, certificateFingerprint } from "./x509/fingerprint.js";
|
|
21
|
-
export { type AuthorityInformationAccess, 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 CreateCertificateInput, type CreateCertificateRevocationListInput, type CreateCsrInput, 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 CreateSelfSignedCertificateInput, type CrlApplicabilityFailureReason, type CrlCertificateSource, 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 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 NameFieldKey, type NameInput, type NameObject, type OcspCertStatus, type OcspCertificateSource, type OcspHashAlgorithm, type OcspRequestMaterial, type OcspRequestSource, type OcspResponderCandidate, type OcspResponderRevocationPolicy, type OcspResponderSource, type OcspResponseMaterial, type OcspResponseSource, type OcspResponseStatus, 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 ParsedCertificateRevocationList, type ParsedCertificateSigningRequest, type ParsedDistributionPoint, type ParsedDistributionPointName, type ParsedExtension, type ParsedIssuingDistributionPoint, type ParsedName, type ParsedNameAttribute, type ParsedNameConstraintForm, type ParsedOcspCertId, 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 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 ServiceIdentityInput, type ServiceIdentityType, type SplitPemBlocksResult, type SrvServiceIdentityInput, type SubjectAltName, 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 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, createCertificate, createCertificateRevocationList, createCertificateSigningRequest, createOcspRequest, createOcspResponse, createPfx, createPkcs7CertBag, createPkcs7SignedData, createSelfSignedCertificate, decodeExtension, decodeExtensionMap, decodeExtensions, decryptRsaOaep, decryptRsaOaepOrThrow, defineExtensionDecoder, defineExtensionDecoderMap, derivePublicKey, 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, isCertificateRevoked, isResultError, matchCertificatePrivateKey, matchCertificateServiceIdentity, matchServiceIdentity, parseCertificateChainPem, parseCertificateDer, parseCertificateDerOrThrow, parseCertificatePem, parseCertificatePemOrThrow, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, parseCertificateSigningRequestDer, parseCertificateSigningRequestDerOrThrow, parseCertificateSigningRequestPem, parseCertificateSigningRequestPemOrThrow, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, parsePfxDer, parsePfxPem, parsePkcs7CertBagDer, parsePkcs7CertBagPem, parsePkcs7SignedDataDer, parsePkcs7SignedDataPem, pemDecode, pemDecodeOrThrow, pemEncode, resolveOcspResponderCandidates, splitPemBlocks, splitPemBlocksOrThrow, trustAnchorFromCertificate, unwrap, unwrapOr, validateCandidatePath, validateCertificateRevocationList, validateForCa, validateForCodeSigning, validateForTlsClient, validateForTlsServer, validateOcspResponse, verifyCertificateChain, verifyCertificateRevocationListSignature, verifyCertificateSigningRequest, verifyOcspResponseSignature, verifyPkcs7SignedData };
|
|
21
|
+
import { SubjectAltNameTextOptions, distinguishedNameToString, relativeDistinguishedNameToString, subjectAltNameLabel, subjectAltNameToString } from "./x509/name-text.js";
|
|
22
|
+
export { type AuthorityInformationAccess, 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 CreateCertificateInput, type CreateCertificateRevocationListInput, type CreateCsrInput, 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 CreateSelfSignedCertificateInput, type CrlApplicabilityFailureReason, type CrlCertificateSource, 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 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 NameFieldKey, type NameInput, type NameObject, type OcspCertStatus, type OcspCertificateSource, type OcspHashAlgorithm, type OcspRequestMaterial, type OcspRequestSource, type OcspResponderCandidate, type OcspResponderRevocationPolicy, type OcspResponderSource, type OcspResponseMaterial, type OcspResponseSource, type OcspResponseStatus, 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 ParsedCertificateRevocationList, type ParsedCertificateSigningRequest, type ParsedDistributionPoint, type ParsedDistributionPointName, type ParsedExtension, type ParsedIssuingDistributionPoint, type ParsedName, type ParsedNameAttribute, type ParsedNameConstraintForm, type ParsedOcspCertId, 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 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 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 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, 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, isCertificateRevoked, isResultError, matchCertificatePrivateKey, matchCertificateServiceIdentity, matchServiceIdentity, parseCertificateChainPem, parseCertificateDer, parseCertificateDerOrThrow, parseCertificatePem, parseCertificatePemOrThrow, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, parseCertificateSigningRequestDer, parseCertificateSigningRequestDerOrThrow, parseCertificateSigningRequestPem, parseCertificateSigningRequestPemOrThrow, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, parsePfxDer, parsePfxPem, parsePkcs7CertBagDer, parsePkcs7CertBagPem, parsePkcs7SignedDataDer, parsePkcs7SignedDataPem, pemDecode, pemDecodeOrThrow, pemEncode, relativeDistinguishedNameToString, resolveOcspResponderCandidates, splitPemBlocks, splitPemBlocksOrThrow, subjectAltNameLabel, subjectAltNameToString, trustAnchorFromCertificate, unwrap, unwrapOr, validateCandidatePath, validateCertificateRevocationList, validateForCa, validateForCodeSigning, validateForTlsClient, validateForTlsServer, validateOcspResponse, verifyCertificateChain, verifyCertificateRevocationListSignature, verifyCertificateSigningRequest, verifyOcspResponseSignature, verifyPkcs7SignedData };
|
package/dist/index.js
CHANGED
|
@@ -13,4 +13,5 @@ import { REVOCATION_INDETERMINATE_REASON_CODES as xt, checkCertificateRevocation
|
|
|
13
13
|
import { createCertificate as Tt, createSelfSignedCertificate as Et } from "./x509/certificate.js";
|
|
14
14
|
import { createCertificateSigningRequest as Dt } from "./x509/csr.js";
|
|
15
15
|
import { certificateFingerprint as Ot } from "./x509/fingerprint.js";
|
|
16
|
-
|
|
16
|
+
import { distinguishedNameToString as kt, relativeDistinguishedNameToString as At, subjectAltNameLabel as jt, subjectAltNameToString as Mt } from "./x509/name-text.js";
|
|
17
|
+
export { yt as REVOCATION_INDETERMINATE_REASONS, xt as REVOCATION_INDETERMINATE_REASON_CODES, Ye as VERIFY_ERROR_CODES, Xe as buildCandidatePath, r as categorizePemBlocks, i as categorizePemBlocksOrThrow, Ot as certificateFingerprint, le as certificateMatchesPrivateKey, St as checkCertificateRevocation, Re as checkCertificateRevocationAgainstCrl, bt as checkChainRevocation, Ze as checkExtendedKeyUsage, Tt as createCertificate, ze as createCertificateRevocationList, Dt as createCertificateSigningRequest, ot as createOcspRequest, st as createOcspResponse, Oe as createPfx, je as createPkcs7CertBag, Me as createPkcs7SignedData, Et as createSelfSignedCertificate, ue as decodeExtension, de as decodeExtensionMap, fe as decodeExtensions, u as decryptRsaOaep, d as decryptRsaOaepOrThrow, pe as defineExtensionDecoder, me as defineExtensionDecoderMap, f as derivePublicKey, kt 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, he as findExtension, A as generateKeyPair, Ct as getCertificateOcspResponderUris, ge as getSubjectPublicKey, _e as getSubjectPublicKeyOrThrow, ct 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, Be as isCertificateRevoked, e as isResultError, ve as matchCertificatePrivateKey, qe as matchCertificateServiceIdentity, Je as matchServiceIdentity, ye as parseCertificateChainPem, be as parseCertificateDer, xe as parseCertificateDerOrThrow, Se as parseCertificatePem, Ce as parseCertificatePemOrThrow, Ve as parseCertificateRevocationListDer, He as parseCertificateRevocationListDerOrThrow, Ue as parseCertificateRevocationListPem, We as parseCertificateRevocationListPemOrThrow, we as parseCertificateSigningRequestDer, Te as parseCertificateSigningRequestDerOrThrow, Ee as parseCertificateSigningRequestPem, De as parseCertificateSigningRequestPemOrThrow, lt as parseOcspRequestDer, ut as parseOcspRequestDerOrThrow, dt as parseOcspRequestPem, ft as parseOcspRequestPemOrThrow, pt as parseOcspResponseDer, mt as parseOcspResponseDerOrThrow, ht as parseOcspResponsePem, gt as parseOcspResponsePemOrThrow, ke as parsePfxDer, Ae as parsePfxPem, Ne as parsePkcs7CertBagDer, Pe as parsePkcs7CertBagPem, Fe as parsePkcs7SignedDataDer, Ie as parsePkcs7SignedDataPem, a as pemDecode, o as pemDecodeOrThrow, s as pemEncode, At as relativeDistinguishedNameToString, wt as resolveOcspResponderCandidates, c as splitPemBlocks, l as splitPemBlocksOrThrow, jt as subjectAltNameLabel, Mt as subjectAltNameToString, Qe as trustAnchorFromCertificate, t as unwrap, n as unwrapOr, $e as validateCandidatePath, Ge as validateCertificateRevocationList, et as validateForCa, tt as validateForCodeSigning, nt as validateForTlsClient, rt as validateForTlsServer, _t as validateOcspResponse, it as verifyCertificateChain, Ke as verifyCertificateRevocationListSignature, at as verifyCertificateSigningRequest, vt as verifyOcspResponseSignature, Le as verifyPkcs7SignedData };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/internal/asn1/asn1.d.ts
|
|
2
|
+
/** Converts raw bytes to a lowercase hex string with no separator. */
|
|
3
|
+
declare function toHex(bytes: Uint8Array): string;
|
|
4
|
+
/** A BIT STRING payload and the number of unused trailing bits in its final byte. */
|
|
5
|
+
interface DerBitString {
|
|
6
|
+
/** Payload bytes, excluding the leading unused-bit count octet. */
|
|
7
|
+
readonly bytes: Uint8Array;
|
|
8
|
+
/** Unused trailing bits in the final byte, 0 through 7. */
|
|
9
|
+
readonly unusedBits: number;
|
|
10
|
+
/** `true` when the original encoding had non-zero padding bits (DER violation). */
|
|
11
|
+
readonly nonZeroPadding: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Converts a hex string (even or odd length) to a {@linkcode Uint8Array}.
|
|
15
|
+
* Odd-length strings are left-padded with a zero nibble.
|
|
16
|
+
*/
|
|
17
|
+
declare function hexToBytes(value: string): Uint8Array;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { DerBitString, hexToBytes, toHex };
|
|
20
|
+
//# sourceMappingURL=asn1.d.ts.map
|