Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-webcrypto-ossl

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-webcrypto-ossl - npm Package Compare versions

Comparing version 1.0.20 to 1.0.21

0

index.d.ts

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ // Core

@@ -0,0 +0,0 @@ // Core

@@ -0,0 +0,0 @@ // Core

@@ -0,0 +0,0 @@ // Core

22

lib/crypto/rsa.ts

@@ -48,5 +48,6 @@ // Core

public static importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable: boolean, keyUsages: string[]): PromiseLike<CryptoKey> {
let keyType = native.KeyType.PUBLIC;
const alg: any = algorithm;
return new Promise((resolve, reject) => {
const formatLC = format.toLocaleLowerCase();
const alg = algorithm as Algorithm;
switch (formatLC) {

@@ -60,3 +61,2 @@ case "jwk":

data["e"] = b64_decode(jwk.e!);
let keyType = native.KeyType.PUBLIC;
if (jwk.d) {

@@ -76,4 +76,3 @@ keyType = native.KeyType.PRIVATE;

} else {
const rsa = new CryptoKey(key, alg, keyType ? "private" : "public", extractable, keyUsages);
resolve(rsa);
resolve(key);
}

@@ -90,5 +89,6 @@ } catch (e) {

}
let importFunction = native.Key.importPkcs8;
if (formatLC === "spki") {
importFunction = native.Key.importSpki;
let importFunction = native.Key.importSpki;
if (formatLC === "pkcs8") {
keyType = native.KeyType.PRIVATE;
importFunction = native.Key.importPkcs8;
}

@@ -100,4 +100,3 @@ importFunction(<Buffer> keyData, (err, key) => {

} else {
const rsa = new CryptoKey(key, alg, format.toLocaleLowerCase() === "spki" ? "public" : "private", extractable, keyUsages);
resolve(rsa);
resolve(key);
}

@@ -112,2 +111,7 @@ } catch (e) {

}
})
.then((key: native.Key) => {
alg.modulusLength = key.modulusLength() << 3;
alg.publicExponent = new Uint8Array(key.publicExponent());
return new CryptoKey(key, alg, keyType ? "private" : "public", extractable, keyUsages);
});

@@ -114,0 +118,0 @@ }

@@ -0,0 +0,0 @@ // Core

type NodeBufferSource = BufferSource | Buffer;
{
"name": "node-webcrypto-ossl",
"version": "1.0.20",
"version": "1.0.21",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict"

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -215,3 +215,28 @@ "use strict";

context("Algorithm parameters", () => {
})
it("modulusLength/publicExponent for imported key", (done) => {
webcrypto.subtle.generateKey({ name: "RSASSA-PKCS1-v1_5", hash: "SHA-1", publicExponent: new Uint8Array([1, 0, 1]), modulusLength: 2048 }, true, ["sign", "verify"])
.then((keyPair) => {
const key = keyPair.privateKey;
assert.equal(ArrayBuffer.isView(key.algorithm.publicExponent), true);
assert.equal(key.algorithm.publicExponent.length === 3, true);
assert.equal(key.algorithm.modulusLength === 2048, true);
assert.equal(key.type === "private", true);
return webcrypto.subtle.exportKey("pkcs8", key);
})
.then((raw) => {
return webcrypto.subtle.importKey("pkcs8", raw, { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, false, ["sign"]);
})
.then((key) => {
assert.equal(ArrayBuffer.isView(key.algorithm.publicExponent), true);
assert.equal(key.algorithm.publicExponent.length === 3, true);
assert.equal(key.algorithm.modulusLength === 2048, true);
assert.equal(key.type === "private", true);
})
.then(done, done);
});
});
});

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc