cassproject 1.5.32 → 1.5.35
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/README.md +30 -0
- package/package.json +25 -15
- package/src/com/eduworks/ec/crypto/EcAesCtrAsync.js +6 -2
- package/src/com/eduworks/ec/crypto/EcCrypto.js +6 -2
- package/src/com/eduworks/ec/crypto/EcRsaOaep.test.js +6 -36
- package/src/com/eduworks/ec/crypto/EcRsaOaepAsync.js +41 -15
- package/src/com/eduworks/ec/crypto/EcRsaOaepAsync.test.js +8 -38
- package/src/com/eduworks/ec/crypto/EcRsaOaepAsyncWorker.test.js +6 -36
- package/src/org/cassproject/ebac/identity/EcIdentityManager.js +21 -8
- package/src/org/cassproject/ebac/identity/EcRekeyRequest.js +6 -2
- package/src/org/cassproject/ebac/identity/remote/EcRemoteIdentityManager.js +3 -1
- package/src/org/cassproject/ebac/repository/EcRepository.js +19 -11
- package/src/org/cassproject/ebac/repository/EcRepository.test.js +1 -0
- package/src/org/cassproject/schema/general/EcRemoteLinkedData.js +55 -11
- package/src/org/json/ld/EcLinkedData.js +2 -0
package/README.md
CHANGED
|
@@ -48,6 +48,36 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
|
|
|
48
48
|
|
|
49
49
|
# Changelog
|
|
50
50
|
|
|
51
|
+
## 1.5.35
|
|
52
|
+
* If --force-fips is enabled, always tries to use SHA-256 instead of crashing.
|
|
53
|
+
|
|
54
|
+
### FIPS:
|
|
55
|
+
FIPS is supported both client-side and server-side in CaSS. Here is the relevant compatibility table.
|
|
56
|
+
|
|
57
|
+
Sources: https://www.openssl.org/blog/blog/2023/05/29/FIPS-3-0-8/
|
|
58
|
+
|
|
59
|
+
| --> Server --> | < 1.5.35 | >= 1.5.35 with <br> OpenSSL 3.0.8 and<br> --force-fips | >= 1.5.35 with <br>OpenSSL 3.0.8 and<br> --force-fips and<br> env REJECT_SHA1=true |
|
|
60
|
+
| - | - | - | - |
|
|
61
|
+
| **Client/Library** | |
|
|
62
|
+
| < 1.5.35 | SHA-1 (no FIPS) | SHA-1 (Verify only) | Incompatible
|
|
63
|
+
| < 1.5.35 and<br> OpenSSL 3.0.8 and<br> env FIPS=true | SHA-1 (partial FIPS) | SHA-1 (Verify only) | Incompatible
|
|
64
|
+
| >= 1.5.35 | SHA-1 (no FIPS) | SHA-1 (Verify only*), SHA-256 (FIPS) | SHA-256 (FIPS)
|
|
65
|
+
| >= 1.5.35 and<br> env FIPS=true | SHA-1 (partial FIPS) | SHA-1 (Verify only*), SHA-256 (FIPS) | SHA-256 (FIPS)
|
|
66
|
+
| >= 1.5.35 and<br> --force-fips | Incompatible | SHA-256 (FIPS) | SHA-256 (FIPS)
|
|
67
|
+
|
|
68
|
+
To get FIPS, it is recommended to use the docker container builds.
|
|
69
|
+
|
|
70
|
+
Partial FIPS means that we are still violating FIPS by using SHA-1 hashing. All other cryptographic operations are using the FIPS module.
|
|
71
|
+
|
|
72
|
+
Verify only uses the exception that permits SHA-1 verification but not generation.
|
|
73
|
+
|
|
74
|
+
Verify only* may fall back to SHA-1 verification if SHA-256 negotiation failed, but typically will not use SHA-1.
|
|
75
|
+
|
|
76
|
+
## 1.5.34
|
|
77
|
+
* FIPS support (Does not support SHA-1)
|
|
78
|
+
* Default signature method is now SHA-256
|
|
79
|
+
* Introduced backwards compatible method of using SHA-1 signatures with servers where the feature is not detected (1.5.34 and behind).
|
|
80
|
+
|
|
51
81
|
## 1.5.32
|
|
52
82
|
* Library updates.
|
|
53
83
|
* Skip empty rows in Relation import.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cassproject",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.35",
|
|
4
4
|
"description": "Competency and Skills Service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
"multitest": "concurrently --kill-others --kill-others-on-fail \"npm run test15\" \"npm run test14\" \"npm run test13\" \"npm run test12\"",
|
|
10
10
|
"testCassTest": "npm run testkill && docker run -d --name cass-test -p80:80 -e CASS_LOOPBACK cass-test && wait-on http://localhost/api/ping && npm run testNode18 && npm run testNode18Fips && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testCypressEdge && npm run testCypress && npm run testkill",
|
|
11
11
|
"testDevHttps": "npm run testkill && docker run -d --name cass-test -p443:80 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:dev && wait-on https://localhost/api/ping && npm run testNode18HttpsFips && npm run testNode18Https && npm run testNode16Https && npm run testNode15Https && npm run testNode14Https && npm run testNode13Https && npm run testNode12Https && npm run testCypressEdgeHttps && npm run testCypressHttps",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
12
|
+
"test15HttpsFips": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.34 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" \"npm run testNode18HttpsFips\" \"npm run testNode16Https\" && npm run testkill",
|
|
13
|
+
"test15Https11Fips": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.5.34 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" \"npm run testNode18HttpsFips\" \"npm run testNode16Https\" && npm run testkill",
|
|
14
|
+
"test15Https": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.32 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode18Https\" \"npm run testNode18HttpsFips\" \"npm run testNode16Https\" && npm run testkill",
|
|
15
|
+
"test15Https11": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.5.32 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode18Https\" \"npm run testNode18HttpsFips\" \"npm run testNode16Https\" && npm run testkill",
|
|
16
|
+
"test15Fips": "export CASS_LOOPBACK=http://localhost/api/|| set CASS_LOOPBACK=http://localhost/api/&& npm run testkill15 && docker run -d -e CASS_LOOPBACK --name cass-test15 -p80:80 cassproject/cass:1.5.34 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode20\" \"npm run testNode20Fips\" \"npm run testNode20ForceFips\" \"npm run testNode18\" \"npm run testNode18Fips\" \"npm run testNode16\" && npm run testkill15",
|
|
17
|
+
"test15": "export CASS_LOOPBACK=http://localhost/api/|| set CASS_LOOPBACK=http://localhost/api/&& npm run testkill15 && docker run -d -e CASS_LOOPBACK --name cass-test15 -p80:80 cassproject/cass:1.5.32 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode20\" \"npm run testNode20Fips\" \"npm run testNode18\" \"npm run testNode18Fips\" \"npm run testNode16\" && npm run testkill15",
|
|
15
18
|
"test14": "npm run testkill14 && docker run -d -e CASS_LOOPBACK --name cass-test14 -p80:80 cassproject/cass:1.4.4 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode16\" && npm run testkill14",
|
|
16
19
|
"test13": "npm run testkill13 && docker run -d -e CASS_LOOPBACK --name cass-test13 -p80:80 cassproject/cass:1.3.18 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode16\" && npm run testkill13",
|
|
17
20
|
"test12": "npm run testkill12 && docker run -d -e CASS_LOOPBACK --name cass-test12 -p80:80 cassproject/cass:1.2.44 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode16\" && npm run testkill12",
|
|
@@ -20,6 +23,12 @@
|
|
|
20
23
|
"testkill13": "docker kill cass-test13 | exit 0 && docker rm cass-test13 | exit 0",
|
|
21
24
|
"testkill12": "docker kill cass-test12 | exit 0 && docker rm cass-test12 | exit 0",
|
|
22
25
|
"testkill": "docker kill cass-test | exit 0 && docker rm cass-test | exit 0",
|
|
26
|
+
"testNode20": "docker build --progress plain -f docker/node20 -t npm-cass20 . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass20",
|
|
27
|
+
"testNode20Https": "docker build --progress plain -f docker/node20https -t npm-cass20https . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass20https",
|
|
28
|
+
"testNode20HttpsFips": "docker build --progress plain -f docker/node20httpsfips -t npm-cass20httpsfips . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass20httpsfips",
|
|
29
|
+
"testNode20HttpsForceFips": "docker build --progress plain -f docker/node20httpsforcefips -t npm-cass20httpsfips . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass20httpsfips",
|
|
30
|
+
"testNode20ForceFips": "docker build --progress plain -f docker/node20forcefips -t npm-cass20fips . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass20fips",
|
|
31
|
+
"testNode20Fips": "docker build --progress plain -f docker/node20fips -t npm-cass20fips . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass20fips",
|
|
23
32
|
"testNode18": "docker build --progress plain -f docker/node18 -t npm-cass18 . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass18",
|
|
24
33
|
"testNode18Https": "docker build --progress plain -f docker/node18https -t npm-cass18https . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass18https",
|
|
25
34
|
"testNode18HttpsFips": "docker build --progress plain -f docker/node18httpsfips -t npm-cass18httpsfips . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass18httpsfips",
|
|
@@ -38,7 +47,8 @@
|
|
|
38
47
|
"testCypressHttps": "docker build --progress plain -f docker/cypressHttps -t npm-casscypresshttps . & docker run -e CASS_LOOPBACK --rm npm-casscypresshttps",
|
|
39
48
|
"autotest": "nodemon test.js",
|
|
40
49
|
"autoindex": "nodemon index.js",
|
|
41
|
-
"mocha": "
|
|
50
|
+
"mocha": "mocha --timeout 15000 -b src/**/*.test.js",
|
|
51
|
+
"mochaFips": "mocha -n 'force-fips' --timeout 15000 -b src/**/*.test.js",
|
|
42
52
|
"mocha:httpsNoHttp2": "export HTTP2=false|| set HTTP2=false&& mocha --timeout 15000 -b src/**/*.test.js",
|
|
43
53
|
"mocha:https": "mocha --timeout 15000 -b src/**/*.test.js",
|
|
44
54
|
"mocha:clientSideCertificates": "export CASS_LOOPBACK=https://localhost/api/|| set CASS_LOOPBACK=https://localhost/api/&& mocha --timeout 15000 -b src/**/*.test.js",
|
|
@@ -46,7 +56,7 @@
|
|
|
46
56
|
"mocha:dev": "export CASS_LOOPBACK=https://dev.cassproject.org/api/|| set CASS_LOOPBACK=https://dev.cassproject.org/api/&& export HTTP2=false|| set HTTP2=false&& mocha --timeout 300000 -b src/**/*.test.js",
|
|
47
57
|
"mocha:demo": "export CASS_LOOPBACK=https://demo.cassproject.org/api/|| set CASS_LOOPBACK=https://demo.cassproject.org/api/&& export HTTP2=false|| set HTTP2=false&& mocha --timeout 300000 -b src/**/*.test.js",
|
|
48
58
|
"mochaGraph": "mocha --timeout 15000 -b src/com/eduworks/ec/graph/**/*.test.js",
|
|
49
|
-
"automocha": "nodemon --exec \"npm run mocha
|
|
59
|
+
"automocha": "nodemon --exec \"npm run mocha\"",
|
|
50
60
|
"automochaGraph": "nodemon --exec \"npm run mochaGraph\"",
|
|
51
61
|
"automocha:clientSideCertificates": "nodemon --exec \"npm run mocha:clientSideCertificates\"",
|
|
52
62
|
"lint": "eslint src -c .eslintrc.js --ext .js --fix",
|
|
@@ -99,7 +109,7 @@
|
|
|
99
109
|
"forge": "^2.3.0",
|
|
100
110
|
"form-data": "^4.0.0",
|
|
101
111
|
"http2-wrapper": "^2.2.0",
|
|
102
|
-
"jsonld": "^8.
|
|
112
|
+
"jsonld": "^8.3.1",
|
|
103
113
|
"node-forge": "^1.3.1",
|
|
104
114
|
"papaparse": "^5.4.1",
|
|
105
115
|
"pem-jwk": "^2.0.0",
|
|
@@ -129,18 +139,18 @@
|
|
|
129
139
|
},
|
|
130
140
|
"homepage": "https://github.com/cassproject/cass-npm#readme",
|
|
131
141
|
"devDependencies": {
|
|
132
|
-
"@babel/core": "^7.22.
|
|
133
|
-
"@babel/preset-env": "^7.22.
|
|
142
|
+
"@babel/core": "^7.22.20",
|
|
143
|
+
"@babel/preset-env": "^7.22.20",
|
|
134
144
|
"@cypress/browserify-preprocessor": "^3.0.2",
|
|
135
|
-
"@cypress/vite-dev-server": "^5.0.
|
|
136
|
-
"@cypress/webpack-preprocessor": "^
|
|
145
|
+
"@cypress/vite-dev-server": "^5.0.6",
|
|
146
|
+
"@cypress/webpack-preprocessor": "^6.0.0",
|
|
137
147
|
"babel-eslint": "^10.1.0",
|
|
138
148
|
"babel-plugin-transform-remove-strict-mode": "^0.0.2",
|
|
139
|
-
"chai": "^4.3.
|
|
140
|
-
"concurrently": "^8.2.
|
|
149
|
+
"chai": "^4.3.8",
|
|
150
|
+
"concurrently": "^8.2.1",
|
|
141
151
|
"convert-hrtime": "^5.0.0",
|
|
142
|
-
"cypress": "^
|
|
143
|
-
"eslint": "^8.
|
|
152
|
+
"cypress": "^13.2.0",
|
|
153
|
+
"eslint": "^8.49.0",
|
|
144
154
|
"mocha": "^10.2.0",
|
|
145
155
|
"node-polyfill-webpack-plugin": "^2.0.1",
|
|
146
156
|
"nodemon": "^3.0.1",
|
|
@@ -32,7 +32,9 @@ module.exports = class EcAesCtrAsync {
|
|
|
32
32
|
try {
|
|
33
33
|
realCrypto.setFips(true);
|
|
34
34
|
} catch (e) {
|
|
35
|
-
|
|
35
|
+
if (e.toString().indexOf("ERR_CRYPTO_FIPS_FORCED") != -1)
|
|
36
|
+
return;
|
|
37
|
+
global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcAesCtrAsyncFips", "ERR_CRYPTO_FIPS", e);
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -42,7 +44,9 @@ module.exports = class EcAesCtrAsync {
|
|
|
42
44
|
try {
|
|
43
45
|
realCrypto.setFips(false);
|
|
44
46
|
} catch (e) {
|
|
45
|
-
|
|
47
|
+
if (e.toString().indexOf("ERR_CRYPTO_FIPS_FORCED") != -1)
|
|
48
|
+
return;
|
|
49
|
+
global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcAesCtrAsyncFips", "ERR_CRYPTO_FIPS", e);
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
|
|
@@ -6,12 +6,12 @@ let forge = require("node-forge");
|
|
|
6
6
|
*/
|
|
7
7
|
module.exports = class EcCrypto {
|
|
8
8
|
/**
|
|
9
|
-
* Turn on (
|
|
9
|
+
* Turn on (default off) caching of decrypted data.
|
|
10
10
|
* @property caching
|
|
11
11
|
* @type boolean
|
|
12
12
|
*/
|
|
13
13
|
static caching = false;
|
|
14
|
-
static testMode =
|
|
14
|
+
static testMode = true;
|
|
15
15
|
static deprecationNotice = false;
|
|
16
16
|
static decryptionCache = {};
|
|
17
17
|
static md5Cache = {};
|
|
@@ -25,6 +25,8 @@ module.exports = class EcCrypto {
|
|
|
25
25
|
* @method md5
|
|
26
26
|
*/
|
|
27
27
|
static md5(s) {
|
|
28
|
+
if (EcCrypto.testMode)
|
|
29
|
+
console.log("md5: " + s)
|
|
28
30
|
let m = null;
|
|
29
31
|
if (EcCrypto.caching) {
|
|
30
32
|
if (EcCrypto.md5Cache[s] === undefined) {
|
|
@@ -47,6 +49,8 @@ module.exports = class EcCrypto {
|
|
|
47
49
|
* @method sha256
|
|
48
50
|
*/
|
|
49
51
|
static sha256(s) {
|
|
52
|
+
if (EcCrypto.testMode)
|
|
53
|
+
console.log("sha256: " + s)
|
|
50
54
|
let m = null;
|
|
51
55
|
if (EcCrypto.caching) {
|
|
52
56
|
if (EcCrypto.sha256Cache[s] === undefined) {
|
|
@@ -63,46 +63,16 @@ describe("EcRsaOaep", () => {
|
|
|
63
63
|
assert.isTrue(randomString == decrypted);
|
|
64
64
|
});
|
|
65
65
|
it('signing then verifying', () => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"-----BEGIN RSA PRIVATE KEY-----MIIEpAIBAAKCAQEAz4BiFucFE9bNcKfGD+e6aPRHl402YM4Z6nrurDRNlnwsWpsCoZasPLkjC314pVtHAI2duZo+esGKDloBsiLxASRJo3R2XiXVh2Y8U1RcHA5mWL4tMG5UY2d0libpNEHbHPNBmooVYpA2yhxN/vGibIk8x69uZWxJcFOxOg6zWG8EjF8UMgGnRCVSMTY3THhTlfZ0cGUzvrfb7OvHUgdCe285XkmYkj/V9P/m7hbWoOyJAJSTOm4/s6fIKpl72lblfN7bKaxTCsJp6/rQdmUeo+PIaa2lDOfo7dWbuTMcqkZ93kispNfYYhsEGUGlCsrrVWhlve8MenO4GdLsFP+HRwIDAQABAoIBAGaQpOuBIYde44lNxJ7UAdYi+Mg2aqyK81Btl0/TQo6hriLTAAfzPAt/z4y8ZkgFyCDD3zSAw2VWCPFzF+d/UfUohKWgyWlb9iHJLQRbbHQJwhkXV6raviesWXpmnVrROocizkie/FcNxac9OmhL8+cGJt7lHgJP9jTpiW6TGZ8ZzM8KBH2l80x9AWdvCjsICuPIZRjc706HtkKZzTROtq6Z/F4Gm0uWRnwAZrHTRpnh8qjtdBLYFrdDcUoFtzOM6UVRmocTfsNe4ntPpvwY2aGTWY7EmTj1kteMJ+fCQFIS+KjyMWQHsN8yQNfD5/j2uv6/BdSkO8uorGSJT6DwmTECgYEA8ydoQ4i58+A1udqA+fujM0Zn46++NTehFe75nqIt8rfQgoduBam3lE5IWj2U2tLQeWxQyr1ZJkLbITtrAI3PgfMnuFAii+cncwFo805Fss/nbKx8K49vBuCEAq3MRhLjWy3ZvIgUHj67jWvl50dbNqc7TUguxhS4BxGr/cPPkP0CgYEA2nbJPGzSKhHTETL37NWIUAdU9q/6NVRISRRXeRqZYwE1VPzs2sIUxA8zEDBHX7OtvCKzvZy1Lg5Unx1nh4nCEVkbW/8npLlRG2jOcZJF6NRfhzwLz3WMIrP6j9SmjJaB+1mnrTjfsg36tDEPDjjJLjJHCx9z/qRJh1v4bh4aPpMCgYACG31T2IOEEZVlnvcvM3ceoqWT25oSbAEBZ6jSLyWmzOEJwJK7idUFfAg0gAQiQWF9K+snVqzHIB02FIXA43nA7pKRjmA+RiqZXJHEShFgk1y2HGiXGA8mSBvcyhTTJqbBy4vvjl5eRLzrZNwBPSUVPC3PZajCHrvZk9WhxWivIQKBgQCzCu1MH2dy4R7ZlqsIJ8zKweeJMZpfQI7pjclO0FTrhh7+Yzd+5db9A/P2jYrBTVHSwaILgTYf49DIguHJfEZXz26TzB7iapqlWxTukVHISt1ryPNo+E58VoLAhChnSiaHJ+g7GESE+d4A9cAACNwgh0YgQIvhIyW70M1e+j7KDwKBgQDQSBLFDFmvvTP3sIRAr1+0OZWd1eRcwdhs0U9GwootoCoUP/1Y64pqukT6B9oIB/No9Nyn8kUX3/ZDtCslaGKEUGMJXQ4hc5J+lq0tSi9ZWBdhqOuMPEfUF3IxW+9yeILP4ppUBn1m5MVOWg5CvuuEeCmy4bhMaUErUlHZ78t5cA==-----END RSA PRIVATE KEY-----"
|
|
69
|
-
);
|
|
70
|
-
let pk = ppk.toPk();
|
|
71
|
-
let signature = EcRsaOaep.sign(ppk, randomString);
|
|
72
|
-
let verified = EcRsaOaep.verify(pk, randomString, signature);
|
|
73
|
-
assert.isTrue(verified);
|
|
66
|
+
console.log("Deprecated. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main");
|
|
67
|
+
return;
|
|
74
68
|
});
|
|
75
69
|
it('signing then verifying (utf-8)', () => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
let ppk = EcPpk.fromPem(
|
|
79
|
-
"-----BEGIN RSA PRIVATE KEY-----MIIEpAIBAAKCAQEAz4BiFucFE9bNcKfGD+e6aPRHl402YM4Z6nrurDRNlnwsWpsCoZasPLkjC314pVtHAI2duZo+esGKDloBsiLxASRJo3R2XiXVh2Y8U1RcHA5mWL4tMG5UY2d0libpNEHbHPNBmooVYpA2yhxN/vGibIk8x69uZWxJcFOxOg6zWG8EjF8UMgGnRCVSMTY3THhTlfZ0cGUzvrfb7OvHUgdCe285XkmYkj/V9P/m7hbWoOyJAJSTOm4/s6fIKpl72lblfN7bKaxTCsJp6/rQdmUeo+PIaa2lDOfo7dWbuTMcqkZ93kispNfYYhsEGUGlCsrrVWhlve8MenO4GdLsFP+HRwIDAQABAoIBAGaQpOuBIYde44lNxJ7UAdYi+Mg2aqyK81Btl0/TQo6hriLTAAfzPAt/z4y8ZkgFyCDD3zSAw2VWCPFzF+d/UfUohKWgyWlb9iHJLQRbbHQJwhkXV6raviesWXpmnVrROocizkie/FcNxac9OmhL8+cGJt7lHgJP9jTpiW6TGZ8ZzM8KBH2l80x9AWdvCjsICuPIZRjc706HtkKZzTROtq6Z/F4Gm0uWRnwAZrHTRpnh8qjtdBLYFrdDcUoFtzOM6UVRmocTfsNe4ntPpvwY2aGTWY7EmTj1kteMJ+fCQFIS+KjyMWQHsN8yQNfD5/j2uv6/BdSkO8uorGSJT6DwmTECgYEA8ydoQ4i58+A1udqA+fujM0Zn46++NTehFe75nqIt8rfQgoduBam3lE5IWj2U2tLQeWxQyr1ZJkLbITtrAI3PgfMnuFAii+cncwFo805Fss/nbKx8K49vBuCEAq3MRhLjWy3ZvIgUHj67jWvl50dbNqc7TUguxhS4BxGr/cPPkP0CgYEA2nbJPGzSKhHTETL37NWIUAdU9q/6NVRISRRXeRqZYwE1VPzs2sIUxA8zEDBHX7OtvCKzvZy1Lg5Unx1nh4nCEVkbW/8npLlRG2jOcZJF6NRfhzwLz3WMIrP6j9SmjJaB+1mnrTjfsg36tDEPDjjJLjJHCx9z/qRJh1v4bh4aPpMCgYACG31T2IOEEZVlnvcvM3ceoqWT25oSbAEBZ6jSLyWmzOEJwJK7idUFfAg0gAQiQWF9K+snVqzHIB02FIXA43nA7pKRjmA+RiqZXJHEShFgk1y2HGiXGA8mSBvcyhTTJqbBy4vvjl5eRLzrZNwBPSUVPC3PZajCHrvZk9WhxWivIQKBgQCzCu1MH2dy4R7ZlqsIJ8zKweeJMZpfQI7pjclO0FTrhh7+Yzd+5db9A/P2jYrBTVHSwaILgTYf49DIguHJfEZXz26TzB7iapqlWxTukVHISt1ryPNo+E58VoLAhChnSiaHJ+g7GESE+d4A9cAACNwgh0YgQIvhIyW70M1e+j7KDwKBgQDQSBLFDFmvvTP3sIRAr1+0OZWd1eRcwdhs0U9GwootoCoUP/1Y64pqukT6B9oIB/No9Nyn8kUX3/ZDtCslaGKEUGMJXQ4hc5J+lq0tSi9ZWBdhqOuMPEfUF3IxW+9yeILP4ppUBn1m5MVOWg5CvuuEeCmy4bhMaUErUlHZ78t5cA==-----END RSA PRIVATE KEY-----"
|
|
80
|
-
);
|
|
81
|
-
let pk = ppk.toPk();
|
|
82
|
-
let signature = EcRsaOaep.sign(ppk, randomString);
|
|
83
|
-
let verified = EcRsaOaep.verify(pk, randomString, signature);
|
|
84
|
-
assert.isTrue(verified);
|
|
70
|
+
console.log("Deprecated. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main");
|
|
71
|
+
return;
|
|
85
72
|
});
|
|
86
73
|
it('signing then verifying w/caching', () => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"-----BEGIN RSA PRIVATE KEY-----MIIEpAIBAAKCAQEAz4BiFucFE9bNcKfGD+e6aPRHl402YM4Z6nrurDRNlnwsWpsCoZasPLkjC314pVtHAI2duZo+esGKDloBsiLxASRJo3R2XiXVh2Y8U1RcHA5mWL4tMG5UY2d0libpNEHbHPNBmooVYpA2yhxN/vGibIk8x69uZWxJcFOxOg6zWG8EjF8UMgGnRCVSMTY3THhTlfZ0cGUzvrfb7OvHUgdCe285XkmYkj/V9P/m7hbWoOyJAJSTOm4/s6fIKpl72lblfN7bKaxTCsJp6/rQdmUeo+PIaa2lDOfo7dWbuTMcqkZ93kispNfYYhsEGUGlCsrrVWhlve8MenO4GdLsFP+HRwIDAQABAoIBAGaQpOuBIYde44lNxJ7UAdYi+Mg2aqyK81Btl0/TQo6hriLTAAfzPAt/z4y8ZkgFyCDD3zSAw2VWCPFzF+d/UfUohKWgyWlb9iHJLQRbbHQJwhkXV6raviesWXpmnVrROocizkie/FcNxac9OmhL8+cGJt7lHgJP9jTpiW6TGZ8ZzM8KBH2l80x9AWdvCjsICuPIZRjc706HtkKZzTROtq6Z/F4Gm0uWRnwAZrHTRpnh8qjtdBLYFrdDcUoFtzOM6UVRmocTfsNe4ntPpvwY2aGTWY7EmTj1kteMJ+fCQFIS+KjyMWQHsN8yQNfD5/j2uv6/BdSkO8uorGSJT6DwmTECgYEA8ydoQ4i58+A1udqA+fujM0Zn46++NTehFe75nqIt8rfQgoduBam3lE5IWj2U2tLQeWxQyr1ZJkLbITtrAI3PgfMnuFAii+cncwFo805Fss/nbKx8K49vBuCEAq3MRhLjWy3ZvIgUHj67jWvl50dbNqc7TUguxhS4BxGr/cPPkP0CgYEA2nbJPGzSKhHTETL37NWIUAdU9q/6NVRISRRXeRqZYwE1VPzs2sIUxA8zEDBHX7OtvCKzvZy1Lg5Unx1nh4nCEVkbW/8npLlRG2jOcZJF6NRfhzwLz3WMIrP6j9SmjJaB+1mnrTjfsg36tDEPDjjJLjJHCx9z/qRJh1v4bh4aPpMCgYACG31T2IOEEZVlnvcvM3ceoqWT25oSbAEBZ6jSLyWmzOEJwJK7idUFfAg0gAQiQWF9K+snVqzHIB02FIXA43nA7pKRjmA+RiqZXJHEShFgk1y2HGiXGA8mSBvcyhTTJqbBy4vvjl5eRLzrZNwBPSUVPC3PZajCHrvZk9WhxWivIQKBgQCzCu1MH2dy4R7ZlqsIJ8zKweeJMZpfQI7pjclO0FTrhh7+Yzd+5db9A/P2jYrBTVHSwaILgTYf49DIguHJfEZXz26TzB7iapqlWxTukVHISt1ryPNo+E58VoLAhChnSiaHJ+g7GESE+d4A9cAACNwgh0YgQIvhIyW70M1e+j7KDwKBgQDQSBLFDFmvvTP3sIRAr1+0OZWd1eRcwdhs0U9GwootoCoUP/1Y64pqukT6B9oIB/No9Nyn8kUX3/ZDtCslaGKEUGMJXQ4hc5J+lq0tSi9ZWBdhqOuMPEfUF3IxW+9yeILP4ppUBn1m5MVOWg5CvuuEeCmy4bhMaUErUlHZ78t5cA==-----END RSA PRIVATE KEY-----"
|
|
90
|
-
);
|
|
91
|
-
let pk = ppk.toPk();
|
|
92
|
-
let hrTime = hrtime();
|
|
93
|
-
let signature = EcRsaOaep.sign(ppk, randomString);
|
|
94
|
-
let elapsed = (hrtime()[0]*1000000 + hrtime()[1]/1000 - hrTime[0] * 1000000 - hrTime[1] / 1000)/1000;
|
|
95
|
-
console.log(randomString.length/1024+"KB signing speed: " + elapsed+"ms");
|
|
96
|
-
hrTime = hrtime();
|
|
97
|
-
EcCrypto.caching = true;
|
|
98
|
-
let verified = EcRsaOaep.verify(pk, randomString, signature);
|
|
99
|
-
elapsed = (hrtime()[0]*1000000 + hrtime()[1]/1000 - hrTime[0] * 1000000 - hrTime[1] / 1000)/1000;
|
|
100
|
-
console.log("verification wout/caching speed: " + elapsed+"ms");
|
|
101
|
-
hrTime = hrtime();
|
|
102
|
-
verified = EcRsaOaep.verify(pk, randomString, signature);
|
|
103
|
-
elapsed = (hrtime()[0]*1000000 + hrtime()[1]/1000 - hrTime[0] * 1000000 - hrTime[1] / 1000)/1000;
|
|
104
|
-
console.log("verification w/caching speed: " + elapsed+"ms");
|
|
105
|
-
assert.isTrue(verified);
|
|
74
|
+
console.log("Deprecated. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main");
|
|
75
|
+
return;
|
|
106
76
|
});
|
|
107
77
|
it('signing then verifying (sha256)', () => {
|
|
108
78
|
let randomString = EcAes.newIv(256*4);
|
|
@@ -41,6 +41,8 @@ module.exports = class EcRsaOaepAsync {
|
|
|
41
41
|
* @static
|
|
42
42
|
*/
|
|
43
43
|
static encrypt(pk, plainText, success, failure) {
|
|
44
|
+
if (EcCrypto.testMode)
|
|
45
|
+
console.log("encrypt: " + plainText)
|
|
44
46
|
if (
|
|
45
47
|
crypto == null ||
|
|
46
48
|
crypto === undefined ||
|
|
@@ -66,6 +68,7 @@ module.exports = class EcRsaOaepAsync {
|
|
|
66
68
|
.importKey("jwk", pk.toJwk(), algorithm, false, keyUsages)
|
|
67
69
|
.then(function (key) {
|
|
68
70
|
pk.key = key;
|
|
71
|
+
EcAesCtrAsync.fipsOn();
|
|
69
72
|
return crypto.subtle.encrypt(
|
|
70
73
|
algorithm,
|
|
71
74
|
key,
|
|
@@ -99,6 +102,8 @@ module.exports = class EcRsaOaepAsync {
|
|
|
99
102
|
* @static
|
|
100
103
|
*/
|
|
101
104
|
static decrypt(ppk, cipherText, success, failure) {
|
|
105
|
+
if (EcCrypto.testMode)
|
|
106
|
+
console.log("decrypt: " + cipherText)
|
|
102
107
|
if (EcCrypto.caching) {
|
|
103
108
|
let cacheGet = null;
|
|
104
109
|
cacheGet = EcCrypto.decryptionCache[ppk.toPk().fingerprint() + cipherText];
|
|
@@ -125,6 +130,7 @@ module.exports = class EcRsaOaepAsync {
|
|
|
125
130
|
algorithm.hash = "SHA-1";
|
|
126
131
|
let result;
|
|
127
132
|
let afterKeyIsImported = (p1) => {
|
|
133
|
+
EcAesCtrAsync.fipsOn();
|
|
128
134
|
try {
|
|
129
135
|
result = forge.util.decodeUtf8(EcCrypto.ab2str(p1));
|
|
130
136
|
} catch (ex) {
|
|
@@ -142,6 +148,7 @@ module.exports = class EcRsaOaepAsync {
|
|
|
142
148
|
let p = crypto.subtle
|
|
143
149
|
.importKey("jwk", ppk.toJwk(), algorithm, false, keyUsages)
|
|
144
150
|
.then(function (key) {
|
|
151
|
+
EcAesCtrAsync.fipsOn();
|
|
145
152
|
ppk.key = key;
|
|
146
153
|
return crypto.subtle.decrypt(
|
|
147
154
|
algorithm,
|
|
@@ -157,14 +164,16 @@ module.exports = class EcRsaOaepAsync {
|
|
|
157
164
|
});
|
|
158
165
|
return cassPromisify(p, success, failure);
|
|
159
166
|
} else {
|
|
160
|
-
let p =
|
|
167
|
+
let p = new Promise((resolve,reject)=>{
|
|
168
|
+
EcAesCtrAsync.fipsOn();
|
|
169
|
+
resolve(crypto.subtle
|
|
161
170
|
.decrypt(algorithm, ppk.key, base64.decode(cipherText))
|
|
162
171
|
.then(afterKeyIsImported)
|
|
163
172
|
.catch((error) => {
|
|
164
173
|
global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRsaOaepAsyncDecrypt", error);
|
|
165
174
|
EcAesCtrAsync.fipsOff();
|
|
166
175
|
return null;
|
|
167
|
-
});
|
|
176
|
+
}))});
|
|
168
177
|
return cassPromisify(p, success, failure);
|
|
169
178
|
}
|
|
170
179
|
}
|
|
@@ -182,18 +191,21 @@ module.exports = class EcRsaOaepAsync {
|
|
|
182
191
|
* @static
|
|
183
192
|
*/
|
|
184
193
|
static sign(ppk, text, success, failure) {
|
|
194
|
+
if (EcCrypto.testMode)
|
|
195
|
+
console.log("sign (sha1): " + text)
|
|
185
196
|
if (
|
|
186
197
|
crypto == null ||
|
|
187
198
|
crypto === undefined ||
|
|
188
199
|
crypto.subtle == null ||
|
|
189
|
-
crypto.subtle === undefined
|
|
200
|
+
crypto.subtle === undefined ||
|
|
201
|
+
(process && process.env && process.env.FIPS)
|
|
190
202
|
) {
|
|
191
203
|
return EcRsaOaepAsyncWorker.sign(ppk, text, success, failure);
|
|
192
204
|
}
|
|
193
205
|
if (text == null) {
|
|
194
206
|
return cassReturnAsPromise(null, success, failure);
|
|
195
207
|
}
|
|
196
|
-
|
|
208
|
+
EcAesCtrAsync.fipsOff();// OPENSSL3 signing with this method not allowed. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main
|
|
197
209
|
let keyUsages = [];
|
|
198
210
|
keyUsages.push("sign");
|
|
199
211
|
let algorithm = {};
|
|
@@ -204,6 +216,7 @@ module.exports = class EcRsaOaepAsync {
|
|
|
204
216
|
crypto.subtle
|
|
205
217
|
.importKey("jwk", ppk.toJwk(), algorithm, false, keyUsages)
|
|
206
218
|
.then(function (key) {
|
|
219
|
+
EcAesCtrAsync.fipsOff();// OPENSSL3 signing with this method not allowed. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main
|
|
207
220
|
ppk.signKey = key;
|
|
208
221
|
return crypto.subtle
|
|
209
222
|
.sign(
|
|
@@ -212,7 +225,7 @@ module.exports = class EcRsaOaepAsync {
|
|
|
212
225
|
EcCrypto.str2ab(forge.util.encodeUtf8(text))
|
|
213
226
|
)
|
|
214
227
|
.then(function (p1) {
|
|
215
|
-
//EcAesCtrAsync.fipsOff();// OPENSSL3 signing with this method
|
|
228
|
+
//EcAesCtrAsync.fipsOff();// OPENSSL3 signing with this method not allowed. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main
|
|
216
229
|
return base64.encode(p1);
|
|
217
230
|
});
|
|
218
231
|
}),
|
|
@@ -220,8 +233,9 @@ module.exports = class EcRsaOaepAsync {
|
|
|
220
233
|
failure
|
|
221
234
|
);
|
|
222
235
|
else
|
|
223
|
-
return cassPromisify(
|
|
224
|
-
|
|
236
|
+
return cassPromisify(new Promise((resolve,reject)=>{
|
|
237
|
+
EcAesCtrAsync.fipsOff();// OPENSSL3 signing with this method not allowed. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main
|
|
238
|
+
resolve(crypto.subtle
|
|
225
239
|
.sign(
|
|
226
240
|
algorithm,
|
|
227
241
|
ppk.signKey,
|
|
@@ -229,7 +243,7 @@ module.exports = class EcRsaOaepAsync {
|
|
|
229
243
|
)
|
|
230
244
|
.then(function (p1) {
|
|
231
245
|
return base64.encode(p1);
|
|
232
|
-
}),
|
|
246
|
+
}))}),
|
|
233
247
|
success,
|
|
234
248
|
failure
|
|
235
249
|
);
|
|
@@ -248,6 +262,8 @@ module.exports = class EcRsaOaepAsync {
|
|
|
248
262
|
* @static
|
|
249
263
|
*/
|
|
250
264
|
static signSha256 = function (ppk, text, success, failure) {
|
|
265
|
+
if (EcCrypto.testMode)
|
|
266
|
+
console.log("sign (sha256): " + text)
|
|
251
267
|
if (
|
|
252
268
|
crypto == null ||
|
|
253
269
|
crypto === undefined ||
|
|
@@ -267,6 +283,7 @@ module.exports = class EcRsaOaepAsync {
|
|
|
267
283
|
p = crypto.subtle
|
|
268
284
|
.importKey("jwk", ppk.toJwk(), algorithm, false, keyUsages)
|
|
269
285
|
.then(function (key) {
|
|
286
|
+
EcAesCtrAsync.fipsOn();
|
|
270
287
|
ppk.signKey256 = key;
|
|
271
288
|
return crypto.subtle.sign(
|
|
272
289
|
algorithm,
|
|
@@ -302,6 +319,8 @@ module.exports = class EcRsaOaepAsync {
|
|
|
302
319
|
* @static
|
|
303
320
|
*/
|
|
304
321
|
static verify(pk, text, signature, success, failure) {
|
|
322
|
+
if (EcCrypto.testMode)
|
|
323
|
+
console.log("verify (sha1): " + text)
|
|
305
324
|
if (
|
|
306
325
|
crypto == null ||
|
|
307
326
|
crypto === undefined ||
|
|
@@ -327,6 +346,7 @@ module.exports = class EcRsaOaepAsync {
|
|
|
327
346
|
crypto.subtle
|
|
328
347
|
.importKey("jwk", pk.toJwk(), algorithm, false, keyUsages)
|
|
329
348
|
.then((key) => {
|
|
349
|
+
EcAesCtrAsync.fipsOn();
|
|
330
350
|
pk.signKey = key;
|
|
331
351
|
return crypto.subtle.verify(
|
|
332
352
|
algorithm,
|
|
@@ -342,8 +362,9 @@ module.exports = class EcRsaOaepAsync {
|
|
|
342
362
|
failure
|
|
343
363
|
);
|
|
344
364
|
} else {
|
|
345
|
-
return cassPromisify(
|
|
346
|
-
|
|
365
|
+
return cassPromisify(new Promise((resolve,reject)=>{
|
|
366
|
+
EcAesCtrAsync.fipsOn();
|
|
367
|
+
resolve(crypto.subtle.verify(
|
|
347
368
|
algorithm,
|
|
348
369
|
pk.signKey,
|
|
349
370
|
base64.decode(signature),
|
|
@@ -351,7 +372,8 @@ module.exports = class EcRsaOaepAsync {
|
|
|
351
372
|
).then((result)=>{
|
|
352
373
|
EcAesCtrAsync.fipsOff();
|
|
353
374
|
return result;
|
|
354
|
-
})
|
|
375
|
+
}))})
|
|
376
|
+
,
|
|
355
377
|
success,
|
|
356
378
|
failure
|
|
357
379
|
);
|
|
@@ -372,6 +394,8 @@ module.exports = class EcRsaOaepAsync {
|
|
|
372
394
|
* @static
|
|
373
395
|
*/
|
|
374
396
|
static verifySha256(pk, text, signature, success, failure) {
|
|
397
|
+
if (EcCrypto.testMode)
|
|
398
|
+
console.log("verify (sha256): " + text)
|
|
375
399
|
if (
|
|
376
400
|
crypto == null ||
|
|
377
401
|
crypto === undefined ||
|
|
@@ -396,7 +420,8 @@ module.exports = class EcRsaOaepAsync {
|
|
|
396
420
|
return cassPromisify(
|
|
397
421
|
crypto.subtle
|
|
398
422
|
.importKey("jwk", pk.toJwk(), algorithm, false, keyUsages)
|
|
399
|
-
.then(function (key) {
|
|
423
|
+
.then(function (key) {
|
|
424
|
+
EcAesCtrAsync.fipsOn();
|
|
400
425
|
pk.signKey256 = key;
|
|
401
426
|
return crypto.subtle.verify(
|
|
402
427
|
algorithm,
|
|
@@ -412,8 +437,9 @@ module.exports = class EcRsaOaepAsync {
|
|
|
412
437
|
failure
|
|
413
438
|
);
|
|
414
439
|
} else {
|
|
415
|
-
return cassPromisify(
|
|
416
|
-
|
|
440
|
+
return cassPromisify(new Promise((resolve,reject)=>{
|
|
441
|
+
EcAesCtrAsync.fipsOn();
|
|
442
|
+
resolve(crypto.subtle.verify(
|
|
417
443
|
algorithm,
|
|
418
444
|
pk.signKey256,
|
|
419
445
|
base64.decode(signature),
|
|
@@ -421,7 +447,7 @@ module.exports = class EcRsaOaepAsync {
|
|
|
421
447
|
).then((result)=>{
|
|
422
448
|
EcAesCtrAsync.fipsOff();
|
|
423
449
|
return result;
|
|
424
|
-
}),
|
|
450
|
+
}))}),
|
|
425
451
|
success,
|
|
426
452
|
failure
|
|
427
453
|
);
|
|
@@ -66,48 +66,16 @@ describe("EcRsaOaepAsync", () => {
|
|
|
66
66
|
assert.isTrue(randomString == decrypted);
|
|
67
67
|
});
|
|
68
68
|
it('signing then verifying', async () => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"-----BEGIN RSA PRIVATE KEY-----MIIEpAIBAAKCAQEAz4BiFucFE9bNcKfGD+e6aPRHl402YM4Z6nrurDRNlnwsWpsCoZasPLkjC314pVtHAI2duZo+esGKDloBsiLxASRJo3R2XiXVh2Y8U1RcHA5mWL4tMG5UY2d0libpNEHbHPNBmooVYpA2yhxN/vGibIk8x69uZWxJcFOxOg6zWG8EjF8UMgGnRCVSMTY3THhTlfZ0cGUzvrfb7OvHUgdCe285XkmYkj/V9P/m7hbWoOyJAJSTOm4/s6fIKpl72lblfN7bKaxTCsJp6/rQdmUeo+PIaa2lDOfo7dWbuTMcqkZ93kispNfYYhsEGUGlCsrrVWhlve8MenO4GdLsFP+HRwIDAQABAoIBAGaQpOuBIYde44lNxJ7UAdYi+Mg2aqyK81Btl0/TQo6hriLTAAfzPAt/z4y8ZkgFyCDD3zSAw2VWCPFzF+d/UfUohKWgyWlb9iHJLQRbbHQJwhkXV6raviesWXpmnVrROocizkie/FcNxac9OmhL8+cGJt7lHgJP9jTpiW6TGZ8ZzM8KBH2l80x9AWdvCjsICuPIZRjc706HtkKZzTROtq6Z/F4Gm0uWRnwAZrHTRpnh8qjtdBLYFrdDcUoFtzOM6UVRmocTfsNe4ntPpvwY2aGTWY7EmTj1kteMJ+fCQFIS+KjyMWQHsN8yQNfD5/j2uv6/BdSkO8uorGSJT6DwmTECgYEA8ydoQ4i58+A1udqA+fujM0Zn46++NTehFe75nqIt8rfQgoduBam3lE5IWj2U2tLQeWxQyr1ZJkLbITtrAI3PgfMnuFAii+cncwFo805Fss/nbKx8K49vBuCEAq3MRhLjWy3ZvIgUHj67jWvl50dbNqc7TUguxhS4BxGr/cPPkP0CgYEA2nbJPGzSKhHTETL37NWIUAdU9q/6NVRISRRXeRqZYwE1VPzs2sIUxA8zEDBHX7OtvCKzvZy1Lg5Unx1nh4nCEVkbW/8npLlRG2jOcZJF6NRfhzwLz3WMIrP6j9SmjJaB+1mnrTjfsg36tDEPDjjJLjJHCx9z/qRJh1v4bh4aPpMCgYACG31T2IOEEZVlnvcvM3ceoqWT25oSbAEBZ6jSLyWmzOEJwJK7idUFfAg0gAQiQWF9K+snVqzHIB02FIXA43nA7pKRjmA+RiqZXJHEShFgk1y2HGiXGA8mSBvcyhTTJqbBy4vvjl5eRLzrZNwBPSUVPC3PZajCHrvZk9WhxWivIQKBgQCzCu1MH2dy4R7ZlqsIJ8zKweeJMZpfQI7pjclO0FTrhh7+Yzd+5db9A/P2jYrBTVHSwaILgTYf49DIguHJfEZXz26TzB7iapqlWxTukVHISt1ryPNo+E58VoLAhChnSiaHJ+g7GESE+d4A9cAACNwgh0YgQIvhIyW70M1e+j7KDwKBgQDQSBLFDFmvvTP3sIRAr1+0OZWd1eRcwdhs0U9GwootoCoUP/1Y64pqukT6B9oIB/No9Nyn8kUX3/ZDtCslaGKEUGMJXQ4hc5J+lq0tSi9ZWBdhqOuMPEfUF3IxW+9yeILP4ppUBn1m5MVOWg5CvuuEeCmy4bhMaUErUlHZ78t5cA==-----END RSA PRIVATE KEY-----"
|
|
72
|
-
);
|
|
73
|
-
let pk = ppk.toPk();
|
|
74
|
-
let signature = await EcRsaOaepAsync.sign(ppk, randomString);
|
|
75
|
-
let verified = await EcRsaOaepAsync.verify(pk, randomString, signature);
|
|
76
|
-
assert.isTrue(verified);
|
|
69
|
+
console.log("Deprecated. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main");
|
|
70
|
+
return;
|
|
77
71
|
});
|
|
78
72
|
it('signing then verifying (utf-8)', async () => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
let ppk = EcPpk.fromPem(
|
|
82
|
-
"-----BEGIN RSA PRIVATE KEY-----MIIEpAIBAAKCAQEAz4BiFucFE9bNcKfGD+e6aPRHl402YM4Z6nrurDRNlnwsWpsCoZasPLkjC314pVtHAI2duZo+esGKDloBsiLxASRJo3R2XiXVh2Y8U1RcHA5mWL4tMG5UY2d0libpNEHbHPNBmooVYpA2yhxN/vGibIk8x69uZWxJcFOxOg6zWG8EjF8UMgGnRCVSMTY3THhTlfZ0cGUzvrfb7OvHUgdCe285XkmYkj/V9P/m7hbWoOyJAJSTOm4/s6fIKpl72lblfN7bKaxTCsJp6/rQdmUeo+PIaa2lDOfo7dWbuTMcqkZ93kispNfYYhsEGUGlCsrrVWhlve8MenO4GdLsFP+HRwIDAQABAoIBAGaQpOuBIYde44lNxJ7UAdYi+Mg2aqyK81Btl0/TQo6hriLTAAfzPAt/z4y8ZkgFyCDD3zSAw2VWCPFzF+d/UfUohKWgyWlb9iHJLQRbbHQJwhkXV6raviesWXpmnVrROocizkie/FcNxac9OmhL8+cGJt7lHgJP9jTpiW6TGZ8ZzM8KBH2l80x9AWdvCjsICuPIZRjc706HtkKZzTROtq6Z/F4Gm0uWRnwAZrHTRpnh8qjtdBLYFrdDcUoFtzOM6UVRmocTfsNe4ntPpvwY2aGTWY7EmTj1kteMJ+fCQFIS+KjyMWQHsN8yQNfD5/j2uv6/BdSkO8uorGSJT6DwmTECgYEA8ydoQ4i58+A1udqA+fujM0Zn46++NTehFe75nqIt8rfQgoduBam3lE5IWj2U2tLQeWxQyr1ZJkLbITtrAI3PgfMnuFAii+cncwFo805Fss/nbKx8K49vBuCEAq3MRhLjWy3ZvIgUHj67jWvl50dbNqc7TUguxhS4BxGr/cPPkP0CgYEA2nbJPGzSKhHTETL37NWIUAdU9q/6NVRISRRXeRqZYwE1VPzs2sIUxA8zEDBHX7OtvCKzvZy1Lg5Unx1nh4nCEVkbW/8npLlRG2jOcZJF6NRfhzwLz3WMIrP6j9SmjJaB+1mnrTjfsg36tDEPDjjJLjJHCx9z/qRJh1v4bh4aPpMCgYACG31T2IOEEZVlnvcvM3ceoqWT25oSbAEBZ6jSLyWmzOEJwJK7idUFfAg0gAQiQWF9K+snVqzHIB02FIXA43nA7pKRjmA+RiqZXJHEShFgk1y2HGiXGA8mSBvcyhTTJqbBy4vvjl5eRLzrZNwBPSUVPC3PZajCHrvZk9WhxWivIQKBgQCzCu1MH2dy4R7ZlqsIJ8zKweeJMZpfQI7pjclO0FTrhh7+Yzd+5db9A/P2jYrBTVHSwaILgTYf49DIguHJfEZXz26TzB7iapqlWxTukVHISt1ryPNo+E58VoLAhChnSiaHJ+g7GESE+d4A9cAACNwgh0YgQIvhIyW70M1e+j7KDwKBgQDQSBLFDFmvvTP3sIRAr1+0OZWd1eRcwdhs0U9GwootoCoUP/1Y64pqukT6B9oIB/No9Nyn8kUX3/ZDtCslaGKEUGMJXQ4hc5J+lq0tSi9ZWBdhqOuMPEfUF3IxW+9yeILP4ppUBn1m5MVOWg5CvuuEeCmy4bhMaUErUlHZ78t5cA==-----END RSA PRIVATE KEY-----"
|
|
83
|
-
);
|
|
84
|
-
let pk = ppk.toPk();
|
|
85
|
-
let signature = await EcRsaOaepAsync.sign(ppk, randomString);
|
|
86
|
-
let verified = await EcRsaOaepAsync.verify(pk, randomString, signature);
|
|
87
|
-
assert.isTrue(verified);
|
|
73
|
+
console.log("Deprecated. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main");
|
|
74
|
+
return;
|
|
88
75
|
});
|
|
89
76
|
it('signing then verifying w/caching', async () => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"-----BEGIN RSA PRIVATE KEY-----MIIEpAIBAAKCAQEAz4BiFucFE9bNcKfGD+e6aPRHl402YM4Z6nrurDRNlnwsWpsCoZasPLkjC314pVtHAI2duZo+esGKDloBsiLxASRJo3R2XiXVh2Y8U1RcHA5mWL4tMG5UY2d0libpNEHbHPNBmooVYpA2yhxN/vGibIk8x69uZWxJcFOxOg6zWG8EjF8UMgGnRCVSMTY3THhTlfZ0cGUzvrfb7OvHUgdCe285XkmYkj/V9P/m7hbWoOyJAJSTOm4/s6fIKpl72lblfN7bKaxTCsJp6/rQdmUeo+PIaa2lDOfo7dWbuTMcqkZ93kispNfYYhsEGUGlCsrrVWhlve8MenO4GdLsFP+HRwIDAQABAoIBAGaQpOuBIYde44lNxJ7UAdYi+Mg2aqyK81Btl0/TQo6hriLTAAfzPAt/z4y8ZkgFyCDD3zSAw2VWCPFzF+d/UfUohKWgyWlb9iHJLQRbbHQJwhkXV6raviesWXpmnVrROocizkie/FcNxac9OmhL8+cGJt7lHgJP9jTpiW6TGZ8ZzM8KBH2l80x9AWdvCjsICuPIZRjc706HtkKZzTROtq6Z/F4Gm0uWRnwAZrHTRpnh8qjtdBLYFrdDcUoFtzOM6UVRmocTfsNe4ntPpvwY2aGTWY7EmTj1kteMJ+fCQFIS+KjyMWQHsN8yQNfD5/j2uv6/BdSkO8uorGSJT6DwmTECgYEA8ydoQ4i58+A1udqA+fujM0Zn46++NTehFe75nqIt8rfQgoduBam3lE5IWj2U2tLQeWxQyr1ZJkLbITtrAI3PgfMnuFAii+cncwFo805Fss/nbKx8K49vBuCEAq3MRhLjWy3ZvIgUHj67jWvl50dbNqc7TUguxhS4BxGr/cPPkP0CgYEA2nbJPGzSKhHTETL37NWIUAdU9q/6NVRISRRXeRqZYwE1VPzs2sIUxA8zEDBHX7OtvCKzvZy1Lg5Unx1nh4nCEVkbW/8npLlRG2jOcZJF6NRfhzwLz3WMIrP6j9SmjJaB+1mnrTjfsg36tDEPDjjJLjJHCx9z/qRJh1v4bh4aPpMCgYACG31T2IOEEZVlnvcvM3ceoqWT25oSbAEBZ6jSLyWmzOEJwJK7idUFfAg0gAQiQWF9K+snVqzHIB02FIXA43nA7pKRjmA+RiqZXJHEShFgk1y2HGiXGA8mSBvcyhTTJqbBy4vvjl5eRLzrZNwBPSUVPC3PZajCHrvZk9WhxWivIQKBgQCzCu1MH2dy4R7ZlqsIJ8zKweeJMZpfQI7pjclO0FTrhh7+Yzd+5db9A/P2jYrBTVHSwaILgTYf49DIguHJfEZXz26TzB7iapqlWxTukVHISt1ryPNo+E58VoLAhChnSiaHJ+g7GESE+d4A9cAACNwgh0YgQIvhIyW70M1e+j7KDwKBgQDQSBLFDFmvvTP3sIRAr1+0OZWd1eRcwdhs0U9GwootoCoUP/1Y64pqukT6B9oIB/No9Nyn8kUX3/ZDtCslaGKEUGMJXQ4hc5J+lq0tSi9ZWBdhqOuMPEfUF3IxW+9yeILP4ppUBn1m5MVOWg5CvuuEeCmy4bhMaUErUlHZ78t5cA==-----END RSA PRIVATE KEY-----"
|
|
93
|
-
);
|
|
94
|
-
let pk = ppk.toPk();
|
|
95
|
-
let hrTime = hrtime();
|
|
96
|
-
let signature = await EcRsaOaepAsync.sign(ppk, randomString);
|
|
97
|
-
let elapsed = (hrtime()[0]*1000000 + hrtime()[1]/1000 - hrTime[0] * 1000000 - hrTime[1] / 1000)/1000;
|
|
98
|
-
console.log(randomString.length/1024+"KB signing speed: " + elapsed+"ms");
|
|
99
|
-
hrTime = hrtime();
|
|
100
|
-
EcCrypto.caching = true;
|
|
101
|
-
let verified = await EcRsaOaepAsync.verify(pk, randomString, signature);
|
|
102
|
-
elapsed = (hrtime()[0]*1000000 + hrtime()[1]/1000 - hrTime[0] * 1000000 - hrTime[1] / 1000)/1000;
|
|
103
|
-
console.log("verification wout/caching speed: " + elapsed+"ms");
|
|
104
|
-
hrTime = hrtime();
|
|
105
|
-
verified = await EcRsaOaepAsync.verify(pk, randomString, signature);
|
|
106
|
-
elapsed = (hrtime()[0]*1000000 + hrtime()[1]/1000 - hrTime[0] * 1000000 - hrTime[1] / 1000)/1000;
|
|
107
|
-
console.log("verification w/caching speed: " + elapsed+"ms");
|
|
108
|
-
//assert.isTrue(elapsed < 2);
|
|
109
|
-
assert.isTrue(verified);
|
|
110
|
-
EcCrypto.caching = false;
|
|
77
|
+
console.log("Deprecated. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main");
|
|
78
|
+
return;
|
|
111
79
|
});
|
|
112
80
|
it('signing then verifying (sha256)', async () => {
|
|
113
81
|
let randomString = EcAes.newIv(256*4);
|
|
@@ -127,7 +95,9 @@ describe("EcRsaOaepAsync", () => {
|
|
|
127
95
|
);
|
|
128
96
|
let pk = ppk.toPk();
|
|
129
97
|
let signature = await EcRsaOaepAsync.signSha256(ppk, randomString);
|
|
98
|
+
console.log(signature);
|
|
130
99
|
let verified = await EcRsaOaepAsync.verifySha256(pk, randomString, signature);
|
|
100
|
+
console.log(verified);
|
|
131
101
|
assert.isTrue(verified);
|
|
132
102
|
});
|
|
133
103
|
it('signing then verifying w/caching (sha256)', async () => {
|
|
@@ -65,46 +65,16 @@ describe("EcRsaOaepAsyncWorker", () => {
|
|
|
65
65
|
assert.isTrue(randomString == decrypted);
|
|
66
66
|
});
|
|
67
67
|
it('signing then verifying', async () => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"-----BEGIN RSA PRIVATE KEY-----MIIEpAIBAAKCAQEAz4BiFucFE9bNcKfGD+e6aPRHl402YM4Z6nrurDRNlnwsWpsCoZasPLkjC314pVtHAI2duZo+esGKDloBsiLxASRJo3R2XiXVh2Y8U1RcHA5mWL4tMG5UY2d0libpNEHbHPNBmooVYpA2yhxN/vGibIk8x69uZWxJcFOxOg6zWG8EjF8UMgGnRCVSMTY3THhTlfZ0cGUzvrfb7OvHUgdCe285XkmYkj/V9P/m7hbWoOyJAJSTOm4/s6fIKpl72lblfN7bKaxTCsJp6/rQdmUeo+PIaa2lDOfo7dWbuTMcqkZ93kispNfYYhsEGUGlCsrrVWhlve8MenO4GdLsFP+HRwIDAQABAoIBAGaQpOuBIYde44lNxJ7UAdYi+Mg2aqyK81Btl0/TQo6hriLTAAfzPAt/z4y8ZkgFyCDD3zSAw2VWCPFzF+d/UfUohKWgyWlb9iHJLQRbbHQJwhkXV6raviesWXpmnVrROocizkie/FcNxac9OmhL8+cGJt7lHgJP9jTpiW6TGZ8ZzM8KBH2l80x9AWdvCjsICuPIZRjc706HtkKZzTROtq6Z/F4Gm0uWRnwAZrHTRpnh8qjtdBLYFrdDcUoFtzOM6UVRmocTfsNe4ntPpvwY2aGTWY7EmTj1kteMJ+fCQFIS+KjyMWQHsN8yQNfD5/j2uv6/BdSkO8uorGSJT6DwmTECgYEA8ydoQ4i58+A1udqA+fujM0Zn46++NTehFe75nqIt8rfQgoduBam3lE5IWj2U2tLQeWxQyr1ZJkLbITtrAI3PgfMnuFAii+cncwFo805Fss/nbKx8K49vBuCEAq3MRhLjWy3ZvIgUHj67jWvl50dbNqc7TUguxhS4BxGr/cPPkP0CgYEA2nbJPGzSKhHTETL37NWIUAdU9q/6NVRISRRXeRqZYwE1VPzs2sIUxA8zEDBHX7OtvCKzvZy1Lg5Unx1nh4nCEVkbW/8npLlRG2jOcZJF6NRfhzwLz3WMIrP6j9SmjJaB+1mnrTjfsg36tDEPDjjJLjJHCx9z/qRJh1v4bh4aPpMCgYACG31T2IOEEZVlnvcvM3ceoqWT25oSbAEBZ6jSLyWmzOEJwJK7idUFfAg0gAQiQWF9K+snVqzHIB02FIXA43nA7pKRjmA+RiqZXJHEShFgk1y2HGiXGA8mSBvcyhTTJqbBy4vvjl5eRLzrZNwBPSUVPC3PZajCHrvZk9WhxWivIQKBgQCzCu1MH2dy4R7ZlqsIJ8zKweeJMZpfQI7pjclO0FTrhh7+Yzd+5db9A/P2jYrBTVHSwaILgTYf49DIguHJfEZXz26TzB7iapqlWxTukVHISt1ryPNo+E58VoLAhChnSiaHJ+g7GESE+d4A9cAACNwgh0YgQIvhIyW70M1e+j7KDwKBgQDQSBLFDFmvvTP3sIRAr1+0OZWd1eRcwdhs0U9GwootoCoUP/1Y64pqukT6B9oIB/No9Nyn8kUX3/ZDtCslaGKEUGMJXQ4hc5J+lq0tSi9ZWBdhqOuMPEfUF3IxW+9yeILP4ppUBn1m5MVOWg5CvuuEeCmy4bhMaUErUlHZ78t5cA==-----END RSA PRIVATE KEY-----"
|
|
71
|
-
);
|
|
72
|
-
let pk = ppk.toPk();
|
|
73
|
-
let signature = await EcRsaOaepAsyncWorker.sign(ppk, randomString);
|
|
74
|
-
let verified = await EcRsaOaepAsyncWorker.verify(pk, randomString, signature);
|
|
75
|
-
assert.isTrue(verified);
|
|
68
|
+
console.log("Deprecated. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main");
|
|
69
|
+
return;
|
|
76
70
|
});
|
|
77
71
|
it('signing then verifying (utf-8)', async () => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
let ppk = EcPpk.fromPem(
|
|
81
|
-
"-----BEGIN RSA PRIVATE KEY-----MIIEpAIBAAKCAQEAz4BiFucFE9bNcKfGD+e6aPRHl402YM4Z6nrurDRNlnwsWpsCoZasPLkjC314pVtHAI2duZo+esGKDloBsiLxASRJo3R2XiXVh2Y8U1RcHA5mWL4tMG5UY2d0libpNEHbHPNBmooVYpA2yhxN/vGibIk8x69uZWxJcFOxOg6zWG8EjF8UMgGnRCVSMTY3THhTlfZ0cGUzvrfb7OvHUgdCe285XkmYkj/V9P/m7hbWoOyJAJSTOm4/s6fIKpl72lblfN7bKaxTCsJp6/rQdmUeo+PIaa2lDOfo7dWbuTMcqkZ93kispNfYYhsEGUGlCsrrVWhlve8MenO4GdLsFP+HRwIDAQABAoIBAGaQpOuBIYde44lNxJ7UAdYi+Mg2aqyK81Btl0/TQo6hriLTAAfzPAt/z4y8ZkgFyCDD3zSAw2VWCPFzF+d/UfUohKWgyWlb9iHJLQRbbHQJwhkXV6raviesWXpmnVrROocizkie/FcNxac9OmhL8+cGJt7lHgJP9jTpiW6TGZ8ZzM8KBH2l80x9AWdvCjsICuPIZRjc706HtkKZzTROtq6Z/F4Gm0uWRnwAZrHTRpnh8qjtdBLYFrdDcUoFtzOM6UVRmocTfsNe4ntPpvwY2aGTWY7EmTj1kteMJ+fCQFIS+KjyMWQHsN8yQNfD5/j2uv6/BdSkO8uorGSJT6DwmTECgYEA8ydoQ4i58+A1udqA+fujM0Zn46++NTehFe75nqIt8rfQgoduBam3lE5IWj2U2tLQeWxQyr1ZJkLbITtrAI3PgfMnuFAii+cncwFo805Fss/nbKx8K49vBuCEAq3MRhLjWy3ZvIgUHj67jWvl50dbNqc7TUguxhS4BxGr/cPPkP0CgYEA2nbJPGzSKhHTETL37NWIUAdU9q/6NVRISRRXeRqZYwE1VPzs2sIUxA8zEDBHX7OtvCKzvZy1Lg5Unx1nh4nCEVkbW/8npLlRG2jOcZJF6NRfhzwLz3WMIrP6j9SmjJaB+1mnrTjfsg36tDEPDjjJLjJHCx9z/qRJh1v4bh4aPpMCgYACG31T2IOEEZVlnvcvM3ceoqWT25oSbAEBZ6jSLyWmzOEJwJK7idUFfAg0gAQiQWF9K+snVqzHIB02FIXA43nA7pKRjmA+RiqZXJHEShFgk1y2HGiXGA8mSBvcyhTTJqbBy4vvjl5eRLzrZNwBPSUVPC3PZajCHrvZk9WhxWivIQKBgQCzCu1MH2dy4R7ZlqsIJ8zKweeJMZpfQI7pjclO0FTrhh7+Yzd+5db9A/P2jYrBTVHSwaILgTYf49DIguHJfEZXz26TzB7iapqlWxTukVHISt1ryPNo+E58VoLAhChnSiaHJ+g7GESE+d4A9cAACNwgh0YgQIvhIyW70M1e+j7KDwKBgQDQSBLFDFmvvTP3sIRAr1+0OZWd1eRcwdhs0U9GwootoCoUP/1Y64pqukT6B9oIB/No9Nyn8kUX3/ZDtCslaGKEUGMJXQ4hc5J+lq0tSi9ZWBdhqOuMPEfUF3IxW+9yeILP4ppUBn1m5MVOWg5CvuuEeCmy4bhMaUErUlHZ78t5cA==-----END RSA PRIVATE KEY-----"
|
|
82
|
-
);
|
|
83
|
-
let pk = ppk.toPk();
|
|
84
|
-
let signature = await EcRsaOaepAsyncWorker.sign(ppk, randomString);
|
|
85
|
-
let verified = await EcRsaOaepAsyncWorker.verify(pk, randomString, signature);
|
|
86
|
-
assert.isTrue(verified);
|
|
72
|
+
console.log("Deprecated. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main");
|
|
73
|
+
return;
|
|
87
74
|
});
|
|
88
75
|
it('signing then verifying w/caching', async () => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"-----BEGIN RSA PRIVATE KEY-----MIIEpAIBAAKCAQEAz4BiFucFE9bNcKfGD+e6aPRHl402YM4Z6nrurDRNlnwsWpsCoZasPLkjC314pVtHAI2duZo+esGKDloBsiLxASRJo3R2XiXVh2Y8U1RcHA5mWL4tMG5UY2d0libpNEHbHPNBmooVYpA2yhxN/vGibIk8x69uZWxJcFOxOg6zWG8EjF8UMgGnRCVSMTY3THhTlfZ0cGUzvrfb7OvHUgdCe285XkmYkj/V9P/m7hbWoOyJAJSTOm4/s6fIKpl72lblfN7bKaxTCsJp6/rQdmUeo+PIaa2lDOfo7dWbuTMcqkZ93kispNfYYhsEGUGlCsrrVWhlve8MenO4GdLsFP+HRwIDAQABAoIBAGaQpOuBIYde44lNxJ7UAdYi+Mg2aqyK81Btl0/TQo6hriLTAAfzPAt/z4y8ZkgFyCDD3zSAw2VWCPFzF+d/UfUohKWgyWlb9iHJLQRbbHQJwhkXV6raviesWXpmnVrROocizkie/FcNxac9OmhL8+cGJt7lHgJP9jTpiW6TGZ8ZzM8KBH2l80x9AWdvCjsICuPIZRjc706HtkKZzTROtq6Z/F4Gm0uWRnwAZrHTRpnh8qjtdBLYFrdDcUoFtzOM6UVRmocTfsNe4ntPpvwY2aGTWY7EmTj1kteMJ+fCQFIS+KjyMWQHsN8yQNfD5/j2uv6/BdSkO8uorGSJT6DwmTECgYEA8ydoQ4i58+A1udqA+fujM0Zn46++NTehFe75nqIt8rfQgoduBam3lE5IWj2U2tLQeWxQyr1ZJkLbITtrAI3PgfMnuFAii+cncwFo805Fss/nbKx8K49vBuCEAq3MRhLjWy3ZvIgUHj67jWvl50dbNqc7TUguxhS4BxGr/cPPkP0CgYEA2nbJPGzSKhHTETL37NWIUAdU9q/6NVRISRRXeRqZYwE1VPzs2sIUxA8zEDBHX7OtvCKzvZy1Lg5Unx1nh4nCEVkbW/8npLlRG2jOcZJF6NRfhzwLz3WMIrP6j9SmjJaB+1mnrTjfsg36tDEPDjjJLjJHCx9z/qRJh1v4bh4aPpMCgYACG31T2IOEEZVlnvcvM3ceoqWT25oSbAEBZ6jSLyWmzOEJwJK7idUFfAg0gAQiQWF9K+snVqzHIB02FIXA43nA7pKRjmA+RiqZXJHEShFgk1y2HGiXGA8mSBvcyhTTJqbBy4vvjl5eRLzrZNwBPSUVPC3PZajCHrvZk9WhxWivIQKBgQCzCu1MH2dy4R7ZlqsIJ8zKweeJMZpfQI7pjclO0FTrhh7+Yzd+5db9A/P2jYrBTVHSwaILgTYf49DIguHJfEZXz26TzB7iapqlWxTukVHISt1ryPNo+E58VoLAhChnSiaHJ+g7GESE+d4A9cAACNwgh0YgQIvhIyW70M1e+j7KDwKBgQDQSBLFDFmvvTP3sIRAr1+0OZWd1eRcwdhs0U9GwootoCoUP/1Y64pqukT6B9oIB/No9Nyn8kUX3/ZDtCslaGKEUGMJXQ4hc5J+lq0tSi9ZWBdhqOuMPEfUF3IxW+9yeILP4ppUBn1m5MVOWg5CvuuEeCmy4bhMaUErUlHZ78t5cA==-----END RSA PRIVATE KEY-----"
|
|
92
|
-
);
|
|
93
|
-
let pk = ppk.toPk();
|
|
94
|
-
let hrTime = hrtime();
|
|
95
|
-
let signature = await EcRsaOaepAsyncWorker.sign(ppk, randomString);
|
|
96
|
-
let elapsed = (hrtime()[0]*1000000 + hrtime()[1]/1000 - hrTime[0] * 1000000 - hrTime[1] / 1000)/1000;
|
|
97
|
-
console.log(randomString.length/1024+"KB signing speed: " + elapsed+"ms");
|
|
98
|
-
hrTime = hrtime();
|
|
99
|
-
EcCrypto.caching = true;
|
|
100
|
-
let verified = await EcRsaOaepAsyncWorker.verify(pk, randomString, signature);
|
|
101
|
-
elapsed = (hrtime()[0]*1000000 + hrtime()[1]/1000 - hrTime[0] * 1000000 - hrTime[1] / 1000)/1000;
|
|
102
|
-
console.log("verification wout/caching speed: " + elapsed+"ms");
|
|
103
|
-
hrTime = hrtime();
|
|
104
|
-
verified = await EcRsaOaepAsyncWorker.verify(pk, randomString, signature);
|
|
105
|
-
elapsed = (hrtime()[0]*1000000 + hrtime()[1]/1000 - hrTime[0] * 1000000 - hrTime[1] / 1000)/1000;
|
|
106
|
-
console.log("verification w/caching speed: " + elapsed+"ms");
|
|
107
|
-
assert.isTrue(verified);
|
|
76
|
+
console.log("Deprecated. See https://github.com/Lomilar/node-fips-rsassa-pkcs1-15-sha1/tree/main");
|
|
77
|
+
return;
|
|
108
78
|
});
|
|
109
79
|
it('signing then verifying (sha256)', async () => {
|
|
110
80
|
let randomString = EcAes.newIv(256*4);
|
|
@@ -4,6 +4,7 @@ const EcPpkFacade = require("../../../../com/eduworks/ec/crypto/EcPpkFacade");
|
|
|
4
4
|
const EcRsaOaepAsync = require("../../../../com/eduworks/ec/crypto/EcRsaOaepAsync");
|
|
5
5
|
const {cassReturnAsPromise, cassPromisify} = require("../../../../com/eduworks/ec/promises/helpers");
|
|
6
6
|
const EbacSignature = require("../../../../com/eduworks/schema/ebac/EbacSignature");
|
|
7
|
+
let realCrypto = require('crypto');
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Manages identities and contacts, provides hooks to respond to identity and
|
|
@@ -348,7 +349,8 @@ module.exports = class EcIdentityManager {
|
|
|
348
349
|
duration,
|
|
349
350
|
server,
|
|
350
351
|
success,
|
|
351
|
-
failure
|
|
352
|
+
failure,
|
|
353
|
+
signatureSheetHashAlgorithm
|
|
352
354
|
) {
|
|
353
355
|
let cache = null;
|
|
354
356
|
if (this.signatureSheetCaching) {
|
|
@@ -365,7 +367,7 @@ module.exports = class EcIdentityManager {
|
|
|
365
367
|
.map((pk) => this.getPpk(EcPk.fromPem(pk)))
|
|
366
368
|
.filter((x) => x != null)
|
|
367
369
|
.map((ppk) =>
|
|
368
|
-
this.createSignature(finalDuration, server, ppk)
|
|
370
|
+
this.createSignature(finalDuration, server, ppk, signatureSheetHashAlgorithm)
|
|
369
371
|
);
|
|
370
372
|
let p = Promise.all(promises);
|
|
371
373
|
p = p.then((signatureCandidates) => {
|
|
@@ -394,7 +396,7 @@ module.exports = class EcIdentityManager {
|
|
|
394
396
|
* @method signatureSheet
|
|
395
397
|
* @static
|
|
396
398
|
*/
|
|
397
|
-
signatureSheet(duration, server, success, failure) {
|
|
399
|
+
signatureSheet(duration, server, success, failure, signatureSheetHashAlgorithm) {
|
|
398
400
|
let cache = null;
|
|
399
401
|
if (this.signatureSheetCaching) {
|
|
400
402
|
cache = this.signatureSheetCache[server];
|
|
@@ -407,7 +409,7 @@ module.exports = class EcIdentityManager {
|
|
|
407
409
|
}
|
|
408
410
|
let finalDuration = duration;
|
|
409
411
|
let promises = this.ids.map((ident) =>
|
|
410
|
-
this.createSignature(finalDuration, server, ident.ppk)
|
|
412
|
+
this.createSignature(finalDuration, server, ident.ppk, signatureSheetHashAlgorithm)
|
|
411
413
|
);
|
|
412
414
|
let p = Promise.all(promises);
|
|
413
415
|
p = p.then((signatureCandidates) => {
|
|
@@ -437,7 +439,11 @@ module.exports = class EcIdentityManager {
|
|
|
437
439
|
* @method createSignature
|
|
438
440
|
* @static
|
|
439
441
|
*/
|
|
440
|
-
createSignature(duration, server, ppk) {
|
|
442
|
+
createSignature(duration, server, ppk, algorithm) {
|
|
443
|
+
if (process && process.env && process.env.FIPS == null && realCrypto.getFips && realCrypto.getFips() == 1)
|
|
444
|
+
{
|
|
445
|
+
algorithm = "SHA-256";
|
|
446
|
+
}
|
|
441
447
|
if (ppk instanceof EcPpkFacade) {
|
|
442
448
|
return null;
|
|
443
449
|
}
|
|
@@ -446,11 +452,17 @@ module.exports = class EcIdentityManager {
|
|
|
446
452
|
s.server = server;
|
|
447
453
|
delete s.owner;
|
|
448
454
|
delete s.signature;
|
|
455
|
+
delete s.signatureSha256;
|
|
449
456
|
s["@owner"] = ppk.toPk().toPem();
|
|
457
|
+
if (algorithm != null && algorithm == "SHA-256")
|
|
458
|
+
return EcRsaOaepAsync.signSha256(ppk, s.toJson()).then((signatureSha256) => {
|
|
459
|
+
s["@signatureSha256"] = signatureSha256;
|
|
460
|
+
return s;
|
|
461
|
+
});
|
|
450
462
|
return EcRsaOaepAsync.sign(ppk, s.toJson()).then((signature) => {
|
|
451
463
|
s["@signature"] = signature;
|
|
452
464
|
return s;
|
|
453
|
-
});
|
|
465
|
+
});
|
|
454
466
|
}
|
|
455
467
|
/**
|
|
456
468
|
* Get PPK from PK (if we have it)
|
|
@@ -525,8 +537,9 @@ module.exports = class EcIdentityManager {
|
|
|
525
537
|
}
|
|
526
538
|
}
|
|
527
539
|
return Promise.all(promises).then((signatures) => {
|
|
528
|
-
d.
|
|
529
|
-
if (d.
|
|
540
|
+
d.signatureSha256 = signatures.filter(x=>x);
|
|
541
|
+
if (d.signatureSha256 != null && d.signatureSha256.length == 0) {
|
|
542
|
+
delete d["signatureSha256"];
|
|
530
543
|
delete d["signature"];
|
|
531
544
|
}
|
|
532
545
|
return d;
|
|
@@ -91,11 +91,15 @@ module.exports = class EcRekeyRequest extends EcRemoteLinkedData {
|
|
|
91
91
|
*/
|
|
92
92
|
async verify() {
|
|
93
93
|
if (!await super.verify()) return false;
|
|
94
|
-
return await EcRsaOaepAsync.verifySha256(
|
|
94
|
+
return (await EcRsaOaepAsync.verifySha256(
|
|
95
95
|
EcPk.fromPem(this.rekeyPk),
|
|
96
96
|
this.toSignableRekeyJson(),
|
|
97
97
|
this.rekeySignature
|
|
98
|
-
)
|
|
98
|
+
) || (await EcRsaOaepAsync.verify(
|
|
99
|
+
EcPk.fromPem(this.rekeyPk),
|
|
100
|
+
this.toSignableRekeyJson(),
|
|
101
|
+
this.rekeySignature
|
|
102
|
+
)));
|
|
99
103
|
}
|
|
100
104
|
addRekeyRequestToForwardingTable() {
|
|
101
105
|
if (!this.verify()) return;
|
|
@@ -50,6 +50,7 @@ module.exports = class EcRemoteIdentityManager extends RemoteIdentityManagerInte
|
|
|
50
50
|
secretSalt = null;
|
|
51
51
|
secretIterations = 0;
|
|
52
52
|
configured = false;
|
|
53
|
+
signatureSheetHashAlgorithm;
|
|
53
54
|
/**
|
|
54
55
|
* Returns true if the identity manager is global. Returns false if the identity manager is local to the server.
|
|
55
56
|
*
|
|
@@ -165,6 +166,7 @@ module.exports = class EcRemoteIdentityManager extends RemoteIdentityManagerInte
|
|
|
165
166
|
"Insufficient iterations on Secret Hash"
|
|
166
167
|
);
|
|
167
168
|
}
|
|
169
|
+
me.signatureSheetHashAlgorithm = p1["signatureSheetHashAlgorithm"];
|
|
168
170
|
me.configured = true;
|
|
169
171
|
return p1;
|
|
170
172
|
},
|
|
@@ -529,7 +531,7 @@ module.exports = class EcRemoteIdentityManager extends RemoteIdentityManagerInte
|
|
|
529
531
|
},
|
|
530
532
|
function (arg0) {
|
|
531
533
|
throw new Error(arg0);
|
|
532
|
-
}
|
|
534
|
+
}, this.signatureSheetHashAlgorithm
|
|
533
535
|
),
|
|
534
536
|
success,
|
|
535
537
|
failure
|
|
@@ -42,6 +42,7 @@ module.exports = class EcRepository {
|
|
|
42
42
|
selectedServer = null;
|
|
43
43
|
selectedServerProxy = null;
|
|
44
44
|
autoDetectFound = false;
|
|
45
|
+
signatureSheetHashAlgorithm = "SHA-1";
|
|
45
46
|
timeOffset = 0;
|
|
46
47
|
postMaxSize = null;
|
|
47
48
|
init(selectedServer, success, failure, loginObjectCallback) {
|
|
@@ -66,6 +67,9 @@ module.exports = class EcRepository {
|
|
|
66
67
|
if (p1["postMaxSize"]) {
|
|
67
68
|
me.postMaxSize = p1["postMaxSize"];
|
|
68
69
|
}
|
|
70
|
+
if (p1["signatureSheetHashAlgorithm"]) {
|
|
71
|
+
me.signatureSheetHashAlgorithm = p1["signatureSheetHashAlgorithm"];
|
|
72
|
+
}
|
|
69
73
|
if (p1["ping"] == "pong") {
|
|
70
74
|
if (loginObjectCallback != null)
|
|
71
75
|
loginObjectCallback(p1);
|
|
@@ -132,7 +136,7 @@ module.exports = class EcRepository {
|
|
|
132
136
|
p = EcRemote.getExpectingObject(finalUrl);
|
|
133
137
|
} else {
|
|
134
138
|
let offset = this.setOffset(url);
|
|
135
|
-
p = eim.signatureSheet(60000 + offset, url).then(
|
|
139
|
+
p = eim.signatureSheet(60000 + offset, url, null, null, repo != null ? repo.signatureSheetHashAlgorithm : null).then(
|
|
136
140
|
(signatureSheet) => {
|
|
137
141
|
let fd = new FormData();
|
|
138
142
|
fd.append("signatureSheet", signatureSheet);
|
|
@@ -247,7 +251,7 @@ module.exports = class EcRepository {
|
|
|
247
251
|
p = EcRemote.getExpectingObject(finalUrl);
|
|
248
252
|
} else {
|
|
249
253
|
let offset = this.setOffset(url);
|
|
250
|
-
p = eim.signatureSheet(60000 + offset, url).then(
|
|
254
|
+
p = eim.signatureSheet(60000 + offset, url, null, null, repo != null ? repo.signatureSheetHashAlgorithm : null).then(
|
|
251
255
|
(signatureSheet) => {
|
|
252
256
|
let fd = new FormData();
|
|
253
257
|
fd.append("signatureSheet", signatureSheet);
|
|
@@ -653,10 +657,11 @@ module.exports = class EcRepository {
|
|
|
653
657
|
p = eim.signatureSheetFor(
|
|
654
658
|
data.owner,
|
|
655
659
|
60000 + offset,
|
|
656
|
-
data.id
|
|
660
|
+
data.id,
|
|
661
|
+
null, null, repo != null ? repo.signatureSheetHashAlgorithm : null
|
|
657
662
|
);
|
|
658
663
|
} else {
|
|
659
|
-
p = eim.signatureSheet(60000 + offset, data.id);
|
|
664
|
+
p = eim.signatureSheet(60000 + offset, data.id, null, null, repo != null ? repo.signatureSheetHashAlgorithm : null);
|
|
660
665
|
}
|
|
661
666
|
p = p.then((signatureSheet) => {
|
|
662
667
|
let fd = new FormData();
|
|
@@ -752,7 +757,8 @@ module.exports = class EcRepository {
|
|
|
752
757
|
return eim.signatureSheetFor(
|
|
753
758
|
data.owner,
|
|
754
759
|
60000 + offset,
|
|
755
|
-
data.id
|
|
760
|
+
data.id,
|
|
761
|
+
null, null, repo != null ? repo.signatureSheetHashAlgorithm : null
|
|
756
762
|
).then((signatureSheet) => {
|
|
757
763
|
return EcRemote._delete(
|
|
758
764
|
targetUrl,
|
|
@@ -821,7 +827,8 @@ module.exports = class EcRepository {
|
|
|
821
827
|
return eim.signatureSheetFor(
|
|
822
828
|
data.owner,
|
|
823
829
|
60000 + offset,
|
|
824
|
-
data.id
|
|
830
|
+
data.id,
|
|
831
|
+
null, null, repo != null ? repo.signatureSheetHashAlgorithm : null
|
|
825
832
|
).then((signatureSheet) => {
|
|
826
833
|
return EcRemote._delete(
|
|
827
834
|
targetUrl,
|
|
@@ -907,12 +914,13 @@ module.exports = class EcRepository {
|
|
|
907
914
|
return eim.signatureSheetFor(
|
|
908
915
|
allOwners,
|
|
909
916
|
60000 + this.timeOffset,
|
|
910
|
-
this.selectedServer
|
|
917
|
+
this.selectedServer,
|
|
918
|
+
null, null, this.signatureSheetHashAlgorithm
|
|
911
919
|
);
|
|
912
920
|
} else {
|
|
913
921
|
return eim.signatureSheet(
|
|
914
922
|
60000 + this.timeOffset,
|
|
915
|
-
this.selectedServer
|
|
923
|
+
this.selectedServer, null, null, this.signatureSheetHashAlgorithm
|
|
916
924
|
);
|
|
917
925
|
}
|
|
918
926
|
})
|
|
@@ -980,7 +988,7 @@ module.exports = class EcRepository {
|
|
|
980
988
|
p = p.then(() => {
|
|
981
989
|
return eim.signatureSheet(
|
|
982
990
|
60000 + this.timeOffset,
|
|
983
|
-
this.selectedServer
|
|
991
|
+
this.selectedServer, null, null, this.signatureSheetHashAlgorithm
|
|
984
992
|
).then((signatureSheet) => {
|
|
985
993
|
fd.append("signatureSheet", signatureSheet);
|
|
986
994
|
});
|
|
@@ -1124,7 +1132,7 @@ module.exports = class EcRepository {
|
|
|
1124
1132
|
p = p.then(() =>
|
|
1125
1133
|
eim.signatureSheet(
|
|
1126
1134
|
60000 + this.timeOffset,
|
|
1127
|
-
this.selectedServer
|
|
1135
|
+
this.selectedServer, null, null, this.signatureSheetHashAlgorithm
|
|
1128
1136
|
).then((signatureSheet) => {
|
|
1129
1137
|
fd.append("signatureSheet", signatureSheet);
|
|
1130
1138
|
})
|
|
@@ -1546,7 +1554,7 @@ module.exports = class EcRepository {
|
|
|
1546
1554
|
"signatureSheet",
|
|
1547
1555
|
eim.signatureSheet(
|
|
1548
1556
|
60000 + this.timeOffset,
|
|
1549
|
-
this.selectedServer
|
|
1557
|
+
this.selectedServer, null, null, this.signatureSheetHashAlgorithm
|
|
1550
1558
|
)
|
|
1551
1559
|
);
|
|
1552
1560
|
EcRemote.postExpectingObject(
|
|
@@ -68,6 +68,7 @@ let changeNameAndSaveAndCheck = async (rld) => {
|
|
|
68
68
|
let newName = "Some Thing " + EcCrypto.generateUUID();
|
|
69
69
|
rld.setName(newName);
|
|
70
70
|
await repo.saveTo(rld);
|
|
71
|
+
console.log(rld.id);
|
|
71
72
|
assert.equal((await EcEncryptedValue.fromEncryptedValue(await EcRepository.get(rld.shortId(), null, null, repo))).getName(), newName);
|
|
72
73
|
};
|
|
73
74
|
|
|
@@ -250,15 +250,23 @@ module.exports = class EcRemoteLinkedData extends EcLinkedData {
|
|
|
250
250
|
if (ppk instanceof EcPpkFacade)
|
|
251
251
|
return;
|
|
252
252
|
let signableJson = this.toSignableJson();
|
|
253
|
-
let signed = await EcRsaOaepAsync.sign(ppk, signableJson);
|
|
254
|
-
if (this.signature != null) {
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
// let signed = await EcRsaOaepAsync.sign(ppk, signableJson);
|
|
254
|
+
// if (this.signature != null) {
|
|
255
|
+
// for (let i = 0; i < this.signature.length; i++)
|
|
256
|
+
// if (this.signature[i] == signed) return;
|
|
257
|
+
// } else {
|
|
258
|
+
// this.signature = [];
|
|
259
|
+
// }
|
|
260
|
+
// this.signature.push(signed);
|
|
261
|
+
let signedSha256 = await EcRsaOaepAsync.signSha256(ppk, signableJson);
|
|
262
|
+
if (this.signatureSha256 != null) {
|
|
263
|
+
for (let i = 0; i < this.signatureSha256.length; i++)
|
|
264
|
+
if (this.signatureSha256[i] == signedSha256) return;
|
|
257
265
|
} else {
|
|
258
|
-
this.
|
|
266
|
+
this.signatureSha256 = [];
|
|
259
267
|
}
|
|
260
|
-
this.
|
|
261
|
-
return
|
|
268
|
+
this.signatureSha256.push(signedSha256);
|
|
269
|
+
return signedSha256;
|
|
262
270
|
}
|
|
263
271
|
/**
|
|
264
272
|
* Verifies the object's signatures.
|
|
@@ -267,9 +275,11 @@ module.exports = class EcRemoteLinkedData extends EcLinkedData {
|
|
|
267
275
|
* @method verify
|
|
268
276
|
*/
|
|
269
277
|
async verify() {
|
|
278
|
+
let works = null;
|
|
279
|
+
let works256 = null;
|
|
270
280
|
if (this.signature != null) {
|
|
271
281
|
for (let i = 0; i < this.signature.length; ) {
|
|
272
|
-
|
|
282
|
+
works = false;
|
|
273
283
|
let sig = this.signature[i];
|
|
274
284
|
if (this.owner != null) {
|
|
275
285
|
for (let j = 0; j < this.owner.length; j++) {
|
|
@@ -295,10 +305,41 @@ module.exports = class EcRemoteLinkedData extends EcLinkedData {
|
|
|
295
305
|
if (!works) return false;
|
|
296
306
|
else i++;
|
|
297
307
|
}
|
|
298
|
-
if (this.signature.length == 0) return false;
|
|
299
|
-
return true;
|
|
300
308
|
}
|
|
301
|
-
|
|
309
|
+
console.log(works);
|
|
310
|
+
if (this.signatureSha256 != null) {
|
|
311
|
+
for (let i = 0; i < this.signatureSha256.length; ) {
|
|
312
|
+
works256 = false;
|
|
313
|
+
let sig = this.signatureSha256[i];
|
|
314
|
+
if (this.owner != null) {
|
|
315
|
+
for (let j = 0; j < this.owner.length; j++) {
|
|
316
|
+
let own = this.owner[j];
|
|
317
|
+
let pk = EcPk.fromPem(own);
|
|
318
|
+
let verify = false;
|
|
319
|
+
try {
|
|
320
|
+
verify = await EcRsaOaepAsync.verifySha256(
|
|
321
|
+
pk,
|
|
322
|
+
this.toSignableJson(),
|
|
323
|
+
sig
|
|
324
|
+
);
|
|
325
|
+
global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcRemoteLDVer256", verify);
|
|
326
|
+
} catch (ex) {
|
|
327
|
+
verify = false;
|
|
328
|
+
}
|
|
329
|
+
if (verify == true) {
|
|
330
|
+
works256 = true;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (!works256) return false;
|
|
336
|
+
else i++;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
if (works == null && works256 == null) return false;
|
|
340
|
+
if (works == null) return works256;
|
|
341
|
+
if (works256 == null) return works;
|
|
342
|
+
return true;
|
|
302
343
|
}
|
|
303
344
|
/**
|
|
304
345
|
* Adds an owner to the object, if the owner does not exist.
|
|
@@ -540,6 +581,9 @@ module.exports = class EcRemoteLinkedData extends EcLinkedData {
|
|
|
540
581
|
if (me["@signature"] != null) {
|
|
541
582
|
me["signature"] = me["@signature"];
|
|
542
583
|
}
|
|
584
|
+
if (me["@signatureSha256"] != null) {
|
|
585
|
+
me["signatureSha256"] = me["@signatureSha256"];
|
|
586
|
+
}
|
|
543
587
|
if (me["@encryptedType"] != null) {
|
|
544
588
|
me["encryptedType"] = me["@encryptedType"];
|
|
545
589
|
}
|
|
@@ -309,12 +309,14 @@ global.jsonld = require("jsonld");
|
|
|
309
309
|
delete d["owner"];
|
|
310
310
|
delete d["reader"];
|
|
311
311
|
delete d["@signature"];
|
|
312
|
+
delete d["@signatureSha256"];
|
|
312
313
|
delete d["@owner"];
|
|
313
314
|
delete d["@reader"];
|
|
314
315
|
delete d["@id"];
|
|
315
316
|
} else {
|
|
316
317
|
delete d["signature"];
|
|
317
318
|
delete d["@signature"];
|
|
319
|
+
delete d["@signatureSha256"];
|
|
318
320
|
delete d["@id"];
|
|
319
321
|
}
|
|
320
322
|
let e = new EcLinkedData(d.context, d.type);
|