You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-24Lines changed: 28 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -49,16 +49,16 @@ var NodeRSA = require('node-rsa');
49
49
var key =newNodeRSA([keyData, [format]], [options]);
50
50
```
51
51
52
-
***keyData** — `{string|buffer|object}` — parameters for generating key or the key in one of supported formats.<br/>
53
-
***format** — `{string}` — format for importing key. See more details about formats in [Export/Import](#importexport-keys) section.<br/>
54
-
***options** — `{object}` — additional settings.
52
+
* keyData — `{string|buffer|object}` — parameters for generating key or the key in one of supported formats.<br/>
53
+
* format — `{string}` — format for importing key. See more details about formats in [Export/Import](#importexport-keys) section.<br/>
54
+
* options — `{object}` — additional settings.
55
55
56
56
#### Options
57
57
You can specify some options by second/third constructor argument, or over `key.setOptions()` method.
58
58
59
-
***environment** — working environment, `'browser'` or `'node'`. Default autodetect.
60
-
***encryptionScheme** — padding scheme for encrypt/decrypt. Can be `'pkcs1_oaep'` or `'pkcs1'`. Default `'pkcs1_oaep'`.
61
-
***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'`.
59
+
* environment — working environment, `'browser'` or `'node'`. Default autodetect.
60
+
* encryptionScheme — padding scheme for encrypt/decrypt. Can be `'pkcs1_oaep'` or `'pkcs1'`. Default `'pkcs1_oaep'`.
61
+
* 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'`.
62
62
63
63
**Advanced options:**<br/>
64
64
You also can specify advanced options for some schemes like this:
@@ -95,8 +95,8 @@ Also you can use next method:
95
95
key.generateKeyPair([bits], [exp]);
96
96
```
97
97
98
-
***bits** — `{int}` — key size in bits. 2048 by default.
99
-
***exp** — `{int}` — public exponent. 65537 by default.
98
+
* bits — `{int}` — key size in bits. 2048 by default.
99
+
* exp — `{int}` — public exponent. 65537 by default.
**buffer** - data for encrypting, may be string, Buffer, or any object/array. Arrays and objects will encoded to JSON string first.<br/>
188
-
**encoding** - encoding for output result, may be `'buffer'`, `'binary'`, `'hex'` or `'base64'`. Default `'buffer'`.<br/>
189
-
**source_encoding** - source encoding, works only with string buffer. Can take standard Node.js Buffer encodings (hex, utf8, base64, etc). `'utf8'` by default.<br/>
187
+
188
+
* buffer — `{buffer}` — data for encrypting, may be string, Buffer, or any object/array. Arrays and objects will encoded to JSON string first.<br/>
189
+
* encoding — `{string}` — encoding for output result, may be `'buffer'`, `'binary'`, `'hex'` or `'base64'`. Default `'buffer'`.<br/>
190
+
* source_encoding — `{string}` — source encoding, works only with string buffer. Can take standard Node.js Buffer encodings (hex, utf8, base64, etc). `'utf8'` by default.<br/>
190
191
191
192
```javascript
192
193
key.decrypt(buffer, [encoding]);
193
194
```
194
195
Return decrypted data.<br/>
195
-
**buffer** - data for decrypting. Takes Buffer object or base64 encoded string.<br/>
196
-
**encoding** - encoding for result string. Can also take `'buffer'` for raw Buffer object, or `'json'` for automatic JSON.parse result. Default `'buffer'`.
196
+
197
+
* buffer — `{buffer}` — data for decrypting. Takes Buffer object or base64 encoded string.<br/>
198
+
* encoding — `{string}` — encoding for result string. Can also take `'buffer'` for raw Buffer object, or `'json'` for automatic JSON.parse result. Default `'buffer'`.
197
199
198
200
### Signing/Verifying
199
201
```javascript
@@ -205,10 +207,11 @@ Return signature for buffer. All the arguments are the same as for `encrypt` met
**buffer** - data for check, same as `encrypt` method.<br/>
209
-
**signature** - signature for check, result of `sign` method.<br/>
210
-
**source_encoding** - same as for `encrypt` method.<br/>
211
-
**signature_encoding** - encoding of given signature. May be `'buffer'`, `'binary'`, `'hex'` or `'base64'`. Default `'buffer'`.
210
+
211
+
* buffer — `{buffer}` — data for check, same as `encrypt` method.<br/>
212
+
* signature — `{string}` — signature for check, result of `sign` method.<br/>
213
+
* source_encoding — `{string}` — same as for `encrypt` method.<br/>
214
+
* signature_encoding — `{string}` — encoding of given signature. May be `'buffer'`, `'binary'`, `'hex'` or `'base64'`. Default `'buffer'`.
212
215
213
216
## Contributing
214
217
@@ -217,7 +220,8 @@ Questions, comments, bug reports, and pull requests are all welcome.
217
220
## Changelog
218
221
219
222
### 0.2.10
220
-
***Methods `.exportPrivate()` and `.exportPublic()` was replaced by `.exportKey([format])`. By default `.exportKey()` returns private key as `.exportPrivate()`, if you need public key from `.exportPublic()` you must specify format as `'public'` or `'pkcs8-public-pem'`.**
223
+
***Methods `.exportPrivate()` and `.exportPublic()` was replaced by `.exportKey([format])`.**
224
+
* By default `.exportKey()` returns private key as `.exportPrivate()`, if you need public key from `.exportPublic()` you must specify format as `'public'` or `'pkcs8-public-pem'`.
221
225
* Method `.importKey(key, [format])` now has second argument.
0 commit comments