node-opcua-crypto 2.1.2 → 2.2.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/.fossa.yml +18 -18
- package/.github/FUNDING.yml +12 -12
- package/.github/workflows/main.yml +106 -106
- package/.prettierrc.js +6 -6
- package/LICENSE +23 -23
- package/README.md +14 -14
- package/dist/source/asn1.d.ts +73 -73
- package/dist/source/asn1.js +359 -359
- package/dist/source/buffer_utils.d.ts +6 -6
- package/dist/source/buffer_utils.js +21 -21
- package/dist/source/common.d.ts +14 -14
- package/dist/source/common.js +2 -2
- package/dist/source/crypto_explore_certificate.d.ts +107 -107
- package/dist/source/crypto_explore_certificate.js +601 -601
- package/dist/source/crypto_utils.d.ts +76 -76
- package/dist/source/crypto_utils.js +329 -329
- package/dist/source/derived_keys.d.ts +72 -72
- package/dist/source/derived_keys.js +248 -248
- package/dist/source/explore_certificate.d.ts +30 -30
- package/dist/source/explore_certificate.js +43 -43
- package/dist/source/explore_certificate_revocation_list.d.ts +28 -28
- package/dist/source/explore_certificate_revocation_list.js +69 -69
- package/dist/source/explore_certificate_signing_request.d.ts +13 -13
- package/dist/source/explore_certificate_signing_request.js +44 -44
- package/dist/source/explore_private_key.d.ts +29 -29
- package/dist/source/explore_private_key.js +97 -97
- package/dist/source/index.d.ts +13 -13
- package/dist/source/index.js +29 -29
- package/dist/source/oid_map.d.ts +7 -7
- package/dist/source/oid_map.js +303 -303
- package/dist/source/public_private_match.d.ts +3 -3
- package/dist/source/public_private_match.js +36 -36
- package/dist/source/verify_certificate_signature.d.ts +10 -10
- package/dist/source/verify_certificate_signature.js +101 -101
- package/dist/source_nodejs/index.d.ts +3 -3
- package/dist/source_nodejs/index.js +19 -19
- package/dist/source_nodejs/read.d.ts +23 -23
- package/dist/source_nodejs/read.js +106 -106
- package/dist/source_nodejs/read_certificate_revocation_list.d.ts +2 -2
- package/dist/source_nodejs/read_certificate_revocation_list.js +27 -27
- package/dist/source_nodejs/read_certificate_signing_request.d.ts +3 -3
- package/dist/source_nodejs/read_certificate_signing_request.js +27 -27
- package/index.d.ts +2 -2
- package/index.js +4 -4
- package/index_web.js +3 -3
- package/package.json +9 -9
- package/source/asn1.ts +404 -404
- package/source/buffer_utils.ts +18 -18
- package/source/crypto_explore_certificate.ts +764 -764
- package/source/derived_keys.ts +287 -287
- package/source/explore_certificate.ts +66 -66
- package/source/explore_certificate_revocation_list.ts +122 -122
- package/source/explore_certificate_signing_request.ts +58 -58
- package/source/index.ts +13 -13
- package/source/oid_map.ts +310 -310
- package/source/verify_certificate_signature.ts +105 -105
- package/source_nodejs/index.ts +2 -2
- package/source_nodejs/read_certificate_revocation_list.ts +14 -14
- package/source_nodejs/read_certificate_signing_request.ts +17 -17
- package/test_certificate.ts +34 -34
- package/tsconfig.json +18 -18
- package/tslint.json +34 -34
- package/dist/source/certificate_matches_private_key.d.ts +0 -2
- package/dist/source/certificate_matches_private_key.js +0 -22
- package/dist/source/certificate_matches_private_key.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
* @private
|
|
5
|
-
*/
|
|
6
|
-
export declare const createFastUninitializedBuffer: (size: number) => Buffer;
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
export declare const createFastUninitializedBuffer: (size: number) => Buffer;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createFastUninitializedBuffer = void 0;
|
|
4
|
-
//
|
|
5
|
-
// note: new Buffer(size)# is deprecated since: v6.0. and is replaced with Buffer.allocUnsafe
|
|
6
|
-
// to ensure backward compatibility we have to replace
|
|
7
|
-
// new Buffer(size) with createFastUninitializedBuffer(size)
|
|
8
|
-
//
|
|
9
|
-
// Buffer.alloc and Buffer.allocUnsafe have been introduced in nodejs 5.1.0
|
|
10
|
-
// in node 0.11 new Buffer
|
|
11
|
-
//
|
|
12
|
-
/**
|
|
13
|
-
* @internal
|
|
14
|
-
* @private
|
|
15
|
-
*/
|
|
16
|
-
exports.createFastUninitializedBuffer = Buffer.allocUnsafe
|
|
17
|
-
? Buffer.allocUnsafe
|
|
18
|
-
: (size) => {
|
|
19
|
-
// istanbul ignore next
|
|
20
|
-
return new Buffer(size);
|
|
21
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFastUninitializedBuffer = void 0;
|
|
4
|
+
//
|
|
5
|
+
// note: new Buffer(size)# is deprecated since: v6.0. and is replaced with Buffer.allocUnsafe
|
|
6
|
+
// to ensure backward compatibility we have to replace
|
|
7
|
+
// new Buffer(size) with createFastUninitializedBuffer(size)
|
|
8
|
+
//
|
|
9
|
+
// Buffer.alloc and Buffer.allocUnsafe have been introduced in nodejs 5.1.0
|
|
10
|
+
// in node 0.11 new Buffer
|
|
11
|
+
//
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
exports.createFastUninitializedBuffer = Buffer.allocUnsafe
|
|
17
|
+
? Buffer.allocUnsafe
|
|
18
|
+
: (size) => {
|
|
19
|
+
// istanbul ignore next
|
|
20
|
+
return new Buffer(size);
|
|
21
|
+
};
|
|
22
22
|
//# sourceMappingURL=buffer_utils.js.map
|
package/dist/source/common.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { KeyObject } from "node:crypto";
|
|
4
|
-
export type PrivateKey = KeyObject;
|
|
5
|
-
export type PublicKey = KeyObject;
|
|
6
|
-
export type Nonce = Buffer;
|
|
7
|
-
export type PEM = string;
|
|
8
|
-
export type DER = Buffer;
|
|
9
|
-
export type Certificate = DER;
|
|
10
|
-
export type CertificatePEM = PEM;
|
|
11
|
-
export type PrivateKeyPEM = PEM;
|
|
12
|
-
export type PublicKeyPEM = PEM;
|
|
13
|
-
export type Signature = Buffer;
|
|
14
|
-
export type CertificateRevocationList = Buffer;
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { KeyObject } from "node:crypto";
|
|
4
|
+
export type PrivateKey = KeyObject;
|
|
5
|
+
export type PublicKey = KeyObject;
|
|
6
|
+
export type Nonce = Buffer;
|
|
7
|
+
export type PEM = string;
|
|
8
|
+
export type DER = Buffer;
|
|
9
|
+
export type Certificate = DER;
|
|
10
|
+
export type CertificatePEM = PEM;
|
|
11
|
+
export type PrivateKeyPEM = PEM;
|
|
12
|
+
export type PublicKeyPEM = PEM;
|
|
13
|
+
export type Signature = Buffer;
|
|
14
|
+
export type CertificateRevocationList = Buffer;
|
package/dist/source/common.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=common.js.map
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node_opcua_crypto
|
|
3
|
-
*/
|
|
4
|
-
/// <reference types="node" />
|
|
5
|
-
import { BlockInfo, AlgorithmIdentifier, SignatureValue, DirectoryName } from "./asn1";
|
|
6
|
-
import { Certificate } from "./common";
|
|
7
|
-
import { PublicKeyLength } from "./explore_certificate";
|
|
8
|
-
export interface AttributeTypeAndValue {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
export interface Validity {
|
|
12
|
-
notBefore: Date;
|
|
13
|
-
notAfter: Date;
|
|
14
|
-
}
|
|
15
|
-
export interface X509KeyUsage {
|
|
16
|
-
digitalSignature: boolean;
|
|
17
|
-
nonRepudiation: boolean;
|
|
18
|
-
keyEncipherment: boolean;
|
|
19
|
-
dataEncipherment: boolean;
|
|
20
|
-
keyAgreement: boolean;
|
|
21
|
-
keyCertSign: boolean;
|
|
22
|
-
cRLSign: boolean;
|
|
23
|
-
encipherOnly: boolean;
|
|
24
|
-
decipherOnly: boolean;
|
|
25
|
-
}
|
|
26
|
-
export interface X509ExtKeyUsage {
|
|
27
|
-
clientAuth: boolean;
|
|
28
|
-
serverAuth: boolean;
|
|
29
|
-
codeSigning: boolean;
|
|
30
|
-
emailProtection: boolean;
|
|
31
|
-
timeStamping: boolean;
|
|
32
|
-
ocspSigning: boolean;
|
|
33
|
-
ipsecEndSystem: boolean;
|
|
34
|
-
ipsecTunnel: boolean;
|
|
35
|
-
ipsecUser: boolean;
|
|
36
|
-
}
|
|
37
|
-
export interface SubjectPublicKey {
|
|
38
|
-
modulus: Buffer;
|
|
39
|
-
}
|
|
40
|
-
export declare function _readExtension(buffer: Buffer, block: BlockInfo): {
|
|
41
|
-
identifier: {
|
|
42
|
-
oid: string;
|
|
43
|
-
name: string;
|
|
44
|
-
};
|
|
45
|
-
value: any;
|
|
46
|
-
};
|
|
47
|
-
export interface SubjectPublicKeyInfo {
|
|
48
|
-
algorithm: string;
|
|
49
|
-
keyLength: PublicKeyLength;
|
|
50
|
-
subjectPublicKey: SubjectPublicKey;
|
|
51
|
-
}
|
|
52
|
-
export interface BasicConstraints {
|
|
53
|
-
critical: boolean;
|
|
54
|
-
cA: boolean;
|
|
55
|
-
pathLengthConstraint?: number;
|
|
56
|
-
}
|
|
57
|
-
export interface AuthorityKeyIdentifier {
|
|
58
|
-
keyIdentifier: string | null;
|
|
59
|
-
authorityCertIssuer: DirectoryName | null;
|
|
60
|
-
authorityCertIssuerFingerPrint: string;
|
|
61
|
-
serial: string | null;
|
|
62
|
-
}
|
|
63
|
-
export interface CertificateExtension {
|
|
64
|
-
basicConstraints: BasicConstraints;
|
|
65
|
-
subjectKeyIdentifier?: string;
|
|
66
|
-
authorityKeyIdentifier?: AuthorityKeyIdentifier;
|
|
67
|
-
keyUsage?: X509KeyUsage;
|
|
68
|
-
extKeyUsage?: X509ExtKeyUsage;
|
|
69
|
-
subjectAltName?: any;
|
|
70
|
-
}
|
|
71
|
-
export interface TbsCertificate {
|
|
72
|
-
version: number;
|
|
73
|
-
serialNumber: string;
|
|
74
|
-
issuer: any;
|
|
75
|
-
signature: AlgorithmIdentifier;
|
|
76
|
-
validity: Validity;
|
|
77
|
-
subject: DirectoryName;
|
|
78
|
-
subjectFingerPrint: string;
|
|
79
|
-
subjectPublicKeyInfo: SubjectPublicKeyInfo;
|
|
80
|
-
extensions: CertificateExtension | null;
|
|
81
|
-
}
|
|
82
|
-
export declare function readTbsCertificate(buffer: Buffer, block: BlockInfo): TbsCertificate;
|
|
83
|
-
export interface CertificateInternals {
|
|
84
|
-
tbsCertificate: TbsCertificate;
|
|
85
|
-
signatureAlgorithm: AlgorithmIdentifier;
|
|
86
|
-
signatureValue: SignatureValue;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* explore a certificate structure
|
|
90
|
-
* @param certificate
|
|
91
|
-
* @returns a json object that exhibits the internal data of the certificate
|
|
92
|
-
*/
|
|
93
|
-
export declare function exploreCertificate(certificate: Certificate): CertificateInternals;
|
|
94
|
-
/**
|
|
95
|
-
* @method split_der
|
|
96
|
-
* split a multi chain certificates
|
|
97
|
-
* @param certificateChain the certificate chain in der (binary) format}
|
|
98
|
-
* @returns an array of Der , each element of the array is one certificate of the chain
|
|
99
|
-
*/
|
|
100
|
-
export declare function split_der(certificateChain: Certificate): Certificate[];
|
|
101
|
-
/**
|
|
102
|
-
* @method combine_der
|
|
103
|
-
* combine an array of certificates into a single blob
|
|
104
|
-
* @param certificates a array with the individual DER certificates of the chain
|
|
105
|
-
* @return a concatenated buffer containing the certificates
|
|
106
|
-
*/
|
|
107
|
-
export declare function combine_der(certificates: Certificate[]): Certificate;
|
|
1
|
+
/**
|
|
2
|
+
* @module node_opcua_crypto
|
|
3
|
+
*/
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
import { BlockInfo, AlgorithmIdentifier, SignatureValue, DirectoryName } from "./asn1";
|
|
6
|
+
import { Certificate } from "./common";
|
|
7
|
+
import { PublicKeyLength } from "./explore_certificate";
|
|
8
|
+
export interface AttributeTypeAndValue {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
export interface Validity {
|
|
12
|
+
notBefore: Date;
|
|
13
|
+
notAfter: Date;
|
|
14
|
+
}
|
|
15
|
+
export interface X509KeyUsage {
|
|
16
|
+
digitalSignature: boolean;
|
|
17
|
+
nonRepudiation: boolean;
|
|
18
|
+
keyEncipherment: boolean;
|
|
19
|
+
dataEncipherment: boolean;
|
|
20
|
+
keyAgreement: boolean;
|
|
21
|
+
keyCertSign: boolean;
|
|
22
|
+
cRLSign: boolean;
|
|
23
|
+
encipherOnly: boolean;
|
|
24
|
+
decipherOnly: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface X509ExtKeyUsage {
|
|
27
|
+
clientAuth: boolean;
|
|
28
|
+
serverAuth: boolean;
|
|
29
|
+
codeSigning: boolean;
|
|
30
|
+
emailProtection: boolean;
|
|
31
|
+
timeStamping: boolean;
|
|
32
|
+
ocspSigning: boolean;
|
|
33
|
+
ipsecEndSystem: boolean;
|
|
34
|
+
ipsecTunnel: boolean;
|
|
35
|
+
ipsecUser: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface SubjectPublicKey {
|
|
38
|
+
modulus: Buffer;
|
|
39
|
+
}
|
|
40
|
+
export declare function _readExtension(buffer: Buffer, block: BlockInfo): {
|
|
41
|
+
identifier: {
|
|
42
|
+
oid: string;
|
|
43
|
+
name: string;
|
|
44
|
+
};
|
|
45
|
+
value: any;
|
|
46
|
+
};
|
|
47
|
+
export interface SubjectPublicKeyInfo {
|
|
48
|
+
algorithm: string;
|
|
49
|
+
keyLength: PublicKeyLength;
|
|
50
|
+
subjectPublicKey: SubjectPublicKey;
|
|
51
|
+
}
|
|
52
|
+
export interface BasicConstraints {
|
|
53
|
+
critical: boolean;
|
|
54
|
+
cA: boolean;
|
|
55
|
+
pathLengthConstraint?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface AuthorityKeyIdentifier {
|
|
58
|
+
keyIdentifier: string | null;
|
|
59
|
+
authorityCertIssuer: DirectoryName | null;
|
|
60
|
+
authorityCertIssuerFingerPrint: string;
|
|
61
|
+
serial: string | null;
|
|
62
|
+
}
|
|
63
|
+
export interface CertificateExtension {
|
|
64
|
+
basicConstraints: BasicConstraints;
|
|
65
|
+
subjectKeyIdentifier?: string;
|
|
66
|
+
authorityKeyIdentifier?: AuthorityKeyIdentifier;
|
|
67
|
+
keyUsage?: X509KeyUsage;
|
|
68
|
+
extKeyUsage?: X509ExtKeyUsage;
|
|
69
|
+
subjectAltName?: any;
|
|
70
|
+
}
|
|
71
|
+
export interface TbsCertificate {
|
|
72
|
+
version: number;
|
|
73
|
+
serialNumber: string;
|
|
74
|
+
issuer: any;
|
|
75
|
+
signature: AlgorithmIdentifier;
|
|
76
|
+
validity: Validity;
|
|
77
|
+
subject: DirectoryName;
|
|
78
|
+
subjectFingerPrint: string;
|
|
79
|
+
subjectPublicKeyInfo: SubjectPublicKeyInfo;
|
|
80
|
+
extensions: CertificateExtension | null;
|
|
81
|
+
}
|
|
82
|
+
export declare function readTbsCertificate(buffer: Buffer, block: BlockInfo): TbsCertificate;
|
|
83
|
+
export interface CertificateInternals {
|
|
84
|
+
tbsCertificate: TbsCertificate;
|
|
85
|
+
signatureAlgorithm: AlgorithmIdentifier;
|
|
86
|
+
signatureValue: SignatureValue;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* explore a certificate structure
|
|
90
|
+
* @param certificate
|
|
91
|
+
* @returns a json object that exhibits the internal data of the certificate
|
|
92
|
+
*/
|
|
93
|
+
export declare function exploreCertificate(certificate: Certificate): CertificateInternals;
|
|
94
|
+
/**
|
|
95
|
+
* @method split_der
|
|
96
|
+
* split a multi chain certificates
|
|
97
|
+
* @param certificateChain the certificate chain in der (binary) format}
|
|
98
|
+
* @returns an array of Der , each element of the array is one certificate of the chain
|
|
99
|
+
*/
|
|
100
|
+
export declare function split_der(certificateChain: Certificate): Certificate[];
|
|
101
|
+
/**
|
|
102
|
+
* @method combine_der
|
|
103
|
+
* combine an array of certificates into a single blob
|
|
104
|
+
* @param certificates a array with the individual DER certificates of the chain
|
|
105
|
+
* @return a concatenated buffer containing the certificates
|
|
106
|
+
*/
|
|
107
|
+
export declare function combine_der(certificates: Certificate[]): Certificate;
|