node-opcua-crypto 2.0.0 → 2.1.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/.github/workflows/main.yml +96 -22
- package/dist/source/common.d.ts +4 -2
- package/dist/source/crypto_utils.d.ts +9 -6
- package/dist/source/crypto_utils.js +29 -15
- package/dist/source/crypto_utils.js.map +1 -1
- package/dist/source/explore_private_key.d.ts +1 -1
- package/dist/source/explore_private_key.js +4 -3
- package/dist/source/explore_private_key.js.map +1 -1
- package/dist/source/public_private_match.js +1 -2
- package/dist/source/public_private_match.js.map +1 -1
- package/dist/source_nodejs/read.d.ts +2 -3
- package/dist/source_nodejs/read.js +36 -14
- package/dist/source_nodejs/read.js.map +1 -1
- package/package.json +1 -1
- package/source/common.ts +15 -13
- package/source/crypto_utils.ts +374 -359
- package/source/explore_private_key.ts +119 -121
- package/source/public_private_match.ts +37 -41
- package/source_nodejs/read.ts +115 -95
|
@@ -4,29 +4,103 @@ name: CI
|
|
|
4
4
|
|
|
5
5
|
# Controls when the workflow will run
|
|
6
6
|
on:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
# Triggers the workflow on push or pull request events but only for the master branch
|
|
8
|
+
push:
|
|
9
|
+
branches: [master]
|
|
10
|
+
pull_request:
|
|
11
|
+
branches: [master]
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
# Allows you to run this workflow manually from the Actions tab
|
|
14
|
+
workflow_dispatch:
|
|
15
15
|
|
|
16
16
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
17
17
|
jobs:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
# This workflow contains a single job called "build"
|
|
19
|
+
build-new:
|
|
20
|
+
# The type of runner that the job will run on
|
|
21
|
+
strategy:
|
|
22
|
+
matrix:
|
|
23
|
+
node-version: [19.x]
|
|
24
|
+
os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
|
|
25
|
+
runs-on: ${{ matrix.os }}
|
|
26
|
+
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
27
|
+
steps:
|
|
28
|
+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
29
|
+
- name: checkout
|
|
30
|
+
uses: actions/checkout@v3
|
|
31
|
+
|
|
32
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
33
|
+
uses: actions/setup-node@v3
|
|
34
|
+
with:
|
|
35
|
+
node-version: ${{ matrix.node-version }}
|
|
36
|
+
|
|
37
|
+
- name: openssl
|
|
38
|
+
run: openssl version
|
|
39
|
+
- name: nodejs
|
|
40
|
+
run: node --version
|
|
41
|
+
|
|
42
|
+
# Runs a set of commands using the runners shell
|
|
43
|
+
- name: build
|
|
44
|
+
run: |
|
|
45
|
+
npm install typescript mocha ts-node @types/node@18 npm -g
|
|
46
|
+
npm install
|
|
47
|
+
npm run test
|
|
48
|
+
build:
|
|
49
|
+
# The type of runner that the job will run on
|
|
50
|
+
strategy:
|
|
51
|
+
matrix:
|
|
52
|
+
node-version: [ 16.x, 18.x]
|
|
53
|
+
os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
|
|
54
|
+
runs-on: ${{ matrix.os }}
|
|
55
|
+
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
56
|
+
steps:
|
|
57
|
+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
58
|
+
- name: checkout
|
|
59
|
+
uses: actions/checkout@v3
|
|
60
|
+
|
|
61
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
62
|
+
uses: actions/setup-node@v3
|
|
63
|
+
with:
|
|
64
|
+
node-version: ${{ matrix.node-version }}
|
|
65
|
+
|
|
66
|
+
- name: openssl
|
|
67
|
+
run: openssl version
|
|
68
|
+
- name: nodejs
|
|
69
|
+
run: node --version
|
|
70
|
+
|
|
71
|
+
# Runs a set of commands using the runners shell
|
|
72
|
+
- name: build
|
|
73
|
+
run: |
|
|
74
|
+
npm install npm@9 -g
|
|
75
|
+
npm install typescript mocha ts-node @types/node@${{ matrix.node-version }} -g
|
|
76
|
+
npm install
|
|
77
|
+
npm run test
|
|
78
|
+
build-legacy:
|
|
79
|
+
# The type of runner that the job will run on
|
|
80
|
+
strategy:
|
|
81
|
+
matrix:
|
|
82
|
+
node-version: [12.x, 14.x]
|
|
83
|
+
os: [ubuntu-18.04, ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
|
|
84
|
+
runs-on: ${{ matrix.os }}
|
|
85
|
+
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
86
|
+
steps:
|
|
87
|
+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
88
|
+
- name: checkout
|
|
89
|
+
uses: actions/checkout@v3
|
|
90
|
+
|
|
91
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
92
|
+
uses: actions/setup-node@v3
|
|
93
|
+
with:
|
|
94
|
+
node-version: ${{ matrix.node-version }}
|
|
95
|
+
|
|
96
|
+
- name: openssl
|
|
97
|
+
run: openssl version
|
|
98
|
+
- name: nodejs
|
|
99
|
+
run: node --version
|
|
100
|
+
|
|
101
|
+
# Runs a set of commands using the runners shell
|
|
102
|
+
- name: build
|
|
103
|
+
run: |
|
|
104
|
+
npm install typescript mocha ts-node @types/node@${{ matrix.node-version }} npm@8 -g
|
|
105
|
+
npm install
|
|
106
|
+
npm run test
|
package/dist/source/common.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { KeyObject } from "node:crypto";
|
|
4
|
+
export type PrivateKey = KeyObject;
|
|
5
|
+
export type PublicKey = KeyObject;
|
|
2
6
|
export type Nonce = Buffer;
|
|
3
7
|
export type PEM = string;
|
|
4
8
|
export type DER = Buffer;
|
|
5
9
|
export type Certificate = DER;
|
|
6
10
|
export type CertificatePEM = PEM;
|
|
7
|
-
export type PrivateKey = DER;
|
|
8
11
|
export type PrivateKeyPEM = PEM;
|
|
9
|
-
export type PublicKey = DER;
|
|
10
12
|
export type PublicKeyPEM = PEM;
|
|
11
13
|
export type Signature = Buffer;
|
|
12
14
|
export type CertificateRevocationList = Buffer;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import * as crypto from "crypto";
|
|
2
4
|
import { Certificate, CertificatePEM, DER, PEM, PrivateKey, PrivateKeyPEM, PublicKey, PublicKeyPEM, Signature } from "./common";
|
|
3
5
|
export declare function identifyPemType(rawKey: Buffer | string): undefined | string;
|
|
4
6
|
export declare function convertPEMtoDER(raw_key: PEM): DER;
|
|
@@ -8,7 +10,7 @@ export declare function convertPEMtoDER(raw_key: PEM): DER;
|
|
|
8
10
|
* @param pem
|
|
9
11
|
* @return
|
|
10
12
|
*/
|
|
11
|
-
export declare function toPem(raw_key: Buffer | string, pem: string): string;
|
|
13
|
+
export declare function toPem(raw_key: Buffer | string | crypto.KeyObject, pem: string): string;
|
|
12
14
|
export declare function hexDump(buffer: Buffer, width?: number): string;
|
|
13
15
|
interface MakeMessageChunkSignatureOptions {
|
|
14
16
|
signatureLength: number;
|
|
@@ -54,14 +56,15 @@ export declare enum PaddingAlgorithm {
|
|
|
54
56
|
RSA_PKCS1_OAEP_PADDING = 4,
|
|
55
57
|
RSA_PKCS1_PADDING = 1
|
|
56
58
|
}
|
|
57
|
-
export declare function publicEncrypt_native(buffer: Buffer, publicKey:
|
|
58
|
-
export declare function privateDecrypt_native(buffer: Buffer, privateKey:
|
|
59
|
+
export declare function publicEncrypt_native(buffer: Buffer, publicKey: crypto.KeyLike, algorithm?: PaddingAlgorithm): Buffer;
|
|
60
|
+
export declare function privateDecrypt_native(buffer: Buffer, privateKey: crypto.KeyLike, algorithm?: PaddingAlgorithm): Buffer;
|
|
59
61
|
export declare const publicEncrypt: typeof publicEncrypt_native;
|
|
60
62
|
export declare const privateDecrypt: typeof privateDecrypt_native;
|
|
61
|
-
export declare function publicEncrypt_long(buffer: Buffer, publicKey:
|
|
62
|
-
export declare function privateDecrypt_long(buffer: Buffer, privateKey:
|
|
63
|
+
export declare function publicEncrypt_long(buffer: Buffer, publicKey: crypto.KeyLike, blockSize: number, padding: number, paddingAlgorithm?: PaddingAlgorithm): Buffer;
|
|
64
|
+
export declare function privateDecrypt_long(buffer: Buffer, privateKey: crypto.KeyLike, blockSize: number, paddingAlgorithm?: number): Buffer;
|
|
63
65
|
export declare function coerceCertificatePem(certificate: Certificate | CertificatePEM): CertificatePEM;
|
|
64
66
|
export declare function coercePublicKeyPem(publicKey: PublicKey | PublicKeyPEM): PublicKeyPEM;
|
|
67
|
+
export declare function coercePrivateKey(privateKey: PrivateKey | PrivateKeyPEM): PrivateKey;
|
|
65
68
|
export declare function coercePrivateKeyPem(privateKey: PrivateKey | PrivateKeyPEM): PrivateKeyPEM;
|
|
66
69
|
/***
|
|
67
70
|
* @method rsaLengthPrivateKey
|
|
@@ -70,7 +73,7 @@ export declare function coercePrivateKeyPem(privateKey: PrivateKey | PrivateKeyP
|
|
|
70
73
|
* @return the key length in bytes.
|
|
71
74
|
*/
|
|
72
75
|
export declare function rsaLengthPrivateKey(key: PrivateKeyPEM | PrivateKey): number;
|
|
73
|
-
export declare function rsaLengthPublicKey(key: PublicKeyPEM): number;
|
|
76
|
+
export declare function rsaLengthPublicKey(key: PublicKeyPEM | PublicKey): number;
|
|
74
77
|
export declare function extractPublicKeyFromCertificateSync(certificate: Certificate | CertificatePEM): PublicKeyPEM;
|
|
75
78
|
/**
|
|
76
79
|
* extract the publickey from a certificate
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractPublicKeyFromCertificate = exports.extractPublicKeyFromCertificateSync = exports.rsaLengthPublicKey = exports.rsaLengthPrivateKey = exports.coercePrivateKeyPem = exports.coercePublicKeyPem = exports.coerceCertificatePem = exports.privateDecrypt_long = exports.publicEncrypt_long = exports.privateDecrypt = exports.publicEncrypt = exports.privateDecrypt_native = exports.publicEncrypt_native = exports.PaddingAlgorithm = exports.RSA_PKCS1_PADDING = exports.RSA_PKCS1_OAEP_PADDING = exports.makeSHA1Thumbprint = exports.verifyMessageChunkSignature = exports.makeMessageChunkSignature = exports.hexDump = exports.toPem = exports.convertPEMtoDER = exports.identifyPemType = void 0;
|
|
3
|
+
exports.extractPublicKeyFromCertificate = exports.extractPublicKeyFromCertificateSync = exports.rsaLengthPublicKey = exports.rsaLengthPrivateKey = exports.coercePrivateKeyPem = exports.coercePrivateKey = exports.coercePublicKeyPem = exports.coerceCertificatePem = exports.privateDecrypt_long = exports.publicEncrypt_long = exports.privateDecrypt = exports.publicEncrypt = exports.privateDecrypt_native = exports.publicEncrypt_native = exports.PaddingAlgorithm = exports.RSA_PKCS1_PADDING = exports.RSA_PKCS1_OAEP_PADDING = exports.makeSHA1Thumbprint = exports.verifyMessageChunkSignature = exports.makeMessageChunkSignature = exports.hexDump = exports.toPem = exports.convertPEMtoDER = exports.identifyPemType = void 0;
|
|
4
4
|
// tslint:disabled:no-var-requires
|
|
5
5
|
/**
|
|
6
6
|
* @module node_opcua_crypto
|
|
@@ -55,6 +55,17 @@ exports.convertPEMtoDER = convertPEMtoDER;
|
|
|
55
55
|
function toPem(raw_key, pem) {
|
|
56
56
|
assert(raw_key, "expecting a key");
|
|
57
57
|
assert(typeof pem === "string");
|
|
58
|
+
if (raw_key instanceof crypto.KeyObject) {
|
|
59
|
+
if (pem === "RSA PRIVATE KEY") {
|
|
60
|
+
return raw_key.export({ format: "pem", type: "pkcs1" }).toString();
|
|
61
|
+
}
|
|
62
|
+
else if (pem === "PRIVATE KEY") {
|
|
63
|
+
return raw_key.export({ format: "pem", type: "pkcs8" }).toString();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
throw new Error("Unsupported case!");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
58
69
|
let pemType = identifyPemType(raw_key);
|
|
59
70
|
if (pemType) {
|
|
60
71
|
return raw_key instanceof Buffer ? raw_key.toString("utf8") : raw_key;
|
|
@@ -202,6 +213,7 @@ function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgori
|
|
|
202
213
|
for (let i = 0; i < nbBlocks; i++) {
|
|
203
214
|
const currentBlock = buffer.subarray(chunk_size * i, chunk_size * (i + 1));
|
|
204
215
|
const encrypted_chunk = (0, exports.publicEncrypt)(currentBlock, publicKey, paddingAlgorithm);
|
|
216
|
+
// istanbul ignore next
|
|
205
217
|
if (encrypted_chunk.length !== blockSize) {
|
|
206
218
|
throw new Error(`publicEncrypt_long unexpected chunk length ${encrypted_chunk.length} expecting ${blockSize}`);
|
|
207
219
|
}
|
|
@@ -212,6 +224,7 @@ function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgori
|
|
|
212
224
|
exports.publicEncrypt_long = publicEncrypt_long;
|
|
213
225
|
function privateDecrypt_long(buffer, privateKey, blockSize, paddingAlgorithm) {
|
|
214
226
|
paddingAlgorithm = paddingAlgorithm || exports.RSA_PKCS1_PADDING;
|
|
227
|
+
// istanbul ignore next
|
|
215
228
|
if (paddingAlgorithm !== exports.RSA_PKCS1_PADDING && paddingAlgorithm !== exports.RSA_PKCS1_OAEP_PADDING) {
|
|
216
229
|
throw new Error("Invalid padding algorithm " + paddingAlgorithm);
|
|
217
230
|
}
|
|
@@ -236,13 +249,20 @@ function coerceCertificatePem(certificate) {
|
|
|
236
249
|
}
|
|
237
250
|
exports.coerceCertificatePem = coerceCertificatePem;
|
|
238
251
|
function coercePublicKeyPem(publicKey) {
|
|
239
|
-
if (publicKey instanceof
|
|
240
|
-
publicKey
|
|
252
|
+
if (publicKey instanceof crypto.KeyObject) {
|
|
253
|
+
return publicKey.export({ format: "pem", type: "spki" }).toString();
|
|
241
254
|
}
|
|
242
255
|
assert(typeof publicKey === "string");
|
|
243
256
|
return publicKey;
|
|
244
257
|
}
|
|
245
258
|
exports.coercePublicKeyPem = coercePublicKeyPem;
|
|
259
|
+
function coercePrivateKey(privateKey) {
|
|
260
|
+
if (typeof privateKey === "string") {
|
|
261
|
+
return crypto.createPrivateKey(privateKey);
|
|
262
|
+
}
|
|
263
|
+
return privateKey;
|
|
264
|
+
}
|
|
265
|
+
exports.coercePrivateKey = coercePrivateKey;
|
|
246
266
|
function coercePrivateKeyPem(privateKey) {
|
|
247
267
|
if (privateKey instanceof Buffer) {
|
|
248
268
|
const o = crypto.createPrivateKey({ key: privateKey, format: "der", type: "pkcs1" });
|
|
@@ -260,18 +280,12 @@ exports.coercePrivateKeyPem = coercePrivateKeyPem;
|
|
|
260
280
|
* @return the key length in bytes.
|
|
261
281
|
*/
|
|
262
282
|
function rsaLengthPrivateKey(key) {
|
|
263
|
-
key =
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
// in node <16 :
|
|
270
|
-
const key2 = o.export({ type: "pkcs1", format: "pem" });
|
|
271
|
-
const a = jsrsasign.KEYUTIL.getKey(key2);
|
|
272
|
-
return a.n.toString(16).length / 2;
|
|
273
|
-
}
|
|
274
|
-
const a = jsrsasign.KEYUTIL.getKey(key);
|
|
283
|
+
key = coercePrivateKey(key);
|
|
284
|
+
// in node 16 and above :
|
|
285
|
+
// return o.asymmetricKeyDetails.modulusLength/8
|
|
286
|
+
// in node <16 :
|
|
287
|
+
const key2 = key.export({ type: "pkcs1", format: "pem" }).toString();
|
|
288
|
+
const a = jsrsasign.KEYUTIL.getKey(key2);
|
|
275
289
|
return a.n.toString(16).length / 2;
|
|
276
290
|
}
|
|
277
291
|
exports.rsaLengthPrivateKey = rsaLengthPrivateKey;
|
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4DAA4D;AAC5D,6DAA6D;AAC7D;;;GAGG;AACH,SAAgB,+BAA+B,CAC3C,WAAyC,EACzC,QAAkE;IAElE,IAAI,IAAI,GAAQ,IAAI,CAAC;IACrB,IAAI,MAAoB,CAAC;IACzB,IAAI;QACA,MAAM,GAAG,mCAAmC,CAAC,WAAW,CAAC,CAAC;KAC7D;IAAC,OAAO,GAAG,EAAE;QACV,IAAI,GAAG,GAAG,CAAC;KACd;IACD,YAAY,CAAC,GAAG,EAAE;QACd,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACP,CAAC;AAdD,0EAcC"}
|
|
@@ -26,4 +26,4 @@ export interface PrivateKeyInternals {
|
|
|
26
26
|
* otherPrimeInfos OtherPrimeInfos OPTIONAL
|
|
27
27
|
}
|
|
28
28
|
*/
|
|
29
|
-
export declare function explorePrivateKey(
|
|
29
|
+
export declare function explorePrivateKey(privateKey1: PrivateKey): PrivateKeyInternals;
|
|
@@ -22,7 +22,8 @@ const doDebug = !!process.env.DEBUG;
|
|
|
22
22
|
* otherPrimeInfos OtherPrimeInfos OPTIONAL
|
|
23
23
|
}
|
|
24
24
|
*/
|
|
25
|
-
function explorePrivateKey(
|
|
25
|
+
function explorePrivateKey(privateKey1) {
|
|
26
|
+
const privateKey = privateKey1.export({ format: "der", type: "pkcs1" });
|
|
26
27
|
assert(privateKey instanceof Buffer);
|
|
27
28
|
const block_info = (0, asn1_1.readTag)(privateKey, 0);
|
|
28
29
|
const blocks = (0, asn1_1._readStruct)(privateKey, block_info);
|
|
@@ -44,7 +45,7 @@ function explorePrivateKey(privateKey) {
|
|
|
44
45
|
prime1,
|
|
45
46
|
prime2,
|
|
46
47
|
exponent1,
|
|
47
|
-
exponent2
|
|
48
|
+
exponent2,
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
51
|
/* istanbul ignore next */
|
|
@@ -90,7 +91,7 @@ function explorePrivateKey(privateKey) {
|
|
|
90
91
|
prime1,
|
|
91
92
|
prime2,
|
|
92
93
|
exponent1,
|
|
93
|
-
exponent2
|
|
94
|
+
exponent2,
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
97
|
exports.explorePrivateKey = explorePrivateKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explore_private_key.js","sourceRoot":"","sources":["../../source/explore_private_key.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,iCAA4F;
|
|
1
|
+
{"version":3,"file":"explore_private_key.js","sourceRoot":"","sources":["../../source/explore_private_key.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,iCAA4F;AAgB5F,SAAS,CAAC,CAAC,MAAc,EAAE,CAAY;IACnC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;AAClE,CAAC;AACD,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;AACpC;;;;;;;;;;;;;;GAcG;AACH,SAAgB,iBAAiB,CAAC,WAAuB;IACrD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAW,CAAC;IAClF,MAAM,CAAC,UAAU,YAAY,MAAM,CAAC,CAAC;IACrC,MAAM,UAAU,GAAG,IAAA,cAAO,EAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAA,kBAAW,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAEnD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,YAAY;QACZ,MAAM,OAAO,GAAG,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oDAAoD;QAC9F,MAAM,OAAO,GAAG,CAAC,CAAC,UAAU,EAAE,MAA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,CAAC;IAC1C,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpC,OAAO;QACH,OAAO;QACP,OAAO;QACP,cAAc;QACd,eAAe;QACf,MAAM;QACN,MAAM;QACN,SAAS;QACT,SAAS;KACZ,CAAC;AACN,CAAC;AAlFD,8CAkFC"}
|
|
@@ -31,8 +31,7 @@ function certificateMatchesPrivateKey(certificate, privateKey) {
|
|
|
31
31
|
const e = (0, explore_private_key_1.explorePrivateKey)(privateKey);
|
|
32
32
|
const blockSize = e.modulus.length;
|
|
33
33
|
const certificatePEM = (0, crypto_utils_1.toPem)(certificate, "CERTIFICATE");
|
|
34
|
-
|
|
35
|
-
return certificateMatchesPrivateKeyPEM(certificatePEM, privateKeyPEM, blockSize);
|
|
34
|
+
return certificateMatchesPrivateKeyPEM(certificatePEM, privateKey, blockSize);
|
|
36
35
|
}
|
|
37
36
|
exports.certificateMatchesPrivateKey = certificateMatchesPrivateKey;
|
|
38
37
|
//# sourceMappingURL=public_private_match.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_private_match.js","sourceRoot":"","sources":["../../source/public_private_match.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAE1D,iDAAgF;AAChF,6EAAkE;AAElE,
|
|
1
|
+
{"version":3,"file":"public_private_match.js","sourceRoot":"","sources":["../../source/public_private_match.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAE1D,iDAAgF;AAChF,6EAAkE;AAElE,SAAgB,6BAA6B,CAAC,WAAwB,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A+B,CAAC,cAAc,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AAClF,CAAC;AALD,oEAKC"}
|
|
@@ -20,10 +20,9 @@ export declare function readCertificatePEM(filename: string): CertificatePEM;
|
|
|
20
20
|
export declare function readPublicKeyPEM(filename: string): PublicKeyPEM;
|
|
21
21
|
export declare function readPrivateKeyPEM(filename: string): PrivateKeyPEM;
|
|
22
22
|
export declare function setCertificateStore(store: string): string;
|
|
23
|
-
export declare function read_sshkey_as_pem(filename: string): PublicKeyPEM;
|
|
24
23
|
/**
|
|
25
24
|
*
|
|
26
25
|
* @param filename
|
|
27
26
|
*/
|
|
28
|
-
export declare function readPrivateRsaKey(filename: string):
|
|
29
|
-
export declare function readPublicRsaKey(filename: string):
|
|
27
|
+
export declare function readPrivateRsaKey(filename: string): PrivateKey;
|
|
28
|
+
export declare function readPublicRsaKey(filename: string): PublicKey;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readPublicRsaKey = exports.readPrivateRsaKey = exports.
|
|
3
|
+
exports.readPublicRsaKey = exports.readPrivateRsaKey = exports.setCertificateStore = exports.readPrivateKeyPEM = exports.readPublicKeyPEM = exports.readCertificatePEM = exports.readPrivateKey = exports.readPublicKey = exports.readCertificate = exports.readKeyPem = void 0;
|
|
4
4
|
const assert = require("assert");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const path = require("path");
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
7
8
|
const crypto_utils_1 = require("../source/crypto_utils");
|
|
8
9
|
const sshpk = require("sshpk");
|
|
9
10
|
/**
|
|
@@ -39,14 +40,35 @@ exports.readCertificate = readCertificate;
|
|
|
39
40
|
* read a DER or PEM certificate from file
|
|
40
41
|
*/
|
|
41
42
|
function readPublicKey(filename) {
|
|
42
|
-
|
|
43
|
+
if (filename.match(/.*\.der/)) {
|
|
44
|
+
const der = fs.readFileSync(filename);
|
|
45
|
+
return (0, crypto_1.createPublicKey)(der);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const raw_key = _readPemFile(filename);
|
|
49
|
+
return (0, crypto_1.createPublicKey)(raw_key);
|
|
50
|
+
}
|
|
43
51
|
}
|
|
44
52
|
exports.readPublicKey = readPublicKey;
|
|
53
|
+
function myCreatePrivateKey(rawKey) {
|
|
54
|
+
// see https://askubuntu.com/questions/1409458/openssl-config-cuases-error-in-node-js-crypto-how-should-the-config-be-updated
|
|
55
|
+
const p = process.env.OPENSSL_CONF;
|
|
56
|
+
const retValue = (0, crypto_1.createPrivateKey)(rawKey);
|
|
57
|
+
process.env.OPENSSL_CONF = "/dev/null";
|
|
58
|
+
return retValue;
|
|
59
|
+
}
|
|
45
60
|
/**
|
|
46
61
|
* read a DER or PEM certificate from file
|
|
47
62
|
*/
|
|
48
63
|
function readPrivateKey(filename) {
|
|
49
|
-
|
|
64
|
+
if (filename.match(/.*\.der/)) {
|
|
65
|
+
const der = fs.readFileSync(filename);
|
|
66
|
+
return myCreatePrivateKey(der);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const raw_key = _readPemFile(filename);
|
|
70
|
+
return myCreatePrivateKey(raw_key);
|
|
71
|
+
}
|
|
50
72
|
}
|
|
51
73
|
exports.readPrivateKey = readPrivateKey;
|
|
52
74
|
function readCertificatePEM(filename) {
|
|
@@ -68,15 +90,6 @@ function setCertificateStore(store) {
|
|
|
68
90
|
return old_store;
|
|
69
91
|
}
|
|
70
92
|
exports.setCertificateStore = setCertificateStore;
|
|
71
|
-
function read_sshkey_as_pem(filename) {
|
|
72
|
-
if (filename.substring(0, 1) !== ".") {
|
|
73
|
-
filename = __certificate_store + filename;
|
|
74
|
-
}
|
|
75
|
-
const key = fs.readFileSync(filename, "ascii");
|
|
76
|
-
const sshKey = sshpk.parseKey(key, "ssh");
|
|
77
|
-
return sshKey.toString("pkcs8");
|
|
78
|
-
}
|
|
79
|
-
exports.read_sshkey_as_pem = read_sshkey_as_pem;
|
|
80
93
|
/**
|
|
81
94
|
*
|
|
82
95
|
* @param filename
|
|
@@ -85,11 +98,20 @@ function readPrivateRsaKey(filename) {
|
|
|
85
98
|
if (filename.substring(0, 1) !== "." && !fs.existsSync(filename)) {
|
|
86
99
|
filename = __certificate_store + filename;
|
|
87
100
|
}
|
|
88
|
-
|
|
101
|
+
const content = fs.readFileSync(filename, "ascii");
|
|
102
|
+
const sshKey = sshpk.parsePrivateKey(content, "auto");
|
|
103
|
+
const key = sshKey.toString("pkcs1");
|
|
104
|
+
return (0, crypto_1.createPrivateKey)({ format: "pem", type: "pkcs1", key });
|
|
89
105
|
}
|
|
90
106
|
exports.readPrivateRsaKey = readPrivateRsaKey;
|
|
91
107
|
function readPublicRsaKey(filename) {
|
|
92
|
-
|
|
108
|
+
if (filename.substring(0, 1) !== "." && !fs.existsSync(filename)) {
|
|
109
|
+
filename = __certificate_store + filename;
|
|
110
|
+
}
|
|
111
|
+
const content = fs.readFileSync(filename, "ascii");
|
|
112
|
+
const sshKey = sshpk.parseKey(content, "ssh");
|
|
113
|
+
const key = sshKey.toString("pkcs1");
|
|
114
|
+
return (0, crypto_1.createPublicKey)({ format: "pem", type: "pkcs1", key });
|
|
93
115
|
}
|
|
94
116
|
exports.readPublicRsaKey = readPublicRsaKey;
|
|
95
117
|
//# sourceMappingURL=read.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../source_nodejs/read.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,yBAAyB;AACzB,6BAA6B;
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../source_nodejs/read.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,yBAAyB;AACzB,6BAA6B;AAC7B,mCAA2D;AAE3D,yDAA0E;AAE1E,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/B;;;GAGG;AACH,SAAgB,UA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type
|
|
8
|
-
export type
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
11
|
-
|
|
12
|
-
export type
|
|
13
|
-
|
|
1
|
+
import { KeyObject } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
export type PrivateKey = KeyObject;
|
|
4
|
+
export type PublicKey = KeyObject;
|
|
5
|
+
|
|
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; // certificate as a PEM string
|
|
11
|
+
export type PrivateKeyPEM = PEM;
|
|
12
|
+
export type PublicKeyPEM = PEM;
|
|
13
|
+
|
|
14
|
+
export type Signature = Buffer;
|
|
15
|
+
export type CertificateRevocationList = Buffer;
|