node-opcua-crypto 1.8.0 → 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.
Files changed (115) hide show
  1. package/.fossa.yml +18 -18
  2. package/.github/FUNDING.yml +12 -12
  3. package/.github/workflows/main.yml +32 -0
  4. package/.prettierrc.js +6 -6
  5. package/LICENSE +22 -22
  6. package/README.md +14 -14
  7. package/dist/asn1.d.ts +69 -0
  8. package/dist/asn1.js +349 -0
  9. package/dist/asn1.js.map +1 -0
  10. package/dist/buffer_utils.d.ts +6 -0
  11. package/dist/buffer_utils.js +22 -0
  12. package/dist/buffer_utils.js.map +1 -0
  13. package/dist/common.d.ts +11 -0
  14. package/dist/common.js +3 -0
  15. package/dist/common.js.map +1 -0
  16. package/dist/crypto_explore_certificate.d.ts +95 -0
  17. package/dist/crypto_explore_certificate.js +547 -0
  18. package/dist/crypto_explore_certificate.js.map +1 -0
  19. package/dist/crypto_utils.d.ts +106 -0
  20. package/dist/crypto_utils.js +370 -0
  21. package/dist/crypto_utils.js.map +1 -0
  22. package/dist/derived_keys.d.ts +72 -0
  23. package/dist/derived_keys.js +247 -0
  24. package/dist/derived_keys.js.map +1 -0
  25. package/dist/explore_certificate.d.ts +30 -0
  26. package/dist/explore_certificate.js +44 -0
  27. package/dist/explore_certificate.js.map +1 -0
  28. package/dist/explore_certificate_revocation_list.d.ts +30 -0
  29. package/dist/explore_certificate_revocation_list.js +67 -0
  30. package/dist/explore_certificate_revocation_list.js.map +1 -0
  31. package/dist/index.d.ts +10 -0
  32. package/dist/index.js +23 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/oid_map.d.ts +7 -0
  35. package/dist/oid_map.js +262 -0
  36. package/dist/oid_map.js.map +1 -0
  37. package/dist/source/asn1.d.ts +73 -72
  38. package/dist/source/asn1.js +359 -350
  39. package/dist/source/asn1.js.map +1 -1
  40. package/dist/source/buffer_utils.d.ts +6 -6
  41. package/dist/source/buffer_utils.js +21 -21
  42. package/dist/source/common.d.ts +12 -12
  43. package/dist/source/common.js +2 -2
  44. package/dist/source/crypto_explore_certificate.d.ts +107 -107
  45. package/dist/source/crypto_explore_certificate.js +600 -571
  46. package/dist/source/crypto_explore_certificate.js.map +1 -1
  47. package/dist/source/crypto_utils.d.ts +78 -78
  48. package/dist/source/crypto_utils.js +280 -280
  49. package/dist/source/crypto_utils.js.map +1 -1
  50. package/dist/source/derived_keys.d.ts +72 -72
  51. package/dist/source/derived_keys.js +248 -245
  52. package/dist/source/derived_keys.js.map +1 -1
  53. package/dist/source/explore_certificate.d.ts +30 -30
  54. package/dist/source/explore_certificate.js +43 -43
  55. package/dist/source/explore_certificate.js.map +1 -1
  56. package/dist/source/explore_certificate_revocation_list.d.ts +28 -28
  57. package/dist/source/explore_certificate_revocation_list.js +44 -44
  58. package/dist/source/explore_certificate_revocation_list.js.map +1 -1
  59. package/dist/source/explore_certificate_signing_request.d.ts +13 -13
  60. package/dist/source/explore_certificate_signing_request.js +44 -44
  61. package/dist/source/explore_certificate_signing_request.js.map +1 -1
  62. package/dist/source/explore_private_key.d.ts +29 -29
  63. package/dist/source/explore_private_key.js +96 -96
  64. package/dist/source/explore_private_key.js.map +1 -1
  65. package/dist/source/index.d.ts +13 -13
  66. package/dist/source/index.js +25 -25
  67. package/dist/source/oid_map.d.ts +7 -7
  68. package/dist/source/oid_map.js +303 -261
  69. package/dist/source/oid_map.js.map +1 -1
  70. package/dist/source/public_private_match.d.ts +3 -3
  71. package/dist/source/public_private_match.js +16 -16
  72. package/dist/source/public_private_match.js.map +1 -1
  73. package/dist/source/verify_certificate_signature.d.ts +10 -10
  74. package/dist/source/verify_certificate_signature.js +101 -101
  75. package/dist/source/verify_certificate_signature.js.map +1 -1
  76. package/dist/source_nodejs/index.d.ts +3 -3
  77. package/dist/source_nodejs/index.js +15 -15
  78. package/dist/source_nodejs/read.d.ts +29 -29
  79. package/dist/source_nodejs/read.js +94 -94
  80. package/dist/source_nodejs/read.js.map +1 -1
  81. package/dist/source_nodejs/read_certificate_revocation_list.d.ts +2 -2
  82. package/dist/source_nodejs/read_certificate_revocation_list.js +27 -27
  83. package/dist/source_nodejs/read_certificate_revocation_list.js.map +1 -1
  84. package/dist/source_nodejs/read_certificate_signing_request.d.ts +3 -3
  85. package/dist/source_nodejs/read_certificate_signing_request.js +27 -27
  86. package/dist/source_nodejs/read_certificate_signing_request.js.map +1 -1
  87. package/dist/verify_cerficate_signature.d.ts +10 -0
  88. package/dist/verify_cerficate_signature.js +102 -0
  89. package/dist/verify_cerficate_signature.js.map +1 -0
  90. package/index.d.ts +2 -2
  91. package/index.js +4 -4
  92. package/index_web.js +3 -3
  93. package/package.json +19 -22
  94. package/source/asn1.ts +404 -398
  95. package/source/buffer_utils.ts +18 -18
  96. package/source/common.ts +13 -13
  97. package/source/crypto_explore_certificate.ts +763 -728
  98. package/source/crypto_utils.ts +321 -321
  99. package/source/derived_keys.ts +287 -284
  100. package/source/explore_certificate.ts +66 -66
  101. package/source/explore_certificate_revocation_list.ts +93 -93
  102. package/source/explore_certificate_signing_request.ts +58 -58
  103. package/source/explore_private_key.ts +121 -121
  104. package/source/index.ts +13 -13
  105. package/source/oid_map.ts +310 -265
  106. package/source/public_private_match.ts +17 -17
  107. package/source/verify_certificate_signature.ts +105 -105
  108. package/source_nodejs/index.ts +2 -2
  109. package/source_nodejs/read.ts +95 -95
  110. package/source_nodejs/read_certificate_revocation_list.ts +14 -14
  111. package/source_nodejs/read_certificate_signing_request.ts +17 -17
  112. package/test_certificate.ts +34 -34
  113. package/tsconfig.json +18 -18
  114. package/tslint.json +34 -34
  115. package/pnpm-lock.yaml +0 -1767
@@ -0,0 +1,247 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.verifyChunkSignatureWithDerivedKeys = exports.makeMessageChunkSignatureWithDerivedKeys = exports.decryptBufferWithDerivedKeys = exports.encryptBufferWithDerivedKeys = exports.computePaddingFooter = exports.verifyChunkSignature = exports.removePadding = exports.reduceLength = exports.computeDerivedKeys = exports.makePseudoRandomBuffer = void 0;
4
+ /**
5
+ * @module node_opcua_crypto
6
+ */
7
+ const crypto = require("crypto");
8
+ const _ = require("underscore");
9
+ const buffer_utils_1 = require("./buffer_utils");
10
+ const crypto_utils_1 = require("./crypto_utils");
11
+ const explore_certificate_1 = require("./explore_certificate");
12
+ const assert = require("assert");
13
+ function HMAC_HASH(sha1or256, secret, message) {
14
+ return crypto.createHmac(sha1or256, secret).update(message).digest();
15
+ }
16
+ function plus(buf1, buf2) {
17
+ return Buffer.concat([buf1, buf2]);
18
+ }
19
+ // OPC-UA Spec 1.02 part 6 - 6.7.5 Deriving Keys page 42
20
+ // Once the SecureChannel is established the Messages are signed and encrypted with keys derived
21
+ // from the Nonces exchanged in t he OpenSecureChannel call. These keys are derived by passing the
22
+ // Nonces to a pseudo - random function which produces a sequence of bytes from a set of inputs. A
23
+ // pseudo- random function is represented by the following function declaration:
24
+ // Byte[] PRF(
25
+ // Byte[] secret,
26
+ // Byte[] seed,
27
+ // Int32 length,
28
+ // Int32 offset
29
+ // )
30
+ // Where length is the number of bytes to return and offset is a number of bytes from the beginning of
31
+ // the sequence.
32
+ // The lengths of the keys that need to be generated depend on the SecurityPolicy used for the
33
+ // channel. The following information is specified by the SecurityPolicy:
34
+ // a) SigningKeyLength (from the DerivedSignatureKeyLength);
35
+ // b) EncryptingKeyLength (implied by the SymmetricEncryptionAlgorithm);
36
+ // c) EncryptingBlockSize (implied by the SymmetricEncryptionAlgorithm).
37
+ // The parameters passed to the pseudo random function are specified in Table 36.
38
+ // Table 36 - Cryptography Key Generation Parameters
39
+ //
40
+ // Key Secret Seed Length Offset
41
+ // ClientSigningKey ServerNonce ClientNonce SigningKeyLength 0
42
+ // ClientEncryptingKey ServerNonce ClientNonce EncryptingKeyLength SigningKeyLength
43
+ // ClientInitializationVector ServerNonce ClientNonce EncryptingBlockSize SigningKeyLength+ EncryptingKeyLength
44
+ // ServerSigningKey ClientNonce ServerNonce SigningKeyLength 0
45
+ // ServerEncryptingKey ClientNonce ServerNonce EncryptingKeyLength SigningKeyLength
46
+ // ServerInitializationVector ClientNonce ServerNonce EncryptingBlockSize SigningKeyLength+ EncryptingKeyLength
47
+ //
48
+ // The Client keys are used to secure Messages sent by the Client. The Server keys are used to
49
+ // secure Messages sent by the Server.
50
+ // The SSL/TLS specification defines a pseudo random function called P_HASH which is used for this purpose.
51
+ //
52
+ // The P_HASH algorithm is defined as follows:
53
+ //
54
+ // P_HASH(secret, seed) = HMAC_HASH(secret, A(1) + seed) +
55
+ // HMAC_HASH(secret, A(2) + seed) +
56
+ // HMAC_HASH(secret, A(3) + seed) + ...
57
+ // Where A(n) is defined as:
58
+ // A(0) = seed
59
+ // A(n) = HMAC_HASH(secret, A(n-1))
60
+ // + indicates that the results are appended to previous results.
61
+ // Where HASH is a hash function such as SHA1 or SHA256. The hash function to use depends on the SecurityPolicyUri.
62
+ //
63
+ //
64
+ // see also http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/ws-secureconversation-1.3-os.html
65
+ // http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
66
+ function makePseudoRandomBuffer(secret, seed, minLength, sha1or256) {
67
+ assert(seed instanceof Buffer);
68
+ assert(sha1or256 === "SHA1" || sha1or256 === "SHA256");
69
+ const a = [];
70
+ a[0] = seed;
71
+ let index = 1;
72
+ let p_hash = buffer_utils_1.createFastUninitializedBuffer(0);
73
+ while (p_hash.length <= minLength) {
74
+ /* eslint new-cap:0 */
75
+ a[index] = HMAC_HASH(sha1or256, secret, a[index - 1]);
76
+ p_hash = plus(p_hash, HMAC_HASH(sha1or256, secret, plus(a[index], seed)));
77
+ index += 1;
78
+ }
79
+ return p_hash.slice(0, minLength);
80
+ }
81
+ exports.makePseudoRandomBuffer = makePseudoRandomBuffer;
82
+ function computeDerivedKeys(secret, seed, options) {
83
+ assert(_.isFinite(options.signatureLength));
84
+ assert(_.isFinite(options.encryptingKeyLength));
85
+ assert(_.isFinite(options.encryptingBlockSize));
86
+ assert(typeof options.algorithm === "string");
87
+ options.sha1or256 = options.sha1or256 || "SHA1";
88
+ assert(typeof options.sha1or256 === "string");
89
+ const offset1 = options.signingKeyLength;
90
+ const offset2 = offset1 + options.encryptingKeyLength;
91
+ const minLength = offset2 + options.encryptingBlockSize;
92
+ const buf = makePseudoRandomBuffer(secret, seed, minLength, options.sha1or256);
93
+ return {
94
+ signatureLength: options.signatureLength,
95
+ signingKeyLength: options.signingKeyLength,
96
+ encryptingKeyLength: options.encryptingKeyLength,
97
+ encryptingBlockSize: options.encryptingBlockSize,
98
+ algorithm: options.algorithm,
99
+ sha1or256: options.sha1or256,
100
+ signingKey: buf.slice(0, offset1),
101
+ encryptingKey: buf.slice(offset1, offset2),
102
+ initializationVector: buf.slice(offset2, minLength),
103
+ };
104
+ }
105
+ exports.computeDerivedKeys = computeDerivedKeys;
106
+ /**
107
+ * @method reduceLength
108
+ * @param buffer
109
+ * @param byteToRemove
110
+ * @return buffer
111
+ */
112
+ function reduceLength(buffer, byteToRemove) {
113
+ return buffer.slice(0, buffer.length - byteToRemove);
114
+ }
115
+ exports.reduceLength = reduceLength;
116
+ /**
117
+ * @method removePadding
118
+ * @param buffer
119
+ * @return buffer with padding removed
120
+ */
121
+ function removePadding(buffer) {
122
+ const nbPaddingBytes = buffer.readUInt8(buffer.length - 1) + 1;
123
+ return reduceLength(buffer, nbPaddingBytes);
124
+ }
125
+ exports.removePadding = removePadding;
126
+ /**
127
+ * @method verifyChunkSignature
128
+ *
129
+ * const signer = {
130
+ * signatureLength : 128,
131
+ * algorithm : "RSA-SHA256",
132
+ * public_key: "qsdqsdqsd"
133
+ * };
134
+ *
135
+ * @param chunk The message chunk to verify.
136
+ * @param options
137
+ * @param options.signatureLength
138
+ * @param options.algorithm the algorithm.
139
+ * @param options.publicKey
140
+ * @return {*}
141
+ */
142
+ function verifyChunkSignature(chunk, options) {
143
+ assert(chunk instanceof Buffer);
144
+ let signatureLength = options.signatureLength || 0;
145
+ if (signatureLength === 0) {
146
+ // let's get the signatureLength by checking the size
147
+ // of the certificate's public key
148
+ const cert = explore_certificate_1.exploreCertificateInfo(options.publicKey);
149
+ signatureLength = cert.publicKeyLength || 0; // 1024 bits = 128Bytes or 2048=256Bytes
150
+ }
151
+ const block_to_verify = chunk.slice(0, chunk.length - signatureLength);
152
+ const signature = chunk.slice(chunk.length - signatureLength);
153
+ return crypto_utils_1.verifyMessageChunkSignature(block_to_verify, signature, options);
154
+ }
155
+ exports.verifyChunkSignature = verifyChunkSignature;
156
+ // /**
157
+ // * extract the public key from a certificate - using the pem module
158
+ // *
159
+ // * @method extractPublicKeyFromCertificate_WithPem
160
+ // * @async
161
+ // * @param certificate
162
+ // * @param callback {Function}
163
+ // * @param callback.err
164
+ // * @param callback.publicKey as pem
165
+ // */
166
+ // exports.extractPublicKeyFromCertificate_WithPem = function (certificate, callback) {
167
+ //
168
+ // const err1 = new Error();
169
+ // const cert_pem = crypto_utils.toPem(certificate, "CERTIFICATE");
170
+ // require("pem").getPublicKey(cert_pem, function (err, data) {
171
+ // if (err) {
172
+ // console.log(err1.stack);
173
+ // console.log(" CANNOT EXTRAT PUBLIC KEY from Certificate".red, certificate);
174
+ // return callback(err);
175
+ // }
176
+ // callback(err, data.publicKey);
177
+ // });
178
+ // };
179
+ //
180
+ function computePaddingFooter(buffer, derivedKeys) {
181
+ assert(derivedKeys.hasOwnProperty("encryptingBlockSize"));
182
+ const paddingSize = derivedKeys.encryptingBlockSize - ((buffer.length + 1) % derivedKeys.encryptingBlockSize);
183
+ const padding = buffer_utils_1.createFastUninitializedBuffer(paddingSize + 1);
184
+ padding.fill(paddingSize);
185
+ return padding;
186
+ }
187
+ exports.computePaddingFooter = computePaddingFooter;
188
+ function derivedKeys_algorithm(derivedKeys) {
189
+ assert(derivedKeys.hasOwnProperty("algorithm"));
190
+ const algorithm = derivedKeys.algorithm || "aes-128-cbc";
191
+ assert(algorithm === "aes-128-cbc" || algorithm === "aes-256-cbc");
192
+ return algorithm;
193
+ }
194
+ function encryptBufferWithDerivedKeys(buffer, derivedKeys) {
195
+ const algorithm = derivedKeys_algorithm(derivedKeys);
196
+ const key = derivedKeys.encryptingKey;
197
+ const initVector = derivedKeys.initializationVector;
198
+ const cypher = crypto.createCipheriv(algorithm, key, initVector);
199
+ cypher.setAutoPadding(false);
200
+ const encrypted_chunks = [];
201
+ encrypted_chunks.push(cypher.update(buffer));
202
+ encrypted_chunks.push(cypher.final());
203
+ return Buffer.concat(encrypted_chunks);
204
+ }
205
+ exports.encryptBufferWithDerivedKeys = encryptBufferWithDerivedKeys;
206
+ function decryptBufferWithDerivedKeys(buffer, derivedKeys) {
207
+ const algorithm = derivedKeys_algorithm(derivedKeys);
208
+ const key = derivedKeys.encryptingKey;
209
+ const initVector = derivedKeys.initializationVector;
210
+ const cypher = crypto.createDecipheriv(algorithm, key, initVector);
211
+ cypher.setAutoPadding(false);
212
+ const decrypted_chunks = [];
213
+ decrypted_chunks.push(cypher.update(buffer));
214
+ decrypted_chunks.push(cypher.final());
215
+ return Buffer.concat(decrypted_chunks);
216
+ }
217
+ exports.decryptBufferWithDerivedKeys = decryptBufferWithDerivedKeys;
218
+ /**
219
+ * @method makeMessageChunkSignatureWithDerivedKeys
220
+ * @param message
221
+ * @param derivedKeys
222
+ * @return
223
+ */
224
+ function makeMessageChunkSignatureWithDerivedKeys(message, derivedKeys) {
225
+ assert(message instanceof Buffer);
226
+ assert(derivedKeys.signingKey instanceof Buffer);
227
+ assert(typeof derivedKeys.sha1or256 === "string");
228
+ assert(derivedKeys.sha1or256 === "SHA1" || derivedKeys.sha1or256 === "SHA256");
229
+ const signature = crypto.createHmac(derivedKeys.sha1or256, derivedKeys.signingKey).update(message).digest();
230
+ assert(signature.length === derivedKeys.signatureLength);
231
+ return signature;
232
+ }
233
+ exports.makeMessageChunkSignatureWithDerivedKeys = makeMessageChunkSignatureWithDerivedKeys;
234
+ /**
235
+ * @method verifyChunkSignatureWithDerivedKeys
236
+ * @param chunk
237
+ * @param derivedKeys
238
+ * @return
239
+ */
240
+ function verifyChunkSignatureWithDerivedKeys(chunk, derivedKeys) {
241
+ const message = chunk.slice(0, chunk.length - derivedKeys.signatureLength);
242
+ const signature = chunk.slice(chunk.length - derivedKeys.signatureLength);
243
+ const verif = makeMessageChunkSignatureWithDerivedKeys(message, derivedKeys);
244
+ return verif.toString("hex") === signature.toString("hex");
245
+ }
246
+ exports.verifyChunkSignatureWithDerivedKeys = verifyChunkSignatureWithDerivedKeys;
247
+ //# sourceMappingURL=derived_keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derived_keys.js","sourceRoot":"","sources":["../lib/derived_keys.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,iCAAiC;AACjC,gCAAgC;AAEhC,iDAA+D;AAE/D,iDAAiG;AACjG,+DAA+D;AAC/D,iCAAiC;AAEjC,SAAS,SAAS,CAAC,SAA4B,EAAE,MAAc,EAAE,OAAe;IAC5E,OAAO,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;AACzE,CAAC;AAED,SAAS,IAAI,CAAC,IAAY,EAAE,IAAY;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,yDAAyD;AACzD,oGAAoG;AACpG,sGAAsG;AACtG,qGAAqG;AACrG,iFAAiF;AACjF,cAAc;AACd,qBAAqB;AACrB,mBAAmB;AACnB,oBAAoB;AACpB,mBAAmB;AACnB,IAAI;AACJ,0GAA0G;AAC1G,gBAAgB;AAChB,gGAAgG;AAChG,6EAA6E;AAC7E,kEAAkE;AAClE,8EAA8E;AAC9E,8EAA8E;AAC9E,oFAAoF;AACpF,sDAAsD;AACtD,EAAE;AACF,oFAAoF;AACpF,+EAA+E;AAC/E,8FAA8F;AAC9F,mHAAmH;AACnH,+EAA+E;AAC/E,8FAA8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,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5G,MAAM,CAAC,SAAS,CAAC,MAAM,KAAK,WAAW,CAAC,eAAe,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC;AACrB,CAAC;AARD,4FAQC;AAED;;;;;GAKG;AACH,SAAgB,mCAAmC,CAAC,KAAa,EAAE,WAAwB;IACvF,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;IAC3E,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;IAC1E,MAAM,KAAK,GAAG,wCAAwC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC7E,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC;AALD,kFAKC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @module node_opcua_crypto
3
+ */
4
+ /// <reference types="node" />
5
+ import { Certificate, CertificatePEM } from "./common";
6
+ import { DirectoryName } from "./asn1";
7
+ export declare type PublicKeyLength = 128 | 256 | 384 | 512;
8
+ /**
9
+ * A structure exposing useful information about a certificate
10
+ */
11
+ export interface CertificateInfo {
12
+ /** the public key length in bits */
13
+ publicKeyLength: PublicKeyLength;
14
+ /** the date at which the certificate starts to be valid */
15
+ notBefore: Date;
16
+ /** the date after which the certificate is not valid any more */
17
+ notAfter: Date;
18
+ /** info about certificate owner */
19
+ subject: DirectoryName;
20
+ /** public key */
21
+ publicKey: Buffer;
22
+ }
23
+ export declare function coerceCertificate(certificate: Certificate | CertificatePEM): Certificate;
24
+ /**
25
+ * @method exploreCertificateInfo
26
+ * returns useful information about the certificate such as public key length, start date and end of validity date,
27
+ * and CN
28
+ * @param certificate the certificate to explore
29
+ */
30
+ export declare function exploreCertificateInfo(certificate: Certificate | CertificatePEM): CertificateInfo;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * @module node_opcua_crypto
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.exploreCertificateInfo = exports.coerceCertificate = void 0;
7
+ const crypto_explore_certificate_1 = require("./crypto_explore_certificate");
8
+ const crypto_utils_1 = require("./crypto_utils");
9
+ const assert = require("assert");
10
+ function coerceCertificate(certificate) {
11
+ if (typeof certificate === "string") {
12
+ certificate = crypto_utils_1.convertPEMtoDER(certificate);
13
+ }
14
+ assert(certificate instanceof Buffer);
15
+ return certificate;
16
+ }
17
+ exports.coerceCertificate = coerceCertificate;
18
+ /**
19
+ * @method exploreCertificateInfo
20
+ * returns useful information about the certificate such as public key length, start date and end of validity date,
21
+ * and CN
22
+ * @param certificate the certificate to explore
23
+ */
24
+ function exploreCertificateInfo(certificate) {
25
+ certificate = coerceCertificate(certificate);
26
+ const certInfo = crypto_explore_certificate_1.exploreCertificate(certificate);
27
+ const data = {
28
+ publicKeyLength: certInfo.tbsCertificate.subjectPublicKeyInfo.keyLength,
29
+ notBefore: certInfo.tbsCertificate.validity.notBefore,
30
+ notAfter: certInfo.tbsCertificate.validity.notAfter,
31
+ publicKey: certInfo.tbsCertificate.subjectPublicKeyInfo.subjectPublicKey,
32
+ subject: certInfo.tbsCertificate.subject,
33
+ };
34
+ // istanbul ignore next
35
+ if (!(data.publicKeyLength === 512 ||
36
+ data.publicKeyLength === 384 ||
37
+ data.publicKeyLength === 256 ||
38
+ data.publicKeyLength === 128)) {
39
+ throw new Error("Invalid public key length (expecting 128,256,384 or 512)" + data.publicKeyLength);
40
+ }
41
+ return data;
42
+ }
43
+ exports.exploreCertificateInfo = exploreCertificateInfo;
44
+ //# sourceMappingURL=explore_certificate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explore_certificate.js","sourceRoot":"","sources":["../lib/explore_certificate.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAGH,6EAAwF;AAExF,iDAAiD;AACjD,iCAAiC;AAoBjC,SAAgB,iBAAiB,CAAC,WAAyC;IACvE,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACjC,WAAW,GAAG,8BAAe,CAAC,WAAW,CAAC,CAAC;KAC9C;IACD,MAAM,CAAC,WAAW,YAAY,MAAM,CAAC,CAAC;IACtC,OAAO,WAAW,CAAC;AACvB,CAAC;AAND,8CAMC;AAED;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,WAAyC;IAC5E,WAAW,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAE7C,MAAM,QAAQ,GAAG,+CAAkB,CAAC,WAAW,CAAC,CAAC;IACjD,MAAM,IAAI,GAAoB;QAC1B,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAC,SAAS;QACvE,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS;QACrD,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ;QACnD,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAC,gBAAgB;QACxE,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO;KAC3C,CAAC;IACF,uBAAuB;IACvB,IACI,CAAC,CACG,IAAI,CAAC,eAAe,KAAK,GAAG;QAC5B,IAAI,CAAC,eAAe,KAAK,GAAG;QAC5B,IAAI,CAAC,eAAe,KAAK,GAAG;QAC5B,IAAI,CAAC,eAAe,KAAK,GAAG,CAC/B,EACH;QACE,MAAM,IAAI,KAAK,CAAC,0DAA0D,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC;KACtG;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAvBD,wDAuBC"}
@@ -0,0 +1,30 @@
1
+ /// <reference types="node" />
2
+ import { AlgorithmIdentifier, BlockInfo, DirectoryName } from "./asn1";
3
+ export declare type Version = string;
4
+ export declare type Name = string;
5
+ export declare type CertificateSerialNumber = string;
6
+ export interface Extensions {
7
+ }
8
+ export interface RevokedCertificate {
9
+ userCertificate: CertificateSerialNumber;
10
+ revocationDate: Date;
11
+ crlEntryExtensions?: Extensions;
12
+ }
13
+ export interface TBSCertList {
14
+ version?: Version;
15
+ signature: AlgorithmIdentifier;
16
+ issuer: Name;
17
+ issuerFingerprint: string;
18
+ thisUpdate: Date;
19
+ nextUpdate?: Date;
20
+ revokedCertificates: RevokedCertificate[];
21
+ }
22
+ export interface CertificateRevocationListInfo {
23
+ tbsCertList: TBSCertList;
24
+ signatureAlgorithm: AlgorithmIdentifier;
25
+ signatureValue: Buffer;
26
+ }
27
+ export declare function readNameForCrl(buffer: Buffer, block: BlockInfo): DirectoryName;
28
+ export declare type CertificateRevocationList = Buffer;
29
+ export declare function readCertificateRevocationList(filename: string): Promise<CertificateRevocationList>;
30
+ export declare function exploreCertificateRevocationList(crl: CertificateRevocationList): CertificateRevocationListInfo;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.exploreCertificateRevocationList = exports.readCertificateRevocationList = exports.readNameForCrl = void 0;
13
+ const fs = require("fs");
14
+ const util_1 = require("util");
15
+ const asn1_1 = require("./asn1");
16
+ const crypto_utils_1 = require("./crypto_utils");
17
+ function readNameForCrl(buffer, block) {
18
+ return asn1_1._readDirectoryName(buffer, block);
19
+ }
20
+ exports.readNameForCrl = readNameForCrl;
21
+ function _readTbsCertList(buffer, blockInfo) {
22
+ const blocks = asn1_1._readStruct(buffer, blockInfo);
23
+ const version = asn1_1._readIntegerValue(buffer, blocks[0]);
24
+ const signature = asn1_1._readAlgorithmIdentifier(buffer, blocks[1]);
25
+ const issuer = readNameForCrl(buffer, blocks[2]);
26
+ const issuerFingerprint = asn1_1.formatBuffer2DigetHexWithColum(crypto_utils_1.makeSHA1Thumbprint(asn1_1._getBlock(buffer, blocks[2])));
27
+ const thisUpdate = asn1_1._readTime(buffer, blocks[3]);
28
+ const nextUpdate = asn1_1._readTime(buffer, blocks[4]);
29
+ const revokedCertificates = [];
30
+ if (blocks[5] && blocks[5].tag < 0x80) {
31
+ const list = asn1_1._readStruct(buffer, blocks[5]);
32
+ for (const r of list) {
33
+ // sometime blocks[5] doesn't exits .. in this case
34
+ const rr = asn1_1._readStruct(buffer, r);
35
+ const userCertificate = asn1_1.formatBuffer2DigetHexWithColum(asn1_1._readLongIntegerValue(buffer, rr[0]));
36
+ const revocationDate = asn1_1._readTime(buffer, rr[1]);
37
+ revokedCertificates.push({
38
+ revocationDate,
39
+ userCertificate,
40
+ });
41
+ }
42
+ }
43
+ const ext0 = asn1_1._findBlockAtIndex(blocks, 0);
44
+ return { issuer, issuerFingerprint, thisUpdate, nextUpdate, signature, revokedCertificates };
45
+ }
46
+ function readCertificateRevocationList(filename) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const crl = yield util_1.promisify(fs.readFile)(filename);
49
+ if (crl[0] === 0x30 && crl[1] === 0x82) {
50
+ // der format
51
+ return crl;
52
+ }
53
+ const raw_crl = crl.toString();
54
+ return crypto_utils_1.convertPEMtoDER(raw_crl);
55
+ });
56
+ }
57
+ exports.readCertificateRevocationList = readCertificateRevocationList;
58
+ function exploreCertificateRevocationList(crl) {
59
+ const blockInfo = asn1_1.readTag(crl, 0);
60
+ const blocks = asn1_1._readStruct(crl, blockInfo);
61
+ const tbsCertList = _readTbsCertList(crl, blocks[0]);
62
+ const signatureAlgorithm = asn1_1._readAlgorithmIdentifier(crl, blocks[1]);
63
+ const signatureValue = asn1_1._readSignatureValueBin(crl, blocks[2]);
64
+ return { tbsCertList, signatureAlgorithm, signatureValue };
65
+ }
66
+ exports.exploreCertificateRevocationList = exploreCertificateRevocationList;
67
+ //# sourceMappingURL=explore_certificate_revocation_list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explore_certificate_revocation_list.js","sourceRoot":"","sources":["../lib/explore_certificate_revocation_list.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yBAAyB;AAGzB,+BAAiC;AACjC,iCAmBgB;AAChB,iDAAqE;AA4BrE,SAAgB,cAAc,CAAC,MAAc,EAAE,KAAgB;IAC3D,OAAO,yBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC;AAFD,wCAEC;AAED,SAAS,gBAAgB,CAAC,MAAc,EAAE,SAAoB;IAC1D,MAAM,MAAM,GAAG,kBAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAE9C,MAAM,OAAO,GAAG,wBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,MAAM,SAAS,GAAG,+BAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,iBAAiB,GAAG,qCAA8B,CAAC,iCAAkB,CAAC,gBAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3G,MAAM,UAAU,GAAG,gBAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,gBAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhD,MAAM,mBAA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AAM,SAAS,GAAG,cAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,kBAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAG,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,MAAM,kBAAkB,GAAG,+BAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,MAAM,cAAc,GAAG,6BAAsB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC;AAC/D,CAAC;AAPD,4EAOC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @module node_opcua_crypto
3
+ */
4
+ export * from "./common";
5
+ export * from "./derived_keys";
6
+ export * from "./explore_certificate";
7
+ export * from "./crypto_utils";
8
+ export * from "./crypto_explore_certificate";
9
+ export * from "./verify_cerficate_signature";
10
+ export * from "./explore_certificate_revocation_list";
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ }
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ /**
14
+ * @module node_opcua_crypto
15
+ */
16
+ __exportStar(require("./common"), exports);
17
+ __exportStar(require("./derived_keys"), exports);
18
+ __exportStar(require("./explore_certificate"), exports);
19
+ __exportStar(require("./crypto_utils"), exports);
20
+ __exportStar(require("./crypto_explore_certificate"), exports);
21
+ __exportStar(require("./verify_cerficate_signature"), exports);
22
+ __exportStar(require("./explore_certificate_revocation_list"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,2CAAyB;AACzB,iDAA+B;AAC/B,wDAAsC;AACtC,iDAA+B;AAC/B,+DAA6C;AAC7C,+DAA6C;AAC7C,wEAAsD"}
@@ -0,0 +1,7 @@
1
+ export declare const oid_map: {
2
+ [key: string]: {
3
+ d: string;
4
+ c: string;
5
+ w?: boolean;
6
+ };
7
+ };