Skip to content

Commit 39ce9f6

Browse files
author
s.vychegzhanin
committed
version bump
1 parent 618fba9 commit 39ce9f6

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-rsa",
3-
"version": "0.3.3",
3+
"version": "0.3.4",
44
"description": "Node.js RSA library",
55
"main": "src/NodeRSA.js",
66
"scripts": {

src/schemes/pss.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports.makeScheme = function (key, options) {
1818

1919
/**
2020
* @param key
21+
* @param options
2122
* options [Object] An object that contains the following keys that specify certain options for encoding.
2223
* └>signingSchemeOptions
2324
* ├>hash [String] Hash function to use when encoding and generating masks. Must be a string accepted by node's crypto.createHash function. (default = "sha1")
@@ -35,8 +36,7 @@ module.exports.makeScheme = function (key, options) {
3536
mHash.update(buffer);
3637

3738
var encoded = this.emsa_pss_encode(mHash.digest(), this.key.keySize - 1);
38-
var res = this.key.$doPrivate(new BigInteger(encoded)).toBuffer(this.key.encryptedDataLength);
39-
return res;
39+
return this.key.$doPrivate(new BigInteger(encoded)).toBuffer(this.key.encryptedDataLength);
4040
};
4141

4242
Scheme.prototype.verify = function (buffer, signature, signature_encoding) {
@@ -57,7 +57,7 @@ module.exports.makeScheme = function (key, options) {
5757
/*
5858
* https://tools.ietf.org/html/rfc3447#section-9.1.1
5959
*
60-
* mHash [Buffer] Hashed message to encode
60+
* mHash [Buffer] Hashed message to encode
6161
* emBits [uint] Maximum length of output in bits. Must be at least 8hLen + 8sLen + 9 (hLen = Hash digest length in bytes | sLen = length of salt in bytes)
6262
* @returns {Buffer} The encoded message
6363
*/
@@ -118,7 +118,7 @@ module.exports.makeScheme = function (key, options) {
118118
/*
119119
* https://tools.ietf.org/html/rfc3447#section-9.1.2
120120
*
121-
* mHash [Buffer] Hashed message
121+
* mHash [Buffer] Hashed message
122122
* EM [Buffer] Signature
123123
* emBits [uint] Length of EM in bits. Must be at least 8hLen + 8sLen + 9 to be a valid signature. (hLen = Hash digest length in bytes | sLen = length of salt in bytes)
124124
* @returns {Boolean} True if signature(EM) matches message(M)
@@ -155,15 +155,8 @@ module.exports.makeScheme = function (key, options) {
155155
DB[i] ^= dbMask[i];
156156
}
157157

158-
/* mask = 0;
159-
var bits = emBits - 8 * (emLen - 1);
160-
for (i = 0; i < bits; i++) {
161-
mask |= 1 << i;
162-
}
163-
DB[0] &= mask;*/
164-
165-
var bits = 8 * emLen - emBits;
166-
var mask = 255 ^ (255 >> 8 - bits << 8 - bits);
158+
bits = 8 * emLen - emBits;
159+
mask = 255 ^ (255 >> 8 - bits << 8 - bits);
167160
DB[0] = DB[0] & mask;
168161

169162
// Filter out padding

0 commit comments

Comments
 (0)