webcrypto-core
Advanced tools
Comparing version 0.1.13 to 0.1.14
@@ -921,9 +921,5 @@ import { __extends } from 'tslib'; | ||
Rsa.checkKeyGenParams = function (alg) { | ||
switch (alg.modulusLength) { | ||
case 1024: | ||
case 2048: | ||
case 4096: | ||
break; | ||
default: | ||
throw new RsaKeyGenParamsError(RsaKeyGenParamsError.PARAM_WRONG_VALUE, "modulusLength", "1024, 2048 or 4096"); | ||
var modulusBits = alg.modulusLength; | ||
if (!(modulusBits >= 256 && modulusBits <= 16384 && !(modulusBits % 8))) { | ||
throw new RsaKeyGenParamsError(RsaKeyGenParamsError.PARAM_WRONG_VALUE, "modulusLength", " a multiple of 8 bits and >= 256 and <= 16384"); | ||
} | ||
@@ -930,0 +926,0 @@ var pubExp = alg.publicExponent; |
@@ -924,9 +924,5 @@ 'use strict'; | ||
Rsa.checkKeyGenParams = function (alg) { | ||
switch (alg.modulusLength) { | ||
case 1024: | ||
case 2048: | ||
case 4096: | ||
break; | ||
default: | ||
throw new RsaKeyGenParamsError(RsaKeyGenParamsError.PARAM_WRONG_VALUE, "modulusLength", "1024, 2048 or 4096"); | ||
var modulusBits = alg.modulusLength; | ||
if (!(modulusBits >= 256 && modulusBits <= 16384 && !(modulusBits % 8))) { | ||
throw new RsaKeyGenParamsError(RsaKeyGenParamsError.PARAM_WRONG_VALUE, "modulusLength", " a multiple of 8 bits and >= 256 and <= 16384"); | ||
} | ||
@@ -933,0 +929,0 @@ var pubExp = alg.publicExponent; |
{ | ||
"name": "webcrypto-core", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"description": "Common layer to be used by crypto libraries based on WebCrypto API for input validation.", | ||
@@ -5,0 +5,0 @@ "main": "dist/webcrypto-core.js", |
@@ -64,10 +64,28 @@ var helper = require("./helper"); | ||
}); | ||
it("RSA generate RSASSA wrong modulusLength", function (done) { | ||
generate({ | ||
name: "rsassa-pkcs1-v1_5", | ||
modulusLength: 10, | ||
publicExponent: new Uint8Array([1, 0, 1]), | ||
hash: { name: "sha-256" } | ||
}, ["verify", "verify"], done, true); | ||
}); | ||
context("RSA generate RSASSA wrong modulusLength", function () { | ||
it("not multiple 8", function (done) { | ||
generate({ | ||
name: "rsassa-pkcs1-v1_5", | ||
modulusLength: 257, | ||
publicExponent: new Uint8Array([1, 0, 1]), | ||
hash: { name: "sha-256" } | ||
}, ["verify", "verify"], done, true); | ||
}); | ||
it("less than 256", function (done) { | ||
generate({ | ||
name: "rsassa-pkcs1-v1_5", | ||
modulusLength: 128, | ||
publicExponent: new Uint8Array([1, 0, 1]), | ||
hash: { name: "sha-256" } | ||
}, ["verify", "verify"], done, true); | ||
}); | ||
it("more than 16384", function (done) { | ||
generate({ | ||
name: "rsassa-pkcs1-v1_5", | ||
modulusLength: 16392, | ||
publicExponent: new Uint8Array([1, 0, 1]), | ||
hash: { name: "sha-256" } | ||
}, ["verify", "verify"], done, true); | ||
}); | ||
}) | ||
it("RSA generate RSASSA empty publicExponent", function (done) { | ||
@@ -74,0 +92,0 @@ generate({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
330028
5100