node-forge
Advanced tools
Comparing version 0.8.1 to 0.8.2
Forge ChangeLog | ||
=============== | ||
## 0.8.2 - 2019-03-18 | ||
### Fixed | ||
- Fix tag calculation when continuing an AES-GCM block. | ||
### Changed | ||
- Switch to eslint. | ||
## 0.8.1 - 2019-02-23 | ||
@@ -5,0 +13,0 @@ |
@@ -19,3 +19,3 @@ /** | ||
tls.CipherSuites['TLS_RSA_WITH_AES_128_CBC_SHA'] = { | ||
id: [0x00,0x2f], | ||
id: [0x00, 0x2f], | ||
name: 'TLS_RSA_WITH_AES_128_CBC_SHA', | ||
@@ -36,3 +36,3 @@ initSecurityParameters: function(sp) { | ||
tls.CipherSuites['TLS_RSA_WITH_AES_256_CBC_SHA'] = { | ||
id: [0x00,0x35], | ||
id: [0x00, 0x35], | ||
name: 'TLS_RSA_WITH_AES_256_CBC_SHA', | ||
@@ -204,6 +204,4 @@ initSecurityParameters: function(sp) { | ||
*/ | ||
var count = 0; | ||
function decrypt_aes_cbc_sha1(record, s) { | ||
var rval = false; | ||
++count; | ||
@@ -210,0 +208,0 @@ var iv; |
@@ -655,3 +655,3 @@ /** | ||
if(partialBytes === 0 || finish) { | ||
if(partialBytes <= 0 || finish) { | ||
// handle overflow prior to hashing | ||
@@ -658,0 +658,0 @@ if(finish) { |
@@ -10,3 +10,4 @@ /** | ||
* | ||
* Optimised for performance with large blocks by Michael Hayworth, November 2001 | ||
* Optimised for performance with large blocks by | ||
* Michael Hayworth, November 2001 | ||
* http://www.netdealing.com | ||
@@ -13,0 +14,0 @@ * |
@@ -122,3 +122,3 @@ /** | ||
var PS_length = maxLength - message.length; | ||
for (var i = 0; i < PS_length; i++) { | ||
for(var i = 0; i < PS_length; i++) { | ||
PS += '\x00'; | ||
@@ -125,0 +125,0 @@ } |
@@ -92,3 +92,2 @@ /** | ||
// for finding primes, which are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29 | ||
@@ -692,3 +691,3 @@ var GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2]; | ||
var deltaIdx = 0; | ||
var op_or = function(x, y) { return x|y; }; | ||
var op_or = function(x, y) {return x | y;}; | ||
@@ -742,3 +741,3 @@ // keep stepping until time limit is reached or done | ||
(state.num.subtract(BigInteger.ONE).gcd(state.e) | ||
.compareTo(BigInteger.ONE) === 0) ? 3 : 0; | ||
.compareTo(BigInteger.ONE) === 0) ? 3 : 0; | ||
} else if(state.pqState === 3) { | ||
@@ -913,3 +912,3 @@ // store p or q | ||
}, function(err, pub, priv) { | ||
if (err) { | ||
if(err) { | ||
return callback(err); | ||
@@ -923,3 +922,4 @@ } | ||
} | ||
if(_detectSubtleCrypto('generateKey') && _detectSubtleCrypto('exportKey')) { | ||
if(_detectSubtleCrypto('generateKey') && | ||
_detectSubtleCrypto('exportKey')) { | ||
// use standard native generateKey | ||
@@ -1062,3 +1062,3 @@ return util.globalScope.crypto.subtle.generateKey({ | ||
} else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) { | ||
scheme = { encode: function(e) { return e; } }; | ||
scheme = {encode: function(e) {return e;}}; | ||
} else if(typeof scheme === 'string') { | ||
@@ -1104,33 +1104,33 @@ throw new Error('Unsupported encryption scheme: "' + scheme + '".'); | ||
*/ | ||
key.verify = function(digest, signature, scheme) { | ||
if(typeof scheme === 'string') { | ||
scheme = scheme.toUpperCase(); | ||
} else if(scheme === undefined) { | ||
scheme = 'RSASSA-PKCS1-V1_5'; | ||
} | ||
key.verify = function(digest, signature, scheme) { | ||
if(typeof scheme === 'string') { | ||
scheme = scheme.toUpperCase(); | ||
} else if(scheme === undefined) { | ||
scheme = 'RSASSA-PKCS1-V1_5'; | ||
} | ||
if(scheme === 'RSASSA-PKCS1-V1_5') { | ||
scheme = { | ||
verify: function(digest, d) { | ||
// remove padding | ||
d = _decodePkcs1_v1_5(d, key, true); | ||
// d is ASN.1 BER-encoded DigestInfo | ||
var obj = asn1.fromDer(d); | ||
// compare the given digest to the decrypted one | ||
return digest === obj.value[1].value; | ||
} | ||
}; | ||
} else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) { | ||
scheme = { | ||
verify: function(digest, d) { | ||
// remove padding | ||
d = _decodePkcs1_v1_5(d, key, true); | ||
return digest === d; | ||
} | ||
}; | ||
} | ||
if(scheme === 'RSASSA-PKCS1-V1_5') { | ||
scheme = { | ||
verify: function(digest, d) { | ||
// remove padding | ||
d = _decodePkcs1_v1_5(d, key, true); | ||
// d is ASN.1 BER-encoded DigestInfo | ||
var obj = asn1.fromDer(d); | ||
// compare the given digest to the decrypted one | ||
return digest === obj.value[1].value; | ||
} | ||
}; | ||
} else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) { | ||
scheme = { | ||
verify: function(digest, d) { | ||
// remove padding | ||
d = _decodePkcs1_v1_5(d, key, true); | ||
return digest === d; | ||
} | ||
}; | ||
} | ||
// do rsa decryption w/o any decoding, then verify -- which does decoding | ||
var d = pki.rsa.decrypt(signature, key, true, false); | ||
return scheme.verify(digest, d, key.n.bitLength()); | ||
// do rsa decryption w/o any decoding, then verify -- which does decoding | ||
var d = pki.rsa.decrypt(signature, key, true, false); | ||
return scheme.verify(digest, d, key.n.bitLength()); | ||
}; | ||
@@ -1193,3 +1193,3 @@ | ||
if(scheme === 'RSAES-PKCS1-V1_5') { | ||
scheme = { decode: _decodePkcs1_v1_5 }; | ||
scheme = {decode: _decodePkcs1_v1_5}; | ||
} else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') { | ||
@@ -1202,3 +1202,3 @@ scheme = { | ||
} else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) { | ||
scheme = { decode: function(d) { return d; } }; | ||
scheme = {decode: function(d) {return d;}}; | ||
} else { | ||
@@ -1245,6 +1245,6 @@ throw new Error('Unsupported encryption scheme: "' + scheme + '".'); | ||
if(scheme === undefined || scheme === 'RSASSA-PKCS1-V1_5') { | ||
scheme = { encode: emsaPkcs1v15encode }; | ||
scheme = {encode: emsaPkcs1v15encode}; | ||
bt = 0x01; | ||
} else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) { | ||
scheme = { encode: function() { return md; } }; | ||
scheme = {encode: function() {return md;}}; | ||
bt = 0x01; | ||
@@ -1284,3 +1284,3 @@ } | ||
asn1.toDer(rsaKey).getBytes()) | ||
]); | ||
]); | ||
}; | ||
@@ -1287,0 +1287,0 @@ |
@@ -116,8 +116,8 @@ /** | ||
/** | ||
* Produces the digest. | ||
* | ||
* @return a byte buffer containing the digest value. | ||
*/ | ||
md.digest = function() { | ||
/** | ||
* Produces the digest. | ||
* | ||
* @return a byte buffer containing the digest value. | ||
*/ | ||
md.digest = function() { | ||
/* Note: Here we copy the remaining bytes in the input buffer and | ||
@@ -124,0 +124,0 @@ add the appropriate SHA-1 padding. Then we do the final update |
@@ -84,3 +84,3 @@ /** | ||
var digestLength = 64; | ||
switch (algorithm) { | ||
switch(algorithm) { | ||
case 'SHA-384': | ||
@@ -87,0 +87,0 @@ digestLength = 48; |
{ | ||
"name": "node-forge", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.", | ||
@@ -21,5 +21,5 @@ "homepage": "https://github.com/digitalbazaar/forge", | ||
"cross-env": "^5.1.3", | ||
"eslint": "^5.14.1", | ||
"eslint-config-digitalbazaar": "^1.7.0", | ||
"express": "^4.16.2", | ||
"jscs": "^3.0.7", | ||
"jshint": "^2.9.5", | ||
"karma": "^3.1.4", | ||
@@ -41,3 +41,3 @@ "karma-browserify": "^6.0.0", | ||
"nodejs-websocket": "^1.7.1", | ||
"nyc": "^13.1.0", | ||
"nyc": "^13.3.0", | ||
"opts": "^1.2.2", | ||
@@ -107,6 +107,3 @@ "webpack": "^3.11.0", | ||
"coverage-report": "nyc report", | ||
"jscs": "jscs *.js lib/*.js tests/*.js tests/unit/*.js tests/legacy/*.js tests/issues/*.js tests/websockets/*.js", | ||
"jshint": "jshint *.js lib/*.js tests/unit/*.js tests/legacy/*.js tests/issues/*.js tests/websockets/*.js", | ||
"_jscs": "jscs *.js lib/*.js tests/*.js tests/unit/*.js tests/legacy/*.js tests/issues/*.js tests/websockets/*.js", | ||
"_jshint": "jshint *.js lib/*.js tests/*.js tests/unit/*.js tests/legacy/*.js tests/issues/*.js tests/websockets/*.js" | ||
"lint": "eslint *.js lib/*.js tests/*.js tests/**/*.js examples/*.js flash/*.js" | ||
}, | ||
@@ -113,0 +110,0 @@ "nyc": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1683275
63
31571