node-opcua-crypto 1.7.4 → 1.9.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 +32 -32
- package/.prettierrc.js +6 -6
- package/LICENSE +22 -22
- package/README.md +14 -14
- package/dist/asn1.d.ts +69 -0
- package/dist/asn1.js +349 -0
- package/dist/asn1.js.map +1 -0
- package/dist/buffer_utils.d.ts +6 -0
- package/dist/buffer_utils.js +22 -0
- package/dist/buffer_utils.js.map +1 -0
- package/dist/common.d.ts +11 -0
- package/dist/common.js +3 -0
- package/dist/common.js.map +1 -0
- package/dist/crypto_explore_certificate.d.ts +95 -0
- package/dist/crypto_explore_certificate.js +547 -0
- package/dist/crypto_explore_certificate.js.map +1 -0
- package/dist/crypto_utils.d.ts +106 -0
- package/dist/crypto_utils.js +370 -0
- package/dist/crypto_utils.js.map +1 -0
- package/dist/derived_keys.d.ts +72 -0
- package/dist/derived_keys.js +247 -0
- package/dist/derived_keys.js.map +1 -0
- package/dist/explore_certificate.d.ts +30 -0
- package/dist/explore_certificate.js +44 -0
- package/dist/explore_certificate.js.map +1 -0
- package/dist/explore_certificate_revocation_list.d.ts +30 -0
- package/dist/explore_certificate_revocation_list.js +67 -0
- package/dist/explore_certificate_revocation_list.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/oid_map.d.ts +7 -0
- package/dist/oid_map.js +262 -0
- package/dist/oid_map.js.map +1 -0
- package/dist/source/asn1.d.ts +73 -73
- package/dist/source/asn1.js +359 -359
- package/dist/source/buffer_utils.d.ts +6 -5
- package/dist/source/buffer_utils.js +21 -21
- package/dist/source/common.d.ts +12 -12
- package/dist/source/common.js +2 -2
- package/dist/source/crypto_explore_certificate.d.ts +107 -107
- package/dist/source/crypto_explore_certificate.js +600 -600
- package/dist/source/crypto_utils.d.ts +78 -78
- package/dist/source/crypto_utils.js +280 -280
- package/dist/source/derived_keys.d.ts +72 -72
- package/dist/source/derived_keys.js +248 -245
- package/dist/source/derived_keys.js.map +1 -1
- 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 +44 -44
- 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 +96 -96
- package/dist/source/index.d.ts +13 -13
- package/dist/source/index.js +25 -25
- 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 +16 -16
- 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 +15 -15
- package/dist/source_nodejs/read.d.ts +29 -29
- package/dist/source_nodejs/read.js +94 -94
- 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/dist/verify_cerficate_signature.d.ts +10 -0
- package/dist/verify_cerficate_signature.js +102 -0
- package/dist/verify_cerficate_signature.js.map +1 -0
- package/index.d.ts +2 -2
- package/index.js +4 -4
- package/index_web.js +3 -3
- package/package.json +17 -17
- package/source/asn1.ts +404 -404
- package/source/buffer_utils.ts +18 -18
- package/source/common.ts +13 -13
- package/source/crypto_explore_certificate.ts +763 -763
- package/source/crypto_utils.ts +321 -321
- package/source/derived_keys.ts +287 -284
- package/source/explore_certificate.ts +66 -66
- package/source/explore_certificate_revocation_list.ts +93 -93
- package/source/explore_certificate_signing_request.ts +58 -58
- package/source/explore_private_key.ts +121 -121
- package/source/index.ts +13 -13
- package/source/oid_map.ts +310 -310
- package/source/public_private_match.ts +17 -17
- package/source/verify_certificate_signature.ts +105 -105
- package/source_nodejs/index.ts +2 -2
- package/source_nodejs/read.ts +95 -95
- 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/pnpm-lock.yaml +0 -1689
|
@@ -0,0 +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
|
+
};
|
|
22
|
+
//# sourceMappingURL=buffer_utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer_utils.js","sourceRoot":"","sources":["../lib/buffer_utils.ts"],"names":[],"mappings":";;;AAAA,EAAE;AACF,8FAA8F;AAC9F,4DAA4D;AAC5D,kEAAkE;AAClE,EAAE;AACF,iFAAiF;AACjF,2BAA2B;AAC3B,EAAE;AACF;;;GAGG;AACU,QAAA,6BAA6B,GAAG,MAAM,CAAC,WAAW;IAC3D,CAAC,CAAC,MAAM,CAAC,WAAW;IACpB,CAAC,CAAC,CAAC,IAAY,EAAU,EAAE;QACvB,uBAAuB;QACvB,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC"}
|
package/dist/common.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare type Nonce = Buffer;
|
|
3
|
+
export declare type PEM = string;
|
|
4
|
+
export declare type DER = Buffer;
|
|
5
|
+
export declare type Certificate = DER;
|
|
6
|
+
export declare type CertificatePEM = PEM;
|
|
7
|
+
export declare type PrivateKey = DER;
|
|
8
|
+
export declare type PrivateKeyPEM = PEM;
|
|
9
|
+
export declare type PublicKey = DER;
|
|
10
|
+
export declare type PublicKeyPEM = PEM;
|
|
11
|
+
export declare type Signature = Buffer;
|
package/dist/common.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../lib/common.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module node_opcua_crypto
|
|
3
|
+
*/
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
import { AlgorithmIdentifier, SignatureValue, DirectoryName } from "./asn1";
|
|
6
|
+
import { Certificate, PrivateKey } 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 KeyUsage {
|
|
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 ExtKeyUsage {
|
|
27
|
+
clientAuth: boolean;
|
|
28
|
+
serverAuth: boolean;
|
|
29
|
+
codeSigning: boolean;
|
|
30
|
+
emailProtection: boolean;
|
|
31
|
+
timeStamping: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface SubjectPublicKeyInfo {
|
|
34
|
+
algorithm: string;
|
|
35
|
+
keyLength: PublicKeyLength;
|
|
36
|
+
subjectPublicKey: Buffer;
|
|
37
|
+
}
|
|
38
|
+
export interface BasicConstraints {
|
|
39
|
+
critical: boolean;
|
|
40
|
+
cA: boolean;
|
|
41
|
+
pathLengthConstraint?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface AuthorithyKeyIdentifier {
|
|
44
|
+
keyIdentifier: string | null;
|
|
45
|
+
authorityCertIssuer: DirectoryName | null;
|
|
46
|
+
authorityCertIssuerFingerPrint: string;
|
|
47
|
+
serial: string | null;
|
|
48
|
+
}
|
|
49
|
+
export interface CertificateExtension {
|
|
50
|
+
basicConstraints: BasicConstraints;
|
|
51
|
+
subjectKeyIdentifier?: string;
|
|
52
|
+
authorityKeyIdentifier?: AuthorithyKeyIdentifier;
|
|
53
|
+
keyUsage?: KeyUsage;
|
|
54
|
+
extKeyUsage?: KeyUsage;
|
|
55
|
+
subjectAltName?: any;
|
|
56
|
+
}
|
|
57
|
+
export interface TbsCertificate {
|
|
58
|
+
version: number;
|
|
59
|
+
serialNumber: string;
|
|
60
|
+
issuer: any;
|
|
61
|
+
signature: AlgorithmIdentifier;
|
|
62
|
+
validity: Validity;
|
|
63
|
+
subject: DirectoryName;
|
|
64
|
+
subjectFingerPrint: string;
|
|
65
|
+
subjectPublicKeyInfo: SubjectPublicKeyInfo;
|
|
66
|
+
extensions: CertificateExtension | null;
|
|
67
|
+
}
|
|
68
|
+
export interface CertificateInternals {
|
|
69
|
+
tbsCertificate: TbsCertificate;
|
|
70
|
+
signatureAlgorithm: AlgorithmIdentifier;
|
|
71
|
+
signatureValue: SignatureValue;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* explore a certificate structure
|
|
75
|
+
* @param certificate
|
|
76
|
+
* @returns a json object that exhibits the internal data of the certificate
|
|
77
|
+
*/
|
|
78
|
+
export declare function exploreCertificate(certificate: Certificate): CertificateInternals;
|
|
79
|
+
export interface PrivateKeyInternals {
|
|
80
|
+
}
|
|
81
|
+
export declare function explorePrivateKey(privateKey: PrivateKey): PrivateKeyInternals;
|
|
82
|
+
/**
|
|
83
|
+
* @method split_der
|
|
84
|
+
* split a multi chain certificates
|
|
85
|
+
* @param certificateChain the certificate chain in der (binary) format}
|
|
86
|
+
* @returns an array of Der , each element of the array is one certificate of the chain
|
|
87
|
+
*/
|
|
88
|
+
export declare function split_der(certificateChain: Certificate): Certificate[];
|
|
89
|
+
/**
|
|
90
|
+
* @method combine_der
|
|
91
|
+
* combine an array of certificates into a single blob
|
|
92
|
+
* @param certificates a array with the individual DER certificates of the chain
|
|
93
|
+
* @return a concatenated buffer containing the certificates
|
|
94
|
+
*/
|
|
95
|
+
export declare function combine_der(certificates: Certificate[]): Certificate;
|