Skip to content

Commit 150d7eb

Browse files
committed
Revert to 2efa5c1
1 parent 6cb15fc commit 150d7eb

File tree

13 files changed

+386
-1124
lines changed

13 files changed

+386
-1124
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
.DS_Store
22
.idea
3-
.tmp
43
node_modules/

README.md

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Based on jsbn library from Tom Wu http://www-cs-students.stanford.edu/~tjw/jsbn/
88
* Generating keys
99
* Supports long messages for encrypt/decrypt
1010
* Signing and verifying
11-
11+
1212

1313
## Example
1414

@@ -48,48 +48,22 @@ var NodeRSA = require('node-rsa');
4848

4949
var key = new NodeRSA([key], [options]);
5050
```
51-
5251
**key** - parameters of a generated key or the key in PEM format.<br/>
5352
**options** - additional settings
53+
* **environment** - working environment, `'browser'` or `'node'`. Default autodetect.
54+
* **signingAlgorithm** - hash algorithm used for signing and verifying. Can be `'sha1'`, `'sha256'`, `'md5'`. Default `'sha256'`.
5455

55-
#### Options
56-
You can specify some options by second constructor argument, or over `key.setOptions()` method.
57-
58-
* **environment** - working environment, `'browser'` or `'node'`. Default autodetect.
59-
* **encryptionScheme** - padding scheme for encrypt/decrypt. Can be `'pkcs1_oaep'` or `'pkcs1'`. Default `'pkcs1_oaep'`.
60-
* **signingScheme** - scheme used for signing and verifying. Can be `'pkcs1'` or `'pss'` or 'scheme-hash' format string (eg `'pss-sha1'`). Default `'pkcs1-sha256'`, or, if chosen pss: `'pss-sha1'`.
61-
62-
**Advanced options:**<br/>
63-
You also can specify advanced options for some schemes like this:
64-
```
65-
options = {
66-
encryptionScheme: {
67-
scheme: 'pkcs1_oaep', //scheme
68-
hash: 'md5', //hash using for scheme
69-
mgf: function(...) {...} //mask generation function
70-
},
71-
signingScheme: {
72-
scheme: 'pss', //scheme
73-
hash: 'sha1', //hash using for scheme
74-
saltLength: 20 //salt length for pss sign
75-
}
76-
}
77-
```
78-
79-
This lib supporting next hash algorithms: `'md5'`, `'ripemd160'`, `'sha1'`, `'sha256'`, `'sha512'` in browser and node environment and additional `'md4'`, `'sha'`, `'sha224'`, `'sha384'` in node only.
80-
81-
82-
#### Creating "empty" key
56+
#### "Empty" key
8357
```javascript
8458
var key = new NodeRSA();
8559
```
8660

87-
#### Generate new key 512bit-length and with public exponent 65537
61+
### Generate new key 512bit-length and with public exponent 65537
8862
```javascript
8963
var key = new NodeRSA({b: 512});
9064
```
9165

92-
#### Load key from PEM string
66+
### Load key from PEM string
9367

9468
```javascript
9569
var key = new NodeRSA('-----BEGIN RSA PRIVATE KEY-----\n'+
@@ -107,15 +81,15 @@ Also you can use next methods:
10781

10882
```javascript
10983
key.generateKeyPair([bits], [exp]);
110-
key.importKey(pem_string|buffer_contains_pem);
84+
key.loadFromPEM(pem_string|buffer_contains_pem);
11185
```
11286
**bits** - key size in bits. 2048 by default.
11387
**exp** - public exponent. 65537 by default.
11488

11589
### Export keys
11690
```javascript
117-
key.exportPrivate();
118-
key.exportPublic();
91+
key.getPrivatePEM();
92+
key.getPublicPEM();
11993
```
12094

12195
### Properties
@@ -181,20 +155,6 @@ Questions, comments, bug reports, and pull requests are all welcome.
181155

182156
## Changelog
183157

184-
### 0.2.0
185-
* **`.getPublicPEM()` method was renamed to `.exportPublic()`**
186-
* **`.getPrivatePEM()` method was renamed to `.exportPrivate()`**
187-
* **`.loadFromPEM()` method was renamed to `.importKey()`**
188-
* Added PKCS1_OAEP encrypting/decrypting support
189-
* **PKCS1_OAEP now default scheme, you need to specify 'encryptingScheme' option to 'pkcs1' for compatibility with 0.1.x version of NodeRSA**
190-
* Added PSS signing/verifying support
191-
* Signing now supports `'md5'`, `'ripemd160'`, `'sha1'`, `'sha256'`, `'sha512'` hash algorithms in both environments
192-
and additional `'md4'`, `'sha'`, `'sha224'`, `'sha384'` for nodejs env.
193-
* **`options.signingAlgorithm` was renamed to `options.signingScheme`**
194-
* Added `encryptingScheme` option
195-
* Property `key.options` now mark as private. Added `key.setOptions(options)` method.
196-
197-
198158
### 0.1.54
199159
* Added support for loading PEM key from Buffer (`fs.readFileSync()` output)
200160
* Added `isEmpty()` method

gruntfile.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
module.exports = function (grunt) {
1+
module.exports = function(grunt) {
22
grunt.initConfig({
33
jshint: {
4-
options: {},
4+
options: {
5+
},
56
default: {
67
files: {
7-
src: ['gruntfile.js', 'src/**/*.js', '!src/libs/jsbn.js']
8+
src: ['src/**/*.js', '!src/libs/**/*']
89
}
910
},
1011
libs: {
@@ -18,16 +19,17 @@ module.exports = function (grunt) {
1819
options: {
1920
reporter: 'List'
2021
},
21-
all: {src: ['test/**/*.js']}
22+
all: { src: ['test/**/*.js'] }
2223
}
2324
});
2425

2526
require('jit-grunt')(grunt, {
2627
'simplemocha': 'grunt-simple-mocha'
2728
});
2829

30+
2931
grunt.registerTask('lint', ['jshint:default']);
3032
grunt.registerTask('test', ['simplemocha']);
3133

3234
grunt.registerTask('default', ['lint', 'test']);
33-
};
35+
}

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-rsa",
3-
"version": "0.2.0",
3+
"version": "0.1.54",
44
"description": "Node.js RSA library",
55
"main": "src/NodeRSA.js",
66
"scripts": {
@@ -18,10 +18,7 @@
1818
"encryption",
1919
"decryption",
2020
"sign",
21-
"verify",
22-
"pkcs1",
23-
"oaep",
24-
"pss"
21+
"verify"
2522
],
2623
"author": "rzcoder",
2724
"license": "BSD",

0 commit comments

Comments
 (0)