node-opcua-crypto 5.1.0 → 5.3.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/dist/chunk-7GWSCCWS.cjs +208 -0
- package/dist/chunk-7GWSCCWS.cjs.map +1 -0
- package/dist/{source/index.js → chunk-ERHE4VFS.cjs} +466 -484
- package/dist/chunk-ERHE4VFS.cjs.map +1 -0
- package/dist/{chunk-ULG5CYBT.mjs → chunk-KCVNMSLI.js} +330 -252
- package/dist/chunk-KCVNMSLI.js.map +1 -0
- package/dist/{chunk-UXPULF3W.mjs → chunk-QGNXSXUU.js} +42 -2
- package/dist/chunk-QGNXSXUU.js.map +1 -0
- package/dist/index.cjs +197 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +108 -6673
- package/dist/index.js.map +1 -1
- package/dist/source/index_web.cjs +155 -0
- package/dist/source/index_web.cjs.map +1 -0
- package/dist/source/{index_web.d.mts → index_web.d.cts} +184 -159
- package/dist/source/index_web.d.ts +183 -158
- package/dist/source/index_web.js +80 -6517
- package/dist/source/index_web.js.map +1 -1
- package/dist/source_nodejs/index.cjs +46 -0
- package/dist/source_nodejs/index.cjs.map +1 -0
- package/dist/source_nodejs/{index.d.mts → index.d.cts} +29 -2
- package/dist/source_nodejs/index.d.ts +28 -1
- package/dist/source_nodejs/index.js +31 -4141
- package/dist/source_nodejs/index.js.map +1 -1
- package/package.json +35 -16
- package/dist/chunk-RQA4DO2Z.mjs +0 -1
- package/dist/chunk-RQA4DO2Z.mjs.map +0 -1
- package/dist/chunk-ULG5CYBT.mjs.map +0 -1
- package/dist/chunk-UXPULF3W.mjs.map +0 -1
- package/dist/index.d.mts +0 -5
- package/dist/index.mjs +0 -184
- package/dist/index.mjs.map +0 -1
- package/dist/source/index.d.mts +0 -4
- package/dist/source/index.d.ts +0 -4
- package/dist/source/index.js.map +0 -1
- package/dist/source/index.mjs +0 -154
- package/dist/source/index.mjs.map +0 -1
- package/dist/source/index_web.mjs +0 -153
- package/dist/source/index_web.mjs.map +0 -1
- package/dist/source_nodejs/index.mjs +0 -35
- package/dist/source_nodejs/index.mjs.map +0 -1
- /package/dist/{common-DxHkx4Pv.d.mts → common-DxHkx4Pv.d.cts} +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
var _chunkERHE4VFScjs = require('../chunk-ERHE4VFS.cjs');
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
exports.CertificatePurpose = _chunkERHE4VFScjs.CertificatePurpose; exports.PaddingAlgorithm = _chunkERHE4VFScjs.PaddingAlgorithm; exports.RSA_PKCS1_OAEP_PADDING = _chunkERHE4VFScjs.RSA_PKCS1_OAEP_PADDING; exports.RSA_PKCS1_PADDING = _chunkERHE4VFScjs.RSA_PKCS1_PADDING; exports.Subject = _chunkERHE4VFScjs.Subject; exports._coercePrivateKey = _chunkERHE4VFScjs._coercePrivateKey; exports.asn1 = _chunkERHE4VFScjs.asn1; exports.certificateMatchesPrivateKey = _chunkERHE4VFScjs.certificateMatchesPrivateKey; exports.coerceCertificate = _chunkERHE4VFScjs.coerceCertificate; exports.coerceCertificatePem = _chunkERHE4VFScjs.coerceCertificatePem; exports.coercePEMorDerToPrivateKey = _chunkERHE4VFScjs.coercePEMorDerToPrivateKey; exports.coercePrivateKeyPem = _chunkERHE4VFScjs.coercePrivateKeyPem; exports.coercePublicKeyPem = _chunkERHE4VFScjs.coercePublicKeyPem; exports.coerceRsaPublicKeyPem = _chunkERHE4VFScjs.coerceRsaPublicKeyPem; exports.combine_der = _chunkERHE4VFScjs.combine_der; exports.computeDerivedKeys = _chunkERHE4VFScjs.computeDerivedKeys; exports.computePaddingFooter = _chunkERHE4VFScjs.computePaddingFooter; exports.convertPEMtoDER = _chunkERHE4VFScjs.convertPEMtoDER; exports.createCertificateSigningRequest = _chunkERHE4VFScjs.createCertificateSigningRequest; exports.createPrivateKeyFromNodeJSCrypto = _chunkERHE4VFScjs.createPrivateKeyFromNodeJSCrypto; exports.createSelfSignedCertificate = _chunkERHE4VFScjs.createSelfSignedCertificate; exports.decryptBufferWithDerivedKeys = _chunkERHE4VFScjs.decryptBufferWithDerivedKeys; exports.derToPrivateKey = _chunkERHE4VFScjs.derToPrivateKey; exports.encryptBufferWithDerivedKeys = _chunkERHE4VFScjs.encryptBufferWithDerivedKeys; exports.exploreAsn1 = _chunkERHE4VFScjs.exploreAsn1; exports.exploreCertificate = _chunkERHE4VFScjs.exploreCertificate; exports.exploreCertificateInfo = _chunkERHE4VFScjs.exploreCertificateInfo; exports.exploreCertificateRevocationList = _chunkERHE4VFScjs.exploreCertificateRevocationList; exports.exploreCertificateSigningRequest = _chunkERHE4VFScjs.exploreCertificateSigningRequest; exports.explorePrivateKey = _chunkERHE4VFScjs.explorePrivateKey; exports.extractPublicKeyFromCertificate = _chunkERHE4VFScjs.extractPublicKeyFromCertificate; exports.extractPublicKeyFromCertificateSync = _chunkERHE4VFScjs.extractPublicKeyFromCertificateSync; exports.generateKeyPair = _chunkERHE4VFScjs.generateKeyPair; exports.generatePrivateKey = _chunkERHE4VFScjs.generatePrivateKey; exports.hexDump = _chunkERHE4VFScjs.hexDump; exports.identifyDERContent = _chunkERHE4VFScjs.identifyDERContent; exports.identifyPemType = _chunkERHE4VFScjs.identifyPemType; exports.isCrlIssuedByCertificate = _chunkERHE4VFScjs.isCrlIssuedByCertificate; exports.isKeyObject = _chunkERHE4VFScjs.isKeyObject; exports.makeMessageChunkSignature = _chunkERHE4VFScjs.makeMessageChunkSignature; exports.makeMessageChunkSignatureWithDerivedKeys = _chunkERHE4VFScjs.makeMessageChunkSignatureWithDerivedKeys; exports.makePrivateKeyFromPem = _chunkERHE4VFScjs.makePrivateKeyFromPem; exports.makePrivateKeyThumbPrint = _chunkERHE4VFScjs.makePrivateKeyThumbPrint; exports.makePseudoRandomBuffer = _chunkERHE4VFScjs.makePseudoRandomBuffer; exports.makeSHA1Thumbprint = _chunkERHE4VFScjs.makeSHA1Thumbprint; exports.pemToPrivateKey = _chunkERHE4VFScjs.pemToPrivateKey; exports.privateDecrypt = _chunkERHE4VFScjs.privateDecrypt; exports.privateDecrypt_long = _chunkERHE4VFScjs.privateDecrypt_long; exports.privateDecrypt_native = _chunkERHE4VFScjs.privateDecrypt_native; exports.privateKeyToPEM = _chunkERHE4VFScjs.privateKeyToPEM; exports.publicEncrypt = _chunkERHE4VFScjs.publicEncrypt; exports.publicEncrypt_long = _chunkERHE4VFScjs.publicEncrypt_long; exports.publicEncrypt_native = _chunkERHE4VFScjs.publicEncrypt_native; exports.publicKeyAndPrivateKeyMatches = _chunkERHE4VFScjs.publicKeyAndPrivateKeyMatches; exports.readCertificationRequestInfo = _chunkERHE4VFScjs.readCertificationRequestInfo; exports.readExtension = _chunkERHE4VFScjs.readExtension; exports.readNameForCrl = _chunkERHE4VFScjs.readNameForCrl; exports.readTbsCertificate = _chunkERHE4VFScjs.readTbsCertificate; exports.reduceLength = _chunkERHE4VFScjs.reduceLength; exports.removePadding = _chunkERHE4VFScjs.removePadding; exports.removeTrailingLF = _chunkERHE4VFScjs.removeTrailingLF; exports.rsaLengthPrivateKey = _chunkERHE4VFScjs.rsaLengthPrivateKey; exports.rsaLengthPublicKey = _chunkERHE4VFScjs.rsaLengthPublicKey; exports.rsaLengthRsaPublicKey = _chunkERHE4VFScjs.rsaLengthRsaPublicKey; exports.split_der = _chunkERHE4VFScjs.split_der; exports.toPem = _chunkERHE4VFScjs.toPem; exports.toPem2 = _chunkERHE4VFScjs.toPem2; exports.verifyCertificateChain = _chunkERHE4VFScjs.verifyCertificateChain; exports.verifyCertificateOrClrSignature = _chunkERHE4VFScjs.verifyCertificateOrClrSignature; exports.verifyCertificateRevocationListSignature = _chunkERHE4VFScjs.verifyCertificateRevocationListSignature; exports.verifyCertificateSignature = _chunkERHE4VFScjs.verifyCertificateSignature; exports.verifyChunkSignature = _chunkERHE4VFScjs.verifyChunkSignature; exports.verifyChunkSignatureWithDerivedKeys = _chunkERHE4VFScjs.verifyChunkSignatureWithDerivedKeys; exports.verifyCrlIssuedByCertificate = _chunkERHE4VFScjs.verifyCrlIssuedByCertificate; exports.verifyMessageChunkSignature = _chunkERHE4VFScjs.verifyMessageChunkSignature;
|
|
155
|
+
//# sourceMappingURL=index_web.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/node-opcua-crypto/node-opcua-crypto/packages/node-opcua-crypto/dist/source/index_web.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,4uKAAC","file":"/home/runner/work/node-opcua-crypto/node-opcua-crypto/packages/node-opcua-crypto/dist/source/index_web.cjs"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as CertificateRevocationList, C as Certificate, d as CertificatePEM,
|
|
2
|
-
export { c as createPrivateKeyFromNodeJSCrypto, i as isKeyObject } from '../common-DxHkx4Pv.
|
|
3
|
-
import { KeyLike } from 'node:crypto';
|
|
1
|
+
import { g as CertificateRevocationList, C as Certificate, d as CertificatePEM, P as PrivateKey, K as KeyObject, h as CertificatePurpose, b as PEM, D as DER, f as PublicKeyPEM, S as Signature, e as PrivateKeyPEM, a as PublicKey, N as Nonce } from '../common-DxHkx4Pv.cjs';
|
|
2
|
+
export { c as createPrivateKeyFromNodeJSCrypto, i as isKeyObject } from '../common-DxHkx4Pv.cjs';
|
|
4
3
|
import * as x509 from '@peculiar/x509';
|
|
4
|
+
import { KeyLike } from 'node:crypto';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Determine if a Certificate Revocation List (CRL) was issued by
|
|
@@ -217,155 +217,6 @@ declare function split_der(certificateChain: Certificate): Certificate[];
|
|
|
217
217
|
*/
|
|
218
218
|
declare function combine_der(certificates: Certificate[]): Certificate;
|
|
219
219
|
|
|
220
|
-
declare function identifyPemType(rawKey: Buffer | string): undefined | string;
|
|
221
|
-
declare function removeTrailingLF(str: string): string;
|
|
222
|
-
declare function toPem(raw_key: Buffer | string, pem: string): string;
|
|
223
|
-
declare function convertPEMtoDER(raw_key: PEM): DER;
|
|
224
|
-
declare function hexDump(buffer: Buffer, width?: number): string;
|
|
225
|
-
interface MakeMessageChunkSignatureOptions {
|
|
226
|
-
signatureLength: number;
|
|
227
|
-
algorithm: string;
|
|
228
|
-
privateKey: PrivateKey;
|
|
229
|
-
}
|
|
230
|
-
declare function makeMessageChunkSignature(chunk: Buffer, options: MakeMessageChunkSignatureOptions): Buffer;
|
|
231
|
-
interface VerifyMessageChunkSignatureOptions {
|
|
232
|
-
signatureLength?: number;
|
|
233
|
-
algorithm: string;
|
|
234
|
-
publicKey: PublicKeyPEM;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* @method verifyMessageChunkSignature
|
|
238
|
-
*
|
|
239
|
-
* const signer = {
|
|
240
|
-
* signatureLength : 128,
|
|
241
|
-
* algorithm : "RSA-SHA256",
|
|
242
|
-
* publicKey: "qsdqsdqsd"
|
|
243
|
-
* };
|
|
244
|
-
* @param blockToVerify
|
|
245
|
-
* @param signature
|
|
246
|
-
* @param options
|
|
247
|
-
* @param options.signatureLength
|
|
248
|
-
* @param options.algorithm for example "RSA-SHA256"
|
|
249
|
-
* @param options.publicKey
|
|
250
|
-
* @return true if the signature is valid
|
|
251
|
-
*/
|
|
252
|
-
declare function verifyMessageChunkSignature(blockToVerify: Buffer, signature: Signature, options: VerifyMessageChunkSignatureOptions): boolean;
|
|
253
|
-
declare function makeSHA1Thumbprint(buffer: Buffer): Signature;
|
|
254
|
-
declare const RSA_PKCS1_OAEP_PADDING: number;
|
|
255
|
-
declare const RSA_PKCS1_PADDING: number;
|
|
256
|
-
declare enum PaddingAlgorithm {
|
|
257
|
-
RSA_PKCS1_OAEP_PADDING = 4,
|
|
258
|
-
RSA_PKCS1_PADDING = 1
|
|
259
|
-
}
|
|
260
|
-
declare function publicEncrypt_native(buffer: Buffer, publicKey: KeyLike, algorithm?: PaddingAlgorithm): Buffer;
|
|
261
|
-
declare function privateDecrypt_native(buffer: Buffer, privateKey: PrivateKey, algorithm?: PaddingAlgorithm): Buffer;
|
|
262
|
-
declare const publicEncrypt: typeof publicEncrypt_native;
|
|
263
|
-
declare const privateDecrypt: typeof privateDecrypt_native;
|
|
264
|
-
declare function publicEncrypt_long(buffer: Buffer, publicKey: KeyLike, blockSize: number, padding?: number, paddingAlgorithm?: PaddingAlgorithm): Buffer;
|
|
265
|
-
declare function privateDecrypt_long(buffer: Buffer, privateKey: PrivateKey, blockSize: number, paddingAlgorithm?: number): Buffer;
|
|
266
|
-
declare function coerceCertificatePem(certificate: Certificate | CertificatePEM): CertificatePEM;
|
|
267
|
-
declare function extractPublicKeyFromCertificateSync(certificate: Certificate | CertificatePEM): PublicKeyPEM;
|
|
268
|
-
/**
|
|
269
|
-
* extract the publickey from a certificate
|
|
270
|
-
* @async
|
|
271
|
-
*/
|
|
272
|
-
declare function extractPublicKeyFromCertificate(certificate: CertificatePEM | Certificate, callback: (err: Error | null, publicKeyPEM?: PublicKeyPEM) => void): void;
|
|
273
|
-
|
|
274
|
-
/***
|
|
275
|
-
* @method rsaLengthPrivateKey
|
|
276
|
-
* A method to determine the rsa key length ( i.e 2048bits or 1024bits)
|
|
277
|
-
* @param key a PEM public key or a PEM rsa private key
|
|
278
|
-
* @return the key length in bytes.
|
|
279
|
-
*/
|
|
280
|
-
declare function rsaLengthPrivateKey(key: PrivateKey): number;
|
|
281
|
-
/**
|
|
282
|
-
* @method toPem2
|
|
283
|
-
* @param raw_key
|
|
284
|
-
* @param pem
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
* @return a PEM string containing the Private Key
|
|
288
|
-
*
|
|
289
|
-
* Note: a Pem key can be converted back to a private key object using coercePrivateKey
|
|
290
|
-
*
|
|
291
|
-
*/
|
|
292
|
-
declare function toPem2(raw_key: Buffer | string | KeyObject | PrivateKey, pem: string): string;
|
|
293
|
-
declare function coercePrivateKeyPem(privateKey: PrivateKey): PrivateKeyPEM;
|
|
294
|
-
declare function coercePublicKeyPem(publicKey: PublicKey | PublicKeyPEM): PublicKeyPEM;
|
|
295
|
-
declare function coerceRsaPublicKeyPem(publicKey: PublicKey | KeyObject | PublicKeyPEM): PublicKeyPEM;
|
|
296
|
-
declare function rsaLengthPublicKey(key: PublicKeyPEM | PublicKey): number;
|
|
297
|
-
declare function rsaLengthRsaPublicKey(key: PublicKeyPEM | PublicKey): number;
|
|
298
|
-
|
|
299
|
-
declare function makePseudoRandomBuffer(secret: Nonce, seed: Nonce, minLength: number, sha1or256: "SHA1" | "SHA256"): Buffer;
|
|
300
|
-
interface ComputeDerivedKeysOptions {
|
|
301
|
-
signatureLength: number;
|
|
302
|
-
signingKeyLength: number;
|
|
303
|
-
encryptingKeyLength: number;
|
|
304
|
-
encryptingBlockSize: number;
|
|
305
|
-
algorithm: string;
|
|
306
|
-
sha1or256?: "SHA1" | "SHA256";
|
|
307
|
-
}
|
|
308
|
-
interface DerivedKeys extends ComputeDerivedKeysOptions {
|
|
309
|
-
signatureLength: number;
|
|
310
|
-
signingKeyLength: number;
|
|
311
|
-
encryptingKeyLength: number;
|
|
312
|
-
encryptingBlockSize: number;
|
|
313
|
-
algorithm: string;
|
|
314
|
-
sha1or256: "SHA1" | "SHA256";
|
|
315
|
-
signingKey: Buffer;
|
|
316
|
-
encryptingKey: Buffer;
|
|
317
|
-
initializationVector: Buffer;
|
|
318
|
-
}
|
|
319
|
-
declare function computeDerivedKeys(secret: Nonce, seed: Nonce, options: ComputeDerivedKeysOptions): DerivedKeys;
|
|
320
|
-
/**
|
|
321
|
-
* @method reduceLength
|
|
322
|
-
* @param buffer
|
|
323
|
-
* @param byteToRemove
|
|
324
|
-
* @return buffer
|
|
325
|
-
*/
|
|
326
|
-
declare function reduceLength(buffer: Buffer, byteToRemove: number): Buffer;
|
|
327
|
-
/**
|
|
328
|
-
* @method removePadding
|
|
329
|
-
* @param buffer
|
|
330
|
-
* @return buffer with padding removed
|
|
331
|
-
*/
|
|
332
|
-
declare function removePadding(buffer: Buffer): Buffer;
|
|
333
|
-
type VerifyChunkSignatureOptions = VerifyMessageChunkSignatureOptions;
|
|
334
|
-
/**
|
|
335
|
-
* @method verifyChunkSignature
|
|
336
|
-
*
|
|
337
|
-
* const signer = {
|
|
338
|
-
* signatureLength : 128,
|
|
339
|
-
* algorithm : "RSA-SHA256",
|
|
340
|
-
* public_key: "qsdqsdqsd"
|
|
341
|
-
* };
|
|
342
|
-
*
|
|
343
|
-
* @param chunk The message chunk to verify.
|
|
344
|
-
* @param options
|
|
345
|
-
* @param options.signatureLength
|
|
346
|
-
* @param options.algorithm the algorithm.
|
|
347
|
-
* @param options.publicKey
|
|
348
|
-
* @return {*}
|
|
349
|
-
*/
|
|
350
|
-
declare function verifyChunkSignature(chunk: Buffer, options: VerifyChunkSignatureOptions): boolean;
|
|
351
|
-
declare function computePaddingFooter(buffer: Buffer, derivedKeys: DerivedKeys): Buffer;
|
|
352
|
-
declare function encryptBufferWithDerivedKeys(buffer: Buffer, derivedKeys: DerivedKeys): Buffer;
|
|
353
|
-
declare function decryptBufferWithDerivedKeys(buffer: Buffer, derivedKeys: DerivedKeys): Buffer;
|
|
354
|
-
/**
|
|
355
|
-
* @method makeMessageChunkSignatureWithDerivedKeys
|
|
356
|
-
* @param message
|
|
357
|
-
* @param derivedKeys
|
|
358
|
-
* @return
|
|
359
|
-
*/
|
|
360
|
-
declare function makeMessageChunkSignatureWithDerivedKeys(message: Buffer, derivedKeys: DerivedKeys): Buffer;
|
|
361
|
-
/**
|
|
362
|
-
* @method verifyChunkSignatureWithDerivedKeys
|
|
363
|
-
* @param chunk
|
|
364
|
-
* @param derivedKeys
|
|
365
|
-
* @return
|
|
366
|
-
*/
|
|
367
|
-
declare function verifyChunkSignatureWithDerivedKeys(chunk: Buffer, derivedKeys: DerivedKeys): boolean;
|
|
368
|
-
|
|
369
220
|
declare function exploreAsn1(buffer: Buffer): void;
|
|
370
221
|
|
|
371
222
|
type Version = string;
|
|
@@ -439,12 +290,30 @@ interface PrivateKeyInternals {
|
|
|
439
290
|
*/
|
|
440
291
|
declare function explorePrivateKey(privateKey2: PrivateKey): PrivateKeyInternals;
|
|
441
292
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
293
|
+
/**
|
|
294
|
+
* The type of content found in a DER-encoded buffer.
|
|
295
|
+
*/
|
|
296
|
+
type DERContentType = "X509Certificate" | "X509CertificateChain" | "CertificateRevocationList" | "CertificateSigningRequest" | "PKCS12" | "PrivateKey" | "Unknown";
|
|
297
|
+
/**
|
|
298
|
+
* Identify the content type of a DER-encoded buffer by inspecting
|
|
299
|
+
* its ASN.1 structure.
|
|
300
|
+
*
|
|
301
|
+
* This function does NOT fully parse the buffer — it only inspects
|
|
302
|
+
* the outermost tags to determine the type. It can distinguish:
|
|
303
|
+
*
|
|
304
|
+
* - **X509Certificate** — a single X.509 certificate (v1 or v3)
|
|
305
|
+
* - **X509CertificateChain** — multiple concatenated X.509 DER
|
|
306
|
+
* certificates
|
|
307
|
+
* - **CertificateRevocationList** — an X.509 CRL (v1 or v2)
|
|
308
|
+
* - **CertificateSigningRequest** — a PKCS#10 CSR
|
|
309
|
+
* - **PKCS12** — a PKCS#12 / PFX container (version 3)
|
|
310
|
+
* - **PrivateKey** — a PKCS#8 or raw RSA private key
|
|
311
|
+
* - **Unknown** — could not identify the content
|
|
312
|
+
*
|
|
313
|
+
* @param buffer A DER-encoded buffer to identify.
|
|
314
|
+
* @returns The detected {@link DERContentType}.
|
|
315
|
+
*/
|
|
316
|
+
declare function identifyDERContent(buffer: Buffer): DERContentType;
|
|
448
317
|
|
|
449
318
|
interface SubjectOptions {
|
|
450
319
|
commonName?: string;
|
|
@@ -541,6 +410,162 @@ declare function createSelfSignedCertificate({ privateKey, notAfter, notBefore,
|
|
|
541
410
|
der: x509.X509Certificate;
|
|
542
411
|
}>;
|
|
543
412
|
|
|
413
|
+
declare function identifyPemType(rawKey: Buffer | string): undefined | string;
|
|
414
|
+
declare function removeTrailingLF(str: string): string;
|
|
415
|
+
declare function toPem(raw_key: Buffer | string, pem: string): string;
|
|
416
|
+
declare function convertPEMtoDER(raw_key: PEM): DER;
|
|
417
|
+
declare function hexDump(buffer: Buffer, width?: number): string;
|
|
418
|
+
interface MakeMessageChunkSignatureOptions {
|
|
419
|
+
signatureLength: number;
|
|
420
|
+
algorithm: string;
|
|
421
|
+
privateKey: PrivateKey;
|
|
422
|
+
}
|
|
423
|
+
declare function makeMessageChunkSignature(chunk: Buffer, options: MakeMessageChunkSignatureOptions): Buffer;
|
|
424
|
+
interface VerifyMessageChunkSignatureOptions {
|
|
425
|
+
signatureLength?: number;
|
|
426
|
+
algorithm: string;
|
|
427
|
+
publicKey: PublicKeyPEM;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* @method verifyMessageChunkSignature
|
|
431
|
+
*
|
|
432
|
+
* const signer = {
|
|
433
|
+
* signatureLength : 128,
|
|
434
|
+
* algorithm : "RSA-SHA256",
|
|
435
|
+
* publicKey: "qsdqsdqsd"
|
|
436
|
+
* };
|
|
437
|
+
* @param blockToVerify
|
|
438
|
+
* @param signature
|
|
439
|
+
* @param options
|
|
440
|
+
* @param options.signatureLength
|
|
441
|
+
* @param options.algorithm for example "RSA-SHA256"
|
|
442
|
+
* @param options.publicKey
|
|
443
|
+
* @return true if the signature is valid
|
|
444
|
+
*/
|
|
445
|
+
declare function verifyMessageChunkSignature(blockToVerify: Buffer, signature: Signature, options: VerifyMessageChunkSignatureOptions): boolean;
|
|
446
|
+
declare function makeSHA1Thumbprint(buffer: Buffer): Signature;
|
|
447
|
+
declare const RSA_PKCS1_OAEP_PADDING: number;
|
|
448
|
+
declare const RSA_PKCS1_PADDING: number;
|
|
449
|
+
declare enum PaddingAlgorithm {
|
|
450
|
+
RSA_PKCS1_OAEP_PADDING = 4,
|
|
451
|
+
RSA_PKCS1_PADDING = 1
|
|
452
|
+
}
|
|
453
|
+
declare function publicEncrypt_native(buffer: Buffer, publicKey: KeyLike, algorithm?: PaddingAlgorithm): Buffer;
|
|
454
|
+
declare function privateDecrypt_native(buffer: Buffer, privateKey: PrivateKey, algorithm?: PaddingAlgorithm): Buffer;
|
|
455
|
+
declare const publicEncrypt: typeof publicEncrypt_native;
|
|
456
|
+
declare const privateDecrypt: typeof privateDecrypt_native;
|
|
457
|
+
declare function publicEncrypt_long(buffer: Buffer, publicKey: KeyLike, blockSize: number, padding?: number, paddingAlgorithm?: PaddingAlgorithm): Buffer;
|
|
458
|
+
declare function privateDecrypt_long(buffer: Buffer, privateKey: PrivateKey, blockSize: number, paddingAlgorithm?: number): Buffer;
|
|
459
|
+
declare function coerceCertificatePem(certificate: Certificate | CertificatePEM): CertificatePEM;
|
|
460
|
+
declare function extractPublicKeyFromCertificateSync(certificate: Certificate | CertificatePEM): PublicKeyPEM;
|
|
461
|
+
/**
|
|
462
|
+
* extract the publickey from a certificate
|
|
463
|
+
* @async
|
|
464
|
+
*/
|
|
465
|
+
declare function extractPublicKeyFromCertificate(certificate: CertificatePEM | Certificate, callback: (err: Error | null, publicKeyPEM?: PublicKeyPEM) => void): void;
|
|
466
|
+
|
|
467
|
+
/***
|
|
468
|
+
* @method rsaLengthPrivateKey
|
|
469
|
+
* A method to determine the rsa key length ( i.e 2048bits or 1024bits)
|
|
470
|
+
* @param key a PEM public key or a PEM rsa private key
|
|
471
|
+
* @return the key length in bytes.
|
|
472
|
+
*/
|
|
473
|
+
declare function rsaLengthPrivateKey(key: PrivateKey): number;
|
|
474
|
+
/**
|
|
475
|
+
* @method toPem2
|
|
476
|
+
* @param raw_key
|
|
477
|
+
* @param pem
|
|
478
|
+
*
|
|
479
|
+
*
|
|
480
|
+
* @return a PEM string containing the Private Key
|
|
481
|
+
*
|
|
482
|
+
* Note: a Pem key can be converted back to a private key object using coercePrivateKey
|
|
483
|
+
*
|
|
484
|
+
*/
|
|
485
|
+
declare function toPem2(raw_key: Buffer | string | KeyObject | PrivateKey, pem: string): string;
|
|
486
|
+
declare function coercePrivateKeyPem(privateKey: PrivateKey): PrivateKeyPEM;
|
|
487
|
+
declare function coercePublicKeyPem(publicKey: PublicKey | PublicKeyPEM): PublicKeyPEM;
|
|
488
|
+
declare function coerceRsaPublicKeyPem(publicKey: PublicKey | KeyObject | PublicKeyPEM): PublicKeyPEM;
|
|
489
|
+
declare function rsaLengthPublicKey(key: PublicKeyPEM | PublicKey): number;
|
|
490
|
+
declare function rsaLengthRsaPublicKey(key: PublicKeyPEM | PublicKey): number;
|
|
491
|
+
|
|
492
|
+
declare function makePseudoRandomBuffer(secret: Nonce, seed: Nonce, minLength: number, sha1or256: "SHA1" | "SHA256"): Buffer;
|
|
493
|
+
interface ComputeDerivedKeysOptions {
|
|
494
|
+
signatureLength: number;
|
|
495
|
+
signingKeyLength: number;
|
|
496
|
+
encryptingKeyLength: number;
|
|
497
|
+
encryptingBlockSize: number;
|
|
498
|
+
algorithm: string;
|
|
499
|
+
sha1or256?: "SHA1" | "SHA256";
|
|
500
|
+
}
|
|
501
|
+
interface DerivedKeys extends ComputeDerivedKeysOptions {
|
|
502
|
+
signatureLength: number;
|
|
503
|
+
signingKeyLength: number;
|
|
504
|
+
encryptingKeyLength: number;
|
|
505
|
+
encryptingBlockSize: number;
|
|
506
|
+
algorithm: string;
|
|
507
|
+
sha1or256: "SHA1" | "SHA256";
|
|
508
|
+
signingKey: Buffer;
|
|
509
|
+
encryptingKey: Buffer;
|
|
510
|
+
initializationVector: Buffer;
|
|
511
|
+
}
|
|
512
|
+
declare function computeDerivedKeys(secret: Nonce, seed: Nonce, options: ComputeDerivedKeysOptions): DerivedKeys;
|
|
513
|
+
/**
|
|
514
|
+
* @method reduceLength
|
|
515
|
+
* @param buffer
|
|
516
|
+
* @param byteToRemove
|
|
517
|
+
* @return buffer
|
|
518
|
+
*/
|
|
519
|
+
declare function reduceLength(buffer: Buffer, byteToRemove: number): Buffer;
|
|
520
|
+
/**
|
|
521
|
+
* @method removePadding
|
|
522
|
+
* @param buffer
|
|
523
|
+
* @return buffer with padding removed
|
|
524
|
+
*/
|
|
525
|
+
declare function removePadding(buffer: Buffer): Buffer;
|
|
526
|
+
type VerifyChunkSignatureOptions = VerifyMessageChunkSignatureOptions;
|
|
527
|
+
/**
|
|
528
|
+
* @method verifyChunkSignature
|
|
529
|
+
*
|
|
530
|
+
* const signer = {
|
|
531
|
+
* signatureLength : 128,
|
|
532
|
+
* algorithm : "RSA-SHA256",
|
|
533
|
+
* public_key: "qsdqsdqsd"
|
|
534
|
+
* };
|
|
535
|
+
*
|
|
536
|
+
* @param chunk The message chunk to verify.
|
|
537
|
+
* @param options
|
|
538
|
+
* @param options.signatureLength
|
|
539
|
+
* @param options.algorithm the algorithm.
|
|
540
|
+
* @param options.publicKey
|
|
541
|
+
* @return {*}
|
|
542
|
+
*/
|
|
543
|
+
declare function verifyChunkSignature(chunk: Buffer, options: VerifyChunkSignatureOptions): boolean;
|
|
544
|
+
declare function computePaddingFooter(buffer: Buffer, derivedKeys: DerivedKeys): Buffer;
|
|
545
|
+
declare function encryptBufferWithDerivedKeys(buffer: Buffer, derivedKeys: DerivedKeys): Buffer;
|
|
546
|
+
declare function decryptBufferWithDerivedKeys(buffer: Buffer, derivedKeys: DerivedKeys): Buffer;
|
|
547
|
+
/**
|
|
548
|
+
* @method makeMessageChunkSignatureWithDerivedKeys
|
|
549
|
+
* @param message
|
|
550
|
+
* @param derivedKeys
|
|
551
|
+
* @return
|
|
552
|
+
*/
|
|
553
|
+
declare function makeMessageChunkSignatureWithDerivedKeys(message: Buffer, derivedKeys: DerivedKeys): Buffer;
|
|
554
|
+
/**
|
|
555
|
+
* @method verifyChunkSignatureWithDerivedKeys
|
|
556
|
+
* @param chunk
|
|
557
|
+
* @param derivedKeys
|
|
558
|
+
* @return
|
|
559
|
+
*/
|
|
560
|
+
declare function verifyChunkSignatureWithDerivedKeys(chunk: Buffer, derivedKeys: DerivedKeys): boolean;
|
|
561
|
+
|
|
562
|
+
declare function makePrivateKeyFromPem(privateKeyInPem: string): PrivateKey;
|
|
563
|
+
|
|
564
|
+
declare function makePrivateKeyThumbPrint(_privateKey: PrivateKey): Buffer;
|
|
565
|
+
|
|
566
|
+
declare function publicKeyAndPrivateKeyMatches(certificate: Certificate, privateKey: PrivateKey): boolean;
|
|
567
|
+
declare function certificateMatchesPrivateKey(certificate: Certificate, privateKey: PrivateKey): boolean;
|
|
568
|
+
|
|
544
569
|
declare const asn1: {
|
|
545
570
|
readDirectoryName: typeof readDirectoryName;
|
|
546
571
|
readTag: typeof readTag;
|
|
@@ -549,4 +574,4 @@ declare const asn1: {
|
|
|
549
574
|
readSignatureValueBin: typeof readSignatureValueBin;
|
|
550
575
|
};
|
|
551
576
|
|
|
552
|
-
export { type AttributeTypeAndValue, type AuthorityKeyIdentifier, type BasicConstraints, Certificate, type CertificateExtension, type CertificateInfo, type CertificateInternals, CertificatePEM, CertificatePurpose, CertificateRevocationList, type CertificateRevocationListInfo, type CertificateSerialNumber, type CertificateSigningRequestInfo, type ComputeDerivedKeysOptions, type CreateSelfSignCertificateOptions, DER, type DerivedKeys, type DirectoryName, type ExtensionRequest, type Extensions, KeyObject, type Name, Nonce, PEM, PaddingAlgorithm, PrivateKey, type PrivateKeyInternals, PrivateKeyPEM, PublicKey, type PublicKeyLength, PublicKeyPEM, RSA_PKCS1_OAEP_PADDING, RSA_PKCS1_PADDING, type RevokedCertificate, Signature, Subject, type SubjectAltName, type SubjectOptions, type SubjectPublicKey, type SubjectPublicKeyInfo, type TBSCertList, type TbsCertificate, type Validity, type VerifyChunkSignatureOptions, type VerifyMessageChunkSignatureOptions, type Version, type X509ExtKeyUsage, type X509KeyUsage, type _VerifyStatus, _coercePrivateKey, asn1, certificateMatchesPrivateKey, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateSigningRequest, createSelfSignedCertificate, decryptBufferWithDerivedKeys, derToPrivateKey, encryptBufferWithDerivedKeys, exploreAsn1, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, generateKeyPair, generatePrivateKey, hexDump, identifyPemType, isCrlIssuedByCertificate, makeMessageChunkSignature, makeMessageChunkSignatureWithDerivedKeys, makePrivateKeyFromPem, makePrivateKeyThumbPrint, makePseudoRandomBuffer, makeSHA1Thumbprint, pemToPrivateKey, privateDecrypt, privateDecrypt_long, privateDecrypt_native, privateKeyToPEM, publicEncrypt, publicEncrypt_long, publicEncrypt_native, publicKeyAndPrivateKeyMatches, readCertificationRequestInfo, readExtension, readNameForCrl, readTbsCertificate, reduceLength, removePadding, removeTrailingLF, rsaLengthPrivateKey, rsaLengthPublicKey, rsaLengthRsaPublicKey, split_der, toPem, toPem2, verifyCertificateChain, verifyCertificateOrClrSignature, verifyCertificateRevocationListSignature, verifyCertificateSignature, verifyChunkSignature, verifyChunkSignatureWithDerivedKeys, verifyCrlIssuedByCertificate, verifyMessageChunkSignature };
|
|
577
|
+
export { type AttributeTypeAndValue, type AuthorityKeyIdentifier, type BasicConstraints, Certificate, type CertificateExtension, type CertificateInfo, type CertificateInternals, CertificatePEM, CertificatePurpose, CertificateRevocationList, type CertificateRevocationListInfo, type CertificateSerialNumber, type CertificateSigningRequestInfo, type ComputeDerivedKeysOptions, type CreateSelfSignCertificateOptions, DER, type DERContentType, type DerivedKeys, type DirectoryName, type ExtensionRequest, type Extensions, KeyObject, type Name, Nonce, PEM, PaddingAlgorithm, PrivateKey, type PrivateKeyInternals, PrivateKeyPEM, PublicKey, type PublicKeyLength, PublicKeyPEM, RSA_PKCS1_OAEP_PADDING, RSA_PKCS1_PADDING, type RevokedCertificate, Signature, Subject, type SubjectAltName, type SubjectOptions, type SubjectPublicKey, type SubjectPublicKeyInfo, type TBSCertList, type TbsCertificate, type Validity, type VerifyChunkSignatureOptions, type VerifyMessageChunkSignatureOptions, type Version, type X509ExtKeyUsage, type X509KeyUsage, type _VerifyStatus, _coercePrivateKey, asn1, certificateMatchesPrivateKey, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateSigningRequest, createSelfSignedCertificate, decryptBufferWithDerivedKeys, derToPrivateKey, encryptBufferWithDerivedKeys, exploreAsn1, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, generateKeyPair, generatePrivateKey, hexDump, identifyDERContent, identifyPemType, isCrlIssuedByCertificate, makeMessageChunkSignature, makeMessageChunkSignatureWithDerivedKeys, makePrivateKeyFromPem, makePrivateKeyThumbPrint, makePseudoRandomBuffer, makeSHA1Thumbprint, pemToPrivateKey, privateDecrypt, privateDecrypt_long, privateDecrypt_native, privateKeyToPEM, publicEncrypt, publicEncrypt_long, publicEncrypt_native, publicKeyAndPrivateKeyMatches, readCertificationRequestInfo, readExtension, readNameForCrl, readTbsCertificate, reduceLength, removePadding, removeTrailingLF, rsaLengthPrivateKey, rsaLengthPublicKey, rsaLengthRsaPublicKey, split_der, toPem, toPem2, verifyCertificateChain, verifyCertificateOrClrSignature, verifyCertificateRevocationListSignature, verifyCertificateSignature, verifyChunkSignature, verifyChunkSignatureWithDerivedKeys, verifyCrlIssuedByCertificate, verifyMessageChunkSignature };
|