micro509 0.7.1 → 0.8.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 +2 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +15 -1
- package/dist/internal/asn1/asn1.js +280 -2
- package/dist/internal/asn1/der.js +378 -2
- package/dist/internal/asn1/oids.js +103 -2
- package/dist/internal/crypto/algorithm-names.js +58 -2
- package/dist/internal/crypto/ecdsa.js +68 -2
- package/dist/internal/crypto/hash.js +286 -2
- package/dist/internal/crypto/pbes2.js +213 -2
- package/dist/internal/crypto/rsa-pss.js +184 -2
- package/dist/internal/crypto/sig-verify.js +192 -2
- package/dist/internal/crypto/signing.d.ts +1 -2
- package/dist/internal/crypto/signing.js +123 -2
- package/dist/internal/crypto/webcrypto.js +14 -2
- package/dist/internal/shared/base64.js +16 -2
- package/dist/internal/shared/dn.js +84 -2
- package/dist/internal/shared/ip.js +164 -2
- package/dist/internal/verify/name-constraints-engine.js +450 -2
- package/dist/internal/verify/policy-engine.js +382 -2
- package/dist/internal/verify/verify-path.js +298 -2
- package/dist/internal/x509/extension-bits.js +132 -2
- package/dist/internal/x509/extension-registry.js +229 -2
- package/dist/internal/x509/name-fields.js +93 -2
- package/dist/keys/keys.d.ts +231 -7
- package/dist/keys/keys.js +1087 -5
- package/dist/keys.d.ts +2 -2
- package/dist/keys.js +2 -1
- package/dist/pem/pem.d.ts +2 -2
- package/dist/pem/pem.js +172 -6
- package/dist/pem.js +2 -1
- package/dist/pkcs/pfx.d.ts +4 -5
- package/dist/pkcs/pfx.js +395 -2
- package/dist/pkcs/pkcs12-mac.d.ts +2 -2
- package/dist/pkcs/pkcs12-mac.js +175 -2
- package/dist/pkcs/pkcs7.d.ts +1 -2
- package/dist/pkcs/pkcs7.js +653 -2
- package/dist/pkcs.d.ts +2 -2
- package/dist/pkcs.js +4 -1
- package/dist/result/result.d.ts +1 -2
- package/dist/result/result.js +111 -2
- package/dist/result.js +2 -1
- package/dist/revocation/chain.d.ts +4 -5
- package/dist/revocation/chain.js +536 -2
- package/dist/revocation/crl.d.ts +2 -2
- package/dist/revocation/crl.js +1119 -2
- package/dist/revocation/ocsp.d.ts +3 -2
- package/dist/revocation/ocsp.js +958 -2
- package/dist/revocation/revocation.d.ts +1 -2
- package/dist/revocation/revocation.js +261 -2
- package/dist/revocation.d.ts +2 -2
- package/dist/revocation.js +5 -1
- package/dist/verify/identity.d.ts +1 -2
- package/dist/verify/identity.js +270 -2
- package/dist/verify/name-constraints.d.ts +1 -2
- package/dist/verify/policy.d.ts +1 -2
- package/dist/verify/verify.d.ts +1 -2
- package/dist/verify/verify.js +764 -2
- package/dist/verify.js +3 -1
- package/dist/x509/certificate.d.ts +1 -2
- package/dist/x509/certificate.js +151 -2
- package/dist/x509/csr.d.ts +1 -2
- package/dist/x509/csr.js +71 -2
- package/dist/x509/extensions.d.ts +1 -2
- package/dist/x509/extensions.js +387 -2
- package/dist/x509/name.d.ts +1 -2
- package/dist/x509/name.js +173 -2
- package/dist/x509/parse.d.ts +84 -2
- package/dist/x509/parse.js +1090 -2
- package/dist/x509.d.ts +2 -2
- package/dist/x509.js +6 -1
- package/package.json +74 -34
- package/dist/internal/asn1/asn1.js.map +0 -1
- package/dist/internal/asn1/der.js.map +0 -1
- package/dist/internal/asn1/oids.js.map +0 -1
- package/dist/internal/crypto/algorithm-names.js.map +0 -1
- package/dist/internal/crypto/ecdsa.js.map +0 -1
- package/dist/internal/crypto/hash.js.map +0 -1
- package/dist/internal/crypto/pbes2.d.ts +0 -23
- package/dist/internal/crypto/pbes2.js.map +0 -1
- package/dist/internal/crypto/rsa-pss.js.map +0 -1
- package/dist/internal/crypto/sig-verify.js.map +0 -1
- package/dist/internal/crypto/signing.js.map +0 -1
- package/dist/internal/crypto/webcrypto.js.map +0 -1
- package/dist/internal/shared/base64.js.map +0 -1
- package/dist/internal/shared/dn.js.map +0 -1
- package/dist/internal/shared/ip.js.map +0 -1
- package/dist/internal/verify/name-constraints-engine.js.map +0 -1
- package/dist/internal/verify/policy-engine.js.map +0 -1
- package/dist/internal/verify/verify-path.js.map +0 -1
- package/dist/internal/x509/extension-bits.js.map +0 -1
- package/dist/internal/x509/extension-registry.js.map +0 -1
- package/dist/internal/x509/name-fields.js.map +0 -1
- package/dist/keys/keys.js.map +0 -1
- package/dist/pem/pem.js.map +0 -1
- package/dist/pkcs/pfx.js.map +0 -1
- package/dist/pkcs/pkcs12-mac.js.map +0 -1
- package/dist/pkcs/pkcs7.js.map +0 -1
- package/dist/result/result.js.map +0 -1
- package/dist/revocation/chain.js.map +0 -1
- package/dist/revocation/crl.js.map +0 -1
- package/dist/revocation/ocsp.js.map +0 -1
- package/dist/revocation/revocation.js.map +0 -1
- package/dist/verify/identity.js.map +0 -1
- package/dist/verify/verify.js.map +0 -1
- package/dist/x509/certificate.js.map +0 -1
- package/dist/x509/csr.js.map +0 -1
- package/dist/x509/extensions.js.map +0 -1
- package/dist/x509/name.js.map +0 -1
- package/dist/x509/parse.js.map +0 -1
package/dist/pkcs/pfx.js
CHANGED
|
@@ -1,2 +1,395 @@
|
|
|
1
|
-
import{explicitContext
|
|
2
|
-
|
|
1
|
+
import { explicitContext, integerFromNumber, objectIdentifier, octetString, readElement, readSequenceChildren, sequence, setOf, tlv } from "../internal/asn1/der.js";
|
|
2
|
+
import { childrenOf, decodeIntegerNumber, decodeObjectIdentifier, toHex } from "../internal/asn1/asn1.js";
|
|
3
|
+
import { OIDS } from "../internal/asn1/oids.js";
|
|
4
|
+
import { decryptPbes2, encryptPbes2, isWrongPasswordError } from "../internal/crypto/pbes2.js";
|
|
5
|
+
import { base64Encode } from "../internal/shared/base64.js";
|
|
6
|
+
import { failureResult } from "../result/result.js";
|
|
7
|
+
import { pemEncode, splitPemBlocksOrThrow } from "../pem/pem.js";
|
|
8
|
+
import { exportPkcs8Der } from "../keys/keys.js";
|
|
9
|
+
import { parseCertificateDerOrThrow } from "../x509/parse.js";
|
|
10
|
+
import { createPkcs12MacData, parsePkcs12MacData } from "./pkcs12-mac.js";
|
|
11
|
+
//#region src/pkcs/pfx.ts
|
|
12
|
+
/**
|
|
13
|
+
* PKCS#12/PFX container creation and parsing.
|
|
14
|
+
*
|
|
15
|
+
* Builds and decodes PFX archives containing certificate bags, private-key bags,
|
|
16
|
+
* optional PBES2 encryption, and PKCS#12 MAC integrity verification.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Builds a PKCS#12/PFX archive containing certificates and/or private keys.
|
|
22
|
+
*
|
|
23
|
+
* When `encryption` is provided, the key-bag ContentInfo is PBES2-encrypted.
|
|
24
|
+
* When `mac` is provided, a PKCS#12 MAC integrity block is appended.
|
|
25
|
+
*
|
|
26
|
+
* Returns a {@linkcode CreatePfxResult}: the container material on success, or a
|
|
27
|
+
* typed `invalid_certificate` failure when a certificate source is not a single
|
|
28
|
+
* PEM/DER certificate.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { createPfx, unwrap } from 'micro509';
|
|
33
|
+
*
|
|
34
|
+
* const result = await createPfx({
|
|
35
|
+
* certificates: [{ certificate: certPem }],
|
|
36
|
+
* privateKeys: [{ privateKey: keyPair.privateKey }],
|
|
37
|
+
* encryption: { password: 's3cret' },
|
|
38
|
+
* mac: { password: 's3cret' },
|
|
39
|
+
* });
|
|
40
|
+
* if (result.ok) {
|
|
41
|
+
* const pfx = result.value; // pfx.der, pfx.pem, pfx.base64
|
|
42
|
+
* }
|
|
43
|
+
* // or, when inputs are already validated: const pfx = unwrap(result);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
async function createPfx(input) {
|
|
47
|
+
const certificateBags = [];
|
|
48
|
+
const privateKeyBags = [];
|
|
49
|
+
for (const certificate of input.certificates ?? []) {
|
|
50
|
+
let certificateDer;
|
|
51
|
+
try {
|
|
52
|
+
certificateDer = normalizeCertificate(certificate.certificate);
|
|
53
|
+
} catch {
|
|
54
|
+
return pfxCreationFailure("invalid_certificate", "Each PFX certificate source must be a single PEM or DER certificate");
|
|
55
|
+
}
|
|
56
|
+
certificateBags.push(createCertificateBag(certificateDer, certificate.attributes));
|
|
57
|
+
}
|
|
58
|
+
for (const privateKey of input.privateKeys ?? []) privateKeyBags.push(createPrivateKeyBag(await normalizePrivateKey(privateKey.privateKey), privateKey.attributes));
|
|
59
|
+
const contentInfos = [];
|
|
60
|
+
if (certificateBags.length > 0) contentInfos.push(createDataContentInfo(sequence(certificateBags)));
|
|
61
|
+
if (privateKeyBags.length > 0) {
|
|
62
|
+
const safeContents = sequence(privateKeyBags);
|
|
63
|
+
contentInfos.push(input.encryption === void 0 ? createDataContentInfo(safeContents) : await createEncryptedDataContentInfo(safeContents, input.encryption));
|
|
64
|
+
}
|
|
65
|
+
const authenticatedSafe = sequence(contentInfos);
|
|
66
|
+
const macData = input.mac === void 0 ? void 0 : await createPkcs12MacData(authenticatedSafe, input.mac);
|
|
67
|
+
const der = sequence([
|
|
68
|
+
integerFromNumber(3),
|
|
69
|
+
createDataContentInfo(authenticatedSafe),
|
|
70
|
+
...macData === void 0 ? [] : [macData.der]
|
|
71
|
+
]);
|
|
72
|
+
return {
|
|
73
|
+
ok: true,
|
|
74
|
+
value: {
|
|
75
|
+
der,
|
|
76
|
+
pem: pemEncode("PKCS12", der),
|
|
77
|
+
base64: base64Encode(der)
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** Shorthand for constructing a PFX creation failure result. */
|
|
82
|
+
function pfxCreationFailure(code, message) {
|
|
83
|
+
return failureResult(code, message);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Decodes a DER-encoded PKCS#12/PFX container into its constituent bags.
|
|
87
|
+
*
|
|
88
|
+
* Returns a result union — check `ok` before accessing `value`.
|
|
89
|
+
* Encrypted containers require `options.password`. MAC verification uses
|
|
90
|
+
* `options.macPassword` (falls back to `options.password`).
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* import { parsePfxDer } from 'micro509';
|
|
95
|
+
*
|
|
96
|
+
* const result = await parsePfxDer(pfxBytes, { password: 's3cret' });
|
|
97
|
+
* if (result.ok) {
|
|
98
|
+
* console.log(result.value.certificates.length);
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
async function parsePfxDer(der, options) {
|
|
103
|
+
try {
|
|
104
|
+
const topLevel = readSequenceChildren(der, { maxDepth: 64 });
|
|
105
|
+
if (topLevel.length < 2 || topLevel.length > 3) return pfxFailure("malformed", "Malformed PFX structure");
|
|
106
|
+
const version = topLevel[0];
|
|
107
|
+
const authSafe = topLevel[1];
|
|
108
|
+
if (version === void 0 || authSafe === void 0 || version.tag !== 2) return pfxFailure("malformed", "Malformed PFX structure");
|
|
109
|
+
if (decodeIntegerNumber(version.value) !== 3) return pfxFailure("malformed", "Unsupported PFX version");
|
|
110
|
+
const authenticatedSafeOctets = extractContentInfoData(der.slice(authSafe.start - authSafe.headerLength, authSafe.end));
|
|
111
|
+
const macElement = topLevel[2];
|
|
112
|
+
let macData;
|
|
113
|
+
if (macElement !== void 0) {
|
|
114
|
+
const macResult = await parsePkcs12MacData(der.slice(macElement.start - macElement.headerLength, macElement.end), authenticatedSafeOctets, options?.macPassword ?? options?.password);
|
|
115
|
+
if (!macResult.ok) return pfxFailure("malformed", "Malformed PFX MacData");
|
|
116
|
+
macData = macResult.value;
|
|
117
|
+
if (macData.verification === "invalid") return pfxFailure("invalid_password", "Invalid PFX MAC password or corrupted content");
|
|
118
|
+
}
|
|
119
|
+
const authenticatedSafe = readSequenceChildren(authenticatedSafeOctets);
|
|
120
|
+
const bags = [];
|
|
121
|
+
for (const contentInfo of authenticatedSafe) {
|
|
122
|
+
const safeContentsResult = await extractSafeContents(authenticatedSafeOctets.slice(contentInfo.start - contentInfo.headerLength, contentInfo.end), options);
|
|
123
|
+
if (safeContentsResult.error !== void 0) return safeContentsResult.error;
|
|
124
|
+
const safeContents = safeContentsResult.data;
|
|
125
|
+
for (const bag of readSequenceChildren(safeContents)) {
|
|
126
|
+
const bagDer = safeContents.slice(bag.start - bag.headerLength, bag.end);
|
|
127
|
+
bags.push(parseSafeBag(bagDer));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
ok: true,
|
|
132
|
+
value: {
|
|
133
|
+
bags,
|
|
134
|
+
certificates: bags.flatMap((bag) => bag.kind === "certificate" ? [bag.certificate] : []),
|
|
135
|
+
privateKeys: bags.flatMap((bag) => bag.kind === "privateKey" ? [bag.pkcs8Der] : []),
|
|
136
|
+
...macData === void 0 ? {} : { macData }
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
} catch {
|
|
140
|
+
return pfxFailure("malformed", "Malformed PFX structure");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Decodes a PEM-armored PKCS#12/PFX container. Expects exactly one `PKCS12` block.
|
|
145
|
+
*
|
|
146
|
+
* Delegates to {@linkcode parsePfxDer} after PEM decoding.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* import { parsePfxPem } from 'micro509';
|
|
151
|
+
*
|
|
152
|
+
* const result = await parsePfxPem(pfxPemString, { password: 's3cret' });
|
|
153
|
+
* if (result.ok) {
|
|
154
|
+
* console.log(result.value.privateKeys.length);
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
function parsePfxPem(pem, options) {
|
|
159
|
+
let bytes;
|
|
160
|
+
try {
|
|
161
|
+
const blocks = splitPemBlocksOrThrow(pem).filter((block) => block.label === "PKCS12");
|
|
162
|
+
const block = blocks[0];
|
|
163
|
+
if (block === void 0 || blocks.length !== 1) return Promise.resolve(pfxFailure("malformed", "Expected exactly one PKCS12 PEM block"));
|
|
164
|
+
bytes = block.bytes;
|
|
165
|
+
} catch {
|
|
166
|
+
return Promise.resolve(pfxFailure("malformed", "Expected exactly one PKCS12 PEM block"));
|
|
167
|
+
}
|
|
168
|
+
return parsePfxDer(bytes, options);
|
|
169
|
+
}
|
|
170
|
+
/** Shorthand for constructing a PFX parse failure result. */
|
|
171
|
+
function pfxFailure(code, message) {
|
|
172
|
+
return failureResult(code, message);
|
|
173
|
+
}
|
|
174
|
+
/** Unwraps a `data` ContentInfo to its inner OCTET STRING payload. */
|
|
175
|
+
function extractContentInfoData(contentInfoDer) {
|
|
176
|
+
const contentInfoChildren = readSequenceChildren(contentInfoDer);
|
|
177
|
+
const contentType = contentInfoChildren[0];
|
|
178
|
+
const content = contentInfoChildren[1];
|
|
179
|
+
if (contentType === void 0 || content === void 0 || contentInfoChildren.length !== 2 || contentType.tag !== 6) throw new Error("Malformed ContentInfo");
|
|
180
|
+
if (decodeObjectIdentifier(contentType.value) !== OIDS.pkcs7Data) throw new Error("Only passwordless data ContentInfo is supported");
|
|
181
|
+
return extractContextOctetString(contentInfoDer, content);
|
|
182
|
+
}
|
|
183
|
+
/** Extracts SafeContents bytes from a ContentInfo, decrypting if EncryptedData. */
|
|
184
|
+
async function extractSafeContents(contentInfoDer, options) {
|
|
185
|
+
const contentInfoChildren = readSequenceChildren(contentInfoDer);
|
|
186
|
+
const contentType = contentInfoChildren[0];
|
|
187
|
+
const content = contentInfoChildren[1];
|
|
188
|
+
if (contentType === void 0 || content === void 0 || contentInfoChildren.length !== 2 || contentType.tag !== 6) return { error: pfxFailure("malformed", "Malformed ContentInfo") };
|
|
189
|
+
const oid = decodeObjectIdentifier(contentType.value);
|
|
190
|
+
if (oid === OIDS.pkcs7Data) return { data: extractContextOctetString(contentInfoDer, content) };
|
|
191
|
+
if (oid !== OIDS.pkcs7EncryptedData) return { error: pfxFailure("malformed", "Unsupported PFX ContentInfo type") };
|
|
192
|
+
if (options?.password === void 0) return { error: pfxFailure("password_required", "Password required for encrypted PFX content") };
|
|
193
|
+
const encryptedData = extractContextChild(contentInfoDer, content);
|
|
194
|
+
let decrypted;
|
|
195
|
+
try {
|
|
196
|
+
decrypted = await decryptEncryptedData(contentInfoDer.slice(encryptedData.start - encryptedData.headerLength, encryptedData.end), options.password);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
if (isWrongPasswordError(error)) return { error: pfxFailure("invalid_password", "Invalid PFX password or encrypted content") };
|
|
199
|
+
return { error: pfxFailure("malformed", "Malformed PFX encrypted content") };
|
|
200
|
+
}
|
|
201
|
+
try {
|
|
202
|
+
readSequenceChildren(decrypted);
|
|
203
|
+
} catch {
|
|
204
|
+
return { error: pfxFailure("invalid_password", "Invalid PFX password or encrypted content") };
|
|
205
|
+
}
|
|
206
|
+
return { data: decrypted };
|
|
207
|
+
}
|
|
208
|
+
/** Encodes a certBag SafeBag wrapping a DER certificate with optional attributes. */
|
|
209
|
+
function createCertificateBag(certificateDer, attributes) {
|
|
210
|
+
const certBag = sequence([objectIdentifier(OIDS.x509CertificateBagType), explicitContext(0, octetString(certificateDer))]);
|
|
211
|
+
return sequence([
|
|
212
|
+
objectIdentifier(OIDS.pkcs12CertBag),
|
|
213
|
+
explicitContext(0, certBag),
|
|
214
|
+
...encodeBagAttributes(attributes)
|
|
215
|
+
]);
|
|
216
|
+
}
|
|
217
|
+
/** Encodes a keyBag SafeBag wrapping PKCS#8 DER with optional attributes. */
|
|
218
|
+
function createPrivateKeyBag(pkcs8Der, attributes) {
|
|
219
|
+
return sequence([
|
|
220
|
+
objectIdentifier(OIDS.pkcs12KeyBag),
|
|
221
|
+
explicitContext(0, pkcs8Der),
|
|
222
|
+
...encodeBagAttributes(attributes)
|
|
223
|
+
]);
|
|
224
|
+
}
|
|
225
|
+
/** Wraps raw bytes in a `pkcs7-data` ContentInfo SEQUENCE. */
|
|
226
|
+
function createDataContentInfo(data) {
|
|
227
|
+
return sequence([objectIdentifier(OIDS.pkcs7Data), explicitContext(0, octetString(data))]);
|
|
228
|
+
}
|
|
229
|
+
/** PBES2-encrypts data and wraps it in a `pkcs7-encryptedData` ContentInfo. */
|
|
230
|
+
async function createEncryptedDataContentInfo(data, options) {
|
|
231
|
+
const encryption = await encryptPbes2(data, options);
|
|
232
|
+
const encryptedData = sequence([integerFromNumber(0), sequence([
|
|
233
|
+
objectIdentifier(OIDS.pkcs7Data),
|
|
234
|
+
encryption.algorithmIdentifierDer,
|
|
235
|
+
tlv(128, encryption.encryptedData)
|
|
236
|
+
])]);
|
|
237
|
+
return sequence([objectIdentifier(OIDS.pkcs7EncryptedData), explicitContext(0, encryptedData)]);
|
|
238
|
+
}
|
|
239
|
+
/** DER-encodes optional friendlyName / localKeyId into a SET OF SEQUENCE. */
|
|
240
|
+
function encodeBagAttributes(attributes) {
|
|
241
|
+
if (attributes === void 0) return [];
|
|
242
|
+
const out = [];
|
|
243
|
+
if (attributes.friendlyName !== void 0) out.push(sequence([objectIdentifier(OIDS.friendlyName), setOf([bmpString(attributes.friendlyName)])]));
|
|
244
|
+
if (attributes.localKeyId !== void 0) out.push(sequence([objectIdentifier(OIDS.localKeyId), setOf([octetString(attributes.localKeyId)])]));
|
|
245
|
+
return out.length === 0 ? [] : [setOf(out)];
|
|
246
|
+
}
|
|
247
|
+
/** Decodes a single SafeBag from DER into a {@linkcode ParsedPfxBag} discriminated union. */
|
|
248
|
+
function parseSafeBag(der) {
|
|
249
|
+
const children = readSequenceChildren(der);
|
|
250
|
+
const bagId = children[0];
|
|
251
|
+
const bagValue = children[1];
|
|
252
|
+
const attributeSet = children[2];
|
|
253
|
+
if (bagId === void 0 || bagValue === void 0 || children.length > 3) throw new Error("Malformed SafeBag");
|
|
254
|
+
const bagOid = decodeObjectIdentifier(bagId.value);
|
|
255
|
+
const attributes = parseBagAttributes(der, attributeSet);
|
|
256
|
+
if (bagOid === OIDS.pkcs12CertBag) {
|
|
257
|
+
const certBag = extractContextChild(der, bagValue);
|
|
258
|
+
const certBagDer = der.slice(certBag.start - certBag.headerLength, certBag.end);
|
|
259
|
+
const certBagChildren = readSequenceChildren(certBagDer);
|
|
260
|
+
const certType = certBagChildren[0];
|
|
261
|
+
const certValue = certBagChildren[1];
|
|
262
|
+
if (certType === void 0 || certValue === void 0 || certBagChildren.length !== 2 || decodeObjectIdentifier(certType.value) !== OIDS.x509CertificateBagType) throw new Error("Malformed certBag");
|
|
263
|
+
return {
|
|
264
|
+
kind: "certificate",
|
|
265
|
+
bagId: bagOid,
|
|
266
|
+
attributes,
|
|
267
|
+
certificate: parseCertificateDerOrThrow(extractContextOctetString(certBagDer, certValue))
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
if (bagOid === OIDS.pkcs12KeyBag) {
|
|
271
|
+
const pkcs8 = extractContextChild(der, bagValue);
|
|
272
|
+
return {
|
|
273
|
+
kind: "privateKey",
|
|
274
|
+
bagId: bagOid,
|
|
275
|
+
attributes,
|
|
276
|
+
pkcs8Der: der.slice(pkcs8.start - pkcs8.headerLength, pkcs8.end)
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
const value = extractContextChild(der, bagValue);
|
|
280
|
+
return {
|
|
281
|
+
kind: "unknown",
|
|
282
|
+
bagId: bagOid,
|
|
283
|
+
attributes,
|
|
284
|
+
valueDer: der.slice(value.start - value.headerLength, value.end)
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/** Decodes the SET OF attributes attached to a SafeBag. */
|
|
288
|
+
function parseBagAttributes(source, attributeSet) {
|
|
289
|
+
if (attributeSet === void 0) return { entries: [] };
|
|
290
|
+
const entries = [];
|
|
291
|
+
let friendlyName;
|
|
292
|
+
let localKeyId;
|
|
293
|
+
for (const attribute of childrenOf(source, attributeSet)) {
|
|
294
|
+
const attributeDer = source.slice(attribute.start - attribute.headerLength, attribute.end);
|
|
295
|
+
const parts = readSequenceChildren(attributeDer);
|
|
296
|
+
const oid = parts[0];
|
|
297
|
+
const values = parts[1];
|
|
298
|
+
if (oid === void 0 || values === void 0 || parts.length !== 2 || values.tag !== 49) throw new Error("Malformed PFX bag attribute");
|
|
299
|
+
const attrOid = decodeObjectIdentifier(oid.value);
|
|
300
|
+
const rawValues = childrenOf(attributeDer, values).map((value) => attributeDer.slice(value.start - value.headerLength, value.end));
|
|
301
|
+
entries.push({
|
|
302
|
+
oid: attrOid,
|
|
303
|
+
valuesHex: rawValues.map((value) => toHex(value))
|
|
304
|
+
});
|
|
305
|
+
if (attrOid === OIDS.friendlyName) {
|
|
306
|
+
const firstValue = rawValues[0];
|
|
307
|
+
if (friendlyName !== void 0 || rawValues.length !== 1 || firstValue === void 0) throw new Error("Malformed friendlyName attribute");
|
|
308
|
+
friendlyName = decodeBmpString(firstValue);
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (attrOid === OIDS.localKeyId) {
|
|
312
|
+
const firstValue = rawValues[0];
|
|
313
|
+
if (localKeyId !== void 0 || rawValues.length !== 1 || firstValue === void 0) throw new Error("Malformed localKeyId attribute");
|
|
314
|
+
localKeyId = decodeLocalKeyId(firstValue);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
entries,
|
|
319
|
+
...friendlyName === void 0 ? {} : { friendlyName },
|
|
320
|
+
...localKeyId === void 0 ? {} : { localKeyId }
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function decodeLocalKeyId(der) {
|
|
324
|
+
const element = readElement(der);
|
|
325
|
+
if (element.tag !== 4) throw new Error("localKeyId must use OCTET STRING");
|
|
326
|
+
return toHex(element.value);
|
|
327
|
+
}
|
|
328
|
+
/** Exports a `CryptoKey` to PKCS#8 DER, or passes raw bytes through. */
|
|
329
|
+
function normalizePrivateKey(source) {
|
|
330
|
+
return source instanceof CryptoKey ? exportPkcs8Der(source) : Promise.resolve(new Uint8Array(source));
|
|
331
|
+
}
|
|
332
|
+
/** Extracts DER bytes from a PEM string, or passes raw DER through. */
|
|
333
|
+
function normalizeCertificate(source) {
|
|
334
|
+
if (typeof source === "string") {
|
|
335
|
+
const block = splitPemBlocksOrThrow(source).find((candidate) => candidate.label === "CERTIFICATE");
|
|
336
|
+
if (block === void 0) throw new Error("Certificate PEM required");
|
|
337
|
+
return new Uint8Array(block.bytes);
|
|
338
|
+
}
|
|
339
|
+
if (source instanceof Uint8Array) return new Uint8Array(source);
|
|
340
|
+
return new Uint8Array(source.der);
|
|
341
|
+
}
|
|
342
|
+
/** Decrypts a PKCS#7 EncryptedData structure using PBES2 with the given password. */
|
|
343
|
+
function decryptEncryptedData(encryptedDataDer, password) {
|
|
344
|
+
const topLevel = readSequenceChildren(encryptedDataDer);
|
|
345
|
+
const encryptedContentInfo = topLevel[1];
|
|
346
|
+
if (topLevel.length !== 2 || encryptedContentInfo === void 0) throw new Error("Malformed EncryptedData");
|
|
347
|
+
const version = topLevel[0];
|
|
348
|
+
if (version === void 0 || version.tag !== 2 || decodeIntegerNumber(version.value) !== 0) throw new Error("Malformed EncryptedData");
|
|
349
|
+
const contentInfoDer = encryptedDataDer.slice(encryptedContentInfo.start - encryptedContentInfo.headerLength, encryptedContentInfo.end);
|
|
350
|
+
const contentInfoChildren = readSequenceChildren(contentInfoDer);
|
|
351
|
+
const algorithm = contentInfoChildren[1];
|
|
352
|
+
const encryptedContent = contentInfoChildren[2];
|
|
353
|
+
if (algorithm === void 0 || encryptedContent === void 0 || contentInfoChildren.length !== 3 || contentInfoChildren[0]?.tag !== 6) throw new Error("Malformed EncryptedContentInfo");
|
|
354
|
+
if (encryptedContent.tag !== 128) throw new Error("Malformed encrypted content");
|
|
355
|
+
return decryptPbes2(contentInfoDer.slice(algorithm.start - algorithm.headerLength, algorithm.end), encryptedContent.value, password);
|
|
356
|
+
}
|
|
357
|
+
/** Reads the first child of a context-tagged element, expecting an OCTET STRING. */
|
|
358
|
+
function extractContextOctetString(source, element) {
|
|
359
|
+
const child = extractContextChild(source, element);
|
|
360
|
+
if (child.tag !== 4) throw new Error("Expected OCTET STRING in context value");
|
|
361
|
+
return child.value;
|
|
362
|
+
}
|
|
363
|
+
/** Reads the first child element inside a context-specific constructed wrapper. */
|
|
364
|
+
function extractContextChild(source, element) {
|
|
365
|
+
if ((element.tag & 224) !== 160) throw new Error("Expected context-specific constructed value");
|
|
366
|
+
const children = childrenOf(source, element);
|
|
367
|
+
const child = children[0];
|
|
368
|
+
if (children.length !== 1 || child === void 0) throw new Error("Expected context-specific wrapper with exactly one value");
|
|
369
|
+
return child;
|
|
370
|
+
}
|
|
371
|
+
/** Encodes a JS string as an ASN.1 BMPString (UCS-2 big-endian, tag 0x1e). */
|
|
372
|
+
function bmpString(value) {
|
|
373
|
+
const bytes = new Uint8Array(value.length * 2);
|
|
374
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
375
|
+
const codePoint = value.charCodeAt(index);
|
|
376
|
+
bytes[index * 2] = codePoint >> 8;
|
|
377
|
+
bytes[index * 2 + 1] = codePoint & 255;
|
|
378
|
+
}
|
|
379
|
+
return tlv(30, bytes);
|
|
380
|
+
}
|
|
381
|
+
/** Decodes a DER-encoded BMPString (tag 0x1e) back to a JS string. */
|
|
382
|
+
function decodeBmpString(der) {
|
|
383
|
+
const element = readElement(der);
|
|
384
|
+
if (element.tag !== 30) throw new Error("Expected BMPString");
|
|
385
|
+
if (element.value.length % 2 !== 0) throw new Error("BMPString must use an even number of bytes");
|
|
386
|
+
let value = "";
|
|
387
|
+
for (let index = 0; index < element.value.length; index += 2) {
|
|
388
|
+
const left = element.value[index] ?? 0;
|
|
389
|
+
const right = element.value[index + 1] ?? 0;
|
|
390
|
+
value += String.fromCharCode(left << 8 | right);
|
|
391
|
+
}
|
|
392
|
+
return value;
|
|
393
|
+
}
|
|
394
|
+
//#endregion
|
|
395
|
+
export { createPfx, parsePfxDer, parsePfxPem };
|
|
@@ -40,6 +40,7 @@ declare function createPkcs12MacData(authenticatedSafe: Uint8Array, options: Pkc
|
|
|
40
40
|
type ParsePkcs12MacDataErrorCode = "malformed";
|
|
41
41
|
/** Structured failure payload for MacData parsing. */
|
|
42
42
|
interface ParsePkcs12MacDataFailure extends Micro509Error<ParsePkcs12MacDataErrorCode> {
|
|
43
|
+
/** Always `false` for failures. */
|
|
43
44
|
readonly ok: false;
|
|
44
45
|
}
|
|
45
46
|
/** Success-or-failure result from {@linkcode parsePkcs12MacData}. */
|
|
@@ -61,5 +62,4 @@ declare function parsePkcs12MacDataOrThrow(der: Uint8Array, authenticatedSafe: U
|
|
|
61
62
|
*/
|
|
62
63
|
declare function parsePkcs12MacData(der: Uint8Array, authenticatedSafe: Uint8Array, password?: string): Promise<ParsePkcs12MacDataResult>;
|
|
63
64
|
//#endregion
|
|
64
|
-
export { ParsePkcs12MacDataErrorCode, ParsePkcs12MacDataFailure, ParsePkcs12MacDataResult, ParsedPkcs12MacData, Pkcs12MacOptions, createPkcs12MacData, parsePkcs12MacData, parsePkcs12MacDataOrThrow };
|
|
65
|
-
//# sourceMappingURL=pkcs12-mac.d.ts.map
|
|
65
|
+
export { ParsePkcs12MacDataErrorCode, ParsePkcs12MacDataFailure, ParsePkcs12MacDataResult, ParsedPkcs12MacData, Pkcs12MacOptions, createPkcs12MacData, parsePkcs12MacData, parsePkcs12MacDataOrThrow };
|
package/dist/pkcs/pkcs12-mac.js
CHANGED
|
@@ -1,2 +1,175 @@
|
|
|
1
|
-
import{concatBytes
|
|
2
|
-
|
|
1
|
+
import { concatBytes, integerFromNumber, nullValue, objectIdentifier, octetString, readSequenceChildren, sequence } from "../internal/asn1/der.js";
|
|
2
|
+
import { decodeNonNegativeIntegerNumber, decodeObjectIdentifier, toArrayBuffer, toHex } from "../internal/asn1/asn1.js";
|
|
3
|
+
import { OIDS } from "../internal/asn1/oids.js";
|
|
4
|
+
import { getCrypto } from "../internal/crypto/webcrypto.js";
|
|
5
|
+
import { failureResult, rethrowIfInvariant, successResult } from "../result/result.js";
|
|
6
|
+
import { describeHashAlgorithm } from "../internal/crypto/algorithm-names.js";
|
|
7
|
+
//#region src/pkcs/pkcs12-mac.ts
|
|
8
|
+
/**
|
|
9
|
+
* PKCS#12 MAC data creation and verification.
|
|
10
|
+
*
|
|
11
|
+
* Computes and verifies the password-based HMAC-SHA-256 integrity check
|
|
12
|
+
* defined in PKCS#12 (RFC 7292), using the PKCS#12 key-derivation scheme.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Computes a PKCS#12 HMAC-SHA-256 MAC over the AuthenticatedSafe and returns
|
|
18
|
+
* the DER-encoded MacData block alongside its parsed representation.
|
|
19
|
+
*/
|
|
20
|
+
async function createPkcs12MacData(authenticatedSafe, options) {
|
|
21
|
+
const iterations = options.iterations ?? 2048;
|
|
22
|
+
assertPkcs12MacIterations(iterations);
|
|
23
|
+
const salt = options.salt ?? getCrypto().getRandomValues(/* @__PURE__ */ new Uint8Array(16));
|
|
24
|
+
const mac = await computePkcs12Mac(authenticatedSafe, options.password, salt, iterations);
|
|
25
|
+
return {
|
|
26
|
+
der: sequence([
|
|
27
|
+
sequence([sequence([objectIdentifier(OIDS.sha256), nullValue()]), octetString(mac)]),
|
|
28
|
+
octetString(salt),
|
|
29
|
+
integerFromNumber(iterations)
|
|
30
|
+
]),
|
|
31
|
+
parsed: {
|
|
32
|
+
digestAlgorithmOid: OIDS.sha256,
|
|
33
|
+
digestAlgorithmName: describeHashAlgorithm(OIDS.sha256),
|
|
34
|
+
digestHex: toHex(mac),
|
|
35
|
+
saltHex: toHex(salt),
|
|
36
|
+
iterations,
|
|
37
|
+
verification: "valid"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Throwing core for {@linkcode parsePkcs12MacData}. When `password` is
|
|
43
|
+
* provided, verifies the MAC and reports the outcome in `verification`.
|
|
44
|
+
*/
|
|
45
|
+
async function parsePkcs12MacDataOrThrow(der, authenticatedSafe, password) {
|
|
46
|
+
const top = readSequenceChildren(der);
|
|
47
|
+
const digestInfo = top[0];
|
|
48
|
+
const salt = top[1];
|
|
49
|
+
const iterations = top[2];
|
|
50
|
+
if (top.length !== 3 || digestInfo === void 0 || salt === void 0 || iterations === void 0 || salt.tag !== 4) throw new Error("Malformed MacData");
|
|
51
|
+
const digestInfoDer = der.slice(digestInfo.start - digestInfo.headerLength, digestInfo.end);
|
|
52
|
+
const digestInfoChildren = readSequenceChildren(digestInfoDer);
|
|
53
|
+
const algorithm = digestInfoChildren[0];
|
|
54
|
+
const digest = digestInfoChildren[1];
|
|
55
|
+
if (digestInfoChildren.length !== 2 || algorithm === void 0 || digest === void 0 || digest.tag !== 4) throw new Error("Malformed DigestInfo");
|
|
56
|
+
const algorithmChildren = readSequenceChildren(digestInfoDer.slice(algorithm.start - algorithm.headerLength, algorithm.end));
|
|
57
|
+
const algorithmOid = algorithmChildren[0];
|
|
58
|
+
if (algorithmOid === void 0 || algorithmChildren.length !== 1 && algorithmChildren.length !== 2) throw new Error("MacData algorithm missing");
|
|
59
|
+
const digestAlgorithmOid = decodeObjectIdentifier(algorithmOid.value);
|
|
60
|
+
if (digestAlgorithmOid !== OIDS.sha256) throw new Error("Only SHA-256 PKCS#12 MAC is supported");
|
|
61
|
+
const parsedIterations = decodeNonNegativeIntegerNumber(iterations.value, "MacData iterations");
|
|
62
|
+
assertPkcs12MacIterations(parsedIterations);
|
|
63
|
+
if (password === void 0) return {
|
|
64
|
+
digestAlgorithmOid,
|
|
65
|
+
digestAlgorithmName: describeHashAlgorithm(digestAlgorithmOid),
|
|
66
|
+
digestHex: toHex(digest.value),
|
|
67
|
+
saltHex: toHex(salt.value),
|
|
68
|
+
iterations: parsedIterations,
|
|
69
|
+
verification: "unchecked"
|
|
70
|
+
};
|
|
71
|
+
const expected = await computePkcs12Mac(authenticatedSafe, password, salt.value, parsedIterations);
|
|
72
|
+
return {
|
|
73
|
+
digestAlgorithmOid,
|
|
74
|
+
digestAlgorithmName: describeHashAlgorithm(digestAlgorithmOid),
|
|
75
|
+
digestHex: toHex(digest.value),
|
|
76
|
+
saltHex: toHex(salt.value),
|
|
77
|
+
iterations: parsedIterations,
|
|
78
|
+
verification: equalBytes(expected, digest.value) ? "valid" : "invalid"
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Decodes a DER-encoded MacData block. When `password` is provided, verifies
|
|
83
|
+
* the MAC and reports the outcome in `verification`.
|
|
84
|
+
*
|
|
85
|
+
* Returns a typed failure (`code: 'malformed'`) on malformed input. For the
|
|
86
|
+
* throwing form use {@linkcode parsePkcs12MacDataOrThrow}.
|
|
87
|
+
*/
|
|
88
|
+
async function parsePkcs12MacData(der, authenticatedSafe, password) {
|
|
89
|
+
try {
|
|
90
|
+
return successResult(await parsePkcs12MacDataOrThrow(der, authenticatedSafe, password));
|
|
91
|
+
} catch (error) {
|
|
92
|
+
rethrowIfInvariant(error);
|
|
93
|
+
return failureResult("malformed", error instanceof Error ? error.message : "Malformed MacData");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function assertPkcs12MacIterations(iterations) {
|
|
97
|
+
if (!Number.isSafeInteger(iterations) || iterations <= 0) throw new Error("MacData iterations must be a positive safe integer");
|
|
98
|
+
}
|
|
99
|
+
/** Derives an HMAC-SHA-256 key via the PKCS#12 KDF and signs the AuthenticatedSafe. */
|
|
100
|
+
async function computePkcs12Mac(authenticatedSafe, password, salt, iterations) {
|
|
101
|
+
const keyBytes = await derivePkcs12Key(password, salt, iterations, 3, 32);
|
|
102
|
+
const key = await getCrypto().subtle.importKey("raw", toArrayBuffer(keyBytes), {
|
|
103
|
+
name: "HMAC",
|
|
104
|
+
hash: "SHA-256"
|
|
105
|
+
}, false, ["sign"]);
|
|
106
|
+
return new Uint8Array(await getCrypto().subtle.sign("HMAC", key, toArrayBuffer(authenticatedSafe)));
|
|
107
|
+
}
|
|
108
|
+
/** PKCS#12 key derivation (RFC 7292 Appendix B). `id` selects the purpose (3 = MAC key). */
|
|
109
|
+
async function derivePkcs12Key(password, salt, iterations, id, length) {
|
|
110
|
+
const u = 32;
|
|
111
|
+
const v = 64;
|
|
112
|
+
const D = new Uint8Array(v).fill(id);
|
|
113
|
+
const passwordBytes = encodePkcs12Password(password);
|
|
114
|
+
let I = concatBytes([repeatToMultiple(salt, v), repeatToMultiple(passwordBytes, v)]);
|
|
115
|
+
const blocks = Math.ceil(length / u);
|
|
116
|
+
const output = new Uint8Array(blocks * u);
|
|
117
|
+
for (let index = 0; index < blocks; index += 1) {
|
|
118
|
+
let A = await digestSha256(concatBytes([D, I]));
|
|
119
|
+
for (let round = 1; round < iterations; round += 1) A = await digestSha256(A);
|
|
120
|
+
output.set(A, index * u);
|
|
121
|
+
if (I.length === 0) continue;
|
|
122
|
+
const B = repeatToLength(A, v);
|
|
123
|
+
const next = new Uint8Array(I.length);
|
|
124
|
+
for (let blockIndex = 0; blockIndex < I.length / v; blockIndex += 1) {
|
|
125
|
+
const block = I.slice(blockIndex * v, blockIndex * v + v);
|
|
126
|
+
addBlockInPlace(block, B);
|
|
127
|
+
next.set(block, blockIndex * v);
|
|
128
|
+
}
|
|
129
|
+
I = next;
|
|
130
|
+
}
|
|
131
|
+
return output.slice(0, length);
|
|
132
|
+
}
|
|
133
|
+
/** SHA-256 hash via WebCrypto. */
|
|
134
|
+
async function digestSha256(bytes) {
|
|
135
|
+
return new Uint8Array(await getCrypto().subtle.digest("SHA-256", toArrayBuffer(bytes)));
|
|
136
|
+
}
|
|
137
|
+
/** Encodes a password as a null-terminated UCS-2 big-endian byte array (RFC 7292 B.1). */
|
|
138
|
+
function encodePkcs12Password(password) {
|
|
139
|
+
const out = new Uint8Array((password.length + 1) * 2);
|
|
140
|
+
for (let index = 0; index < password.length; index += 1) {
|
|
141
|
+
const code = password.charCodeAt(index);
|
|
142
|
+
out[index * 2] = code >> 8;
|
|
143
|
+
out[index * 2 + 1] = code & 255;
|
|
144
|
+
}
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
/** Repeats `bytes` to the nearest multiple of `size`. */
|
|
148
|
+
function repeatToMultiple(bytes, size) {
|
|
149
|
+
if (bytes.length === 0) return /* @__PURE__ */ new Uint8Array();
|
|
150
|
+
return repeatToLength(bytes, size * Math.ceil(bytes.length / size));
|
|
151
|
+
}
|
|
152
|
+
/** Cyclically repeats `bytes` to fill exactly `length` bytes. */
|
|
153
|
+
function repeatToLength(bytes, length) {
|
|
154
|
+
const out = new Uint8Array(length);
|
|
155
|
+
for (let index = 0; index < length; index += 1) out[index] = bytes[index % bytes.length] ?? 0;
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
/** Big-endian add-with-carry of `addend` into `block`, modifying `block` in place. */
|
|
159
|
+
function addBlockInPlace(block, addend) {
|
|
160
|
+
let carry = 1;
|
|
161
|
+
for (let index = block.length - 1; index >= 0; index -= 1) {
|
|
162
|
+
const sum = (block[index] ?? 0) + (addend[index] ?? 0) + carry;
|
|
163
|
+
block[index] = sum & 255;
|
|
164
|
+
carry = sum >> 8;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/** Constant-time byte comparison to avoid timing side-channels in MAC checks. */
|
|
168
|
+
function equalBytes(left, right) {
|
|
169
|
+
if (left.length !== right.length) return false;
|
|
170
|
+
let result = 0;
|
|
171
|
+
for (let index = 0; index < left.length; index += 1) result |= (left[index] ?? 0) ^ (right[index] ?? 0);
|
|
172
|
+
return result === 0;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { createPkcs12MacData, parsePkcs12MacData, parsePkcs12MacDataOrThrow };
|
package/dist/pkcs/pkcs7.d.ts
CHANGED
|
@@ -219,5 +219,4 @@ declare function parsePkcs7SignedDataPem(pem: string): ParsePkcs7SignedDataResul
|
|
|
219
219
|
*/
|
|
220
220
|
declare function verifyPkcs7SignedData(input: string | Uint8Array | ParsedPkcs7SignedData): Promise<VerifyPkcs7SignedDataResult>;
|
|
221
221
|
//#endregion
|
|
222
|
-
export { CreatePkcs7CertBagErrorCode, CreatePkcs7CertBagFailure, CreatePkcs7CertBagResult, CreatePkcs7SignedDataErrorCode, CreatePkcs7SignedDataFailure, CreatePkcs7SignedDataInput, CreatePkcs7SignedDataResult, ParsePkcs7CertBagResult, ParsePkcs7ErrorCode, ParsePkcs7Failure, ParsePkcs7SignedDataResult, ParsedPkcs7SignedData, ParsedPkcs7SignerInfo, Pkcs7CertBagMaterial, Pkcs7CertificateSource, Pkcs7SignedDataMaterial, Pkcs7Signer, VerifyPkcs7SignedDataFailure, VerifyPkcs7SignedDataResult, createPkcs7CertBag, createPkcs7SignedData, parsePkcs7CertBagDer, parsePkcs7CertBagPem, parsePkcs7SignedDataDer, parsePkcs7SignedDataPem, verifyPkcs7SignedData };
|
|
223
|
-
//# sourceMappingURL=pkcs7.d.ts.map
|
|
222
|
+
export { CreatePkcs7CertBagErrorCode, CreatePkcs7CertBagFailure, CreatePkcs7CertBagResult, CreatePkcs7SignedDataErrorCode, CreatePkcs7SignedDataFailure, CreatePkcs7SignedDataInput, CreatePkcs7SignedDataResult, ParsePkcs7CertBagResult, ParsePkcs7ErrorCode, ParsePkcs7Failure, ParsePkcs7SignedDataResult, ParsedPkcs7SignedData, ParsedPkcs7SignerInfo, ParsedPkcs7SignerInfoBase, Pkcs7CertBagMaterial, Pkcs7CertificateSource, Pkcs7SignedDataMaterial, Pkcs7Signer, VerifyPkcs7SignedDataFailure, VerifyPkcs7SignedDataResult, createPkcs7CertBag, createPkcs7SignedData, parsePkcs7CertBagDer, parsePkcs7CertBagPem, parsePkcs7SignedDataDer, parsePkcs7SignedDataPem, verifyPkcs7SignedData };
|