Whole suite of RSA Cryptographic functions provided by the node-rsa npm package: encryption,decryption,signing, verifying, key information/generation/validation/formatting. Advanced operations options supported, including mask generation function and signing salt length.
Cryptographic operations are run on the context of the provided key on the plugin configuration by default, unless you provide action-specific parameters.
All operations are run on server side actions.
Supported hash algorithms: 'md5', 'ripemd160', 'sha1', 'sha256', 'sha512', 'md4', 'sha', 'sha224', 'sha384'.
Supported encryption/decryption schemes: pkcs1_oaep, pkcs1
Supported signing/verifying schemes: pkcs1, pss.
-------------------------------------------------------------
IMPORTANT NOTICE WHEN USING PSS SCHEME
-------------------------------------------------------------
Please observe the default salt length in node-rsa for PSS scheme is ALWAYS 20.
The salt length must match between sender and receiver in signatures and verifications, and most implementations use either maximum salt length or digest. Therefore, when sending a signature to some other party, the signature should be generated with the salt length expected by the receiving party. Use the advanced options in the key options (see action documentation) to set the saltLength.
This is the table for maximum salt length for common key sizes and hashes:
Key Size (bits) Key Size (bytes) SHA-1 SHA-224 SHA-256 SHA-384 SHA-512
1024 128 106 98 94 78 62
2048 256 234 226 222 206 190
3072 384 362 354 350 334 318
4096 512 490 482 478 462 446
This is the table for salt length when using hash digest length:
Hash Algorithm Digest Length (bytes)
SHA-1 20
SHA-224 28
SHA-256 32
SHA-384 48
SHA-512 64
The formula to calculate salt length is
saltLength = (keySize / 8) - hashLength - 2
https://github.com/rzcoder/node-rsahttps://www.npmjs.com/package/node-rsaLicense
Copyright (c) 2014 rzcoder
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Licensing for code used in rsa.js and jsbn.js
Copyright (c) 2003-2005 Tom Wu
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
In addition, the following condition applies:
All redistributions must retain an intact copy of this copyright notice and disclaimer.