Skip to content

Commit 4231f93

Browse files
committed
readme
1 parent 93d1dde commit 4231f93

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var key = new NodeRSA([keyData], [format], [options]);
5050
```
5151

5252
**keyData**`{string|buffer|object}` — parameters of a generated 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** section<br/>
53+
**format**`{string}` — format for importing key. See more details about formats in [Export/Import](#importexport-keys) section<br/>
5454
**options**`{object}` — additional settings
5555

5656
#### Options
@@ -121,23 +121,21 @@ key.exportKey([format]);
121121

122122
#### Format string syntax
123123
Format string composed of several parts: `scheme-[key_type]-[output_type]`
124+
**Scheme** — NodeRSA supports multiple format schemes for import/export keys:
125+
* `'pkcs1'` — public key starts from `'-----BEGIN RSA PUBLIC KEY-----'` header and private key starts from `'-----BEGIN RSA PRIVATE KEY-----' header`
126+
* `'pkcs8'` — public key starts from `'-----BEGIN PUBLIC KEY-----'` header and private key starts from `'-----BEGIN PRIVATE KEY-----' header`
127+
**Key type** — can be `'private'` or `'public'`. Default `'private'`
128+
**Output type** — can be:
129+
* `'pem'` — Base64 encoded string with header and footer. Used by default.
130+
* `'der'` — Binary encoded key data.
124131

125-
* **Scheme** — NodeRSA supports multiple format schemes for import/export keys:
126-
* `'pkcs1'` — public key starts from `'-----BEGIN RSA PUBLIC KEY-----'` header and private key starts from `'-----BEGIN RSA PRIVATE KEY-----' header`
127-
* `'pkcs8'` — public key starts from `'-----BEGIN PUBLIC KEY-----'` header and private key starts from `'-----BEGIN PRIVATE KEY-----' header`
128-
* **Key type** — can be `'private'` or `'public'`. Default `'private'`
129-
* **Output type** — can be:
130-
* `'pem'` — Base64 encoded string with header and footer. Used by default.
131-
* `'der'` — Binary encoded key data.
132-
133-
Notice: If you provide **keyData** as DER you must specify it in format string.
134-
132+
**Notice:** For import, if *keyData* is pem string or buffer containing string, you can do not specify format, but if you provide *keyData* as DER you must specify it in format string.
135133

136134
**Shortcuts and examples**
137-
* `'private'` or `'pkcs1'` or `'pkcs1-private'` `'pkcs1-private-pem'` — private key encoded in pcks1 scheme as pem string.
138-
* `'public'` or `'pkcs8-public'` `'pkcs8-public-pem'` — public key encoded in pcks8 scheme as pem string.
139-
* `'pkcs8'` or `'pkcs8-private'` `'pkcs8-private-pem'` — private key encoded in pcks8 scheme as pem string.
140-
* `'pkcs1-der'` `'pkcs1-private-der'` — private key encoded in pcks1 scheme as binary buffer.
135+
* `'private'` or `'pkcs1'` or `'pkcs1-private'` == `'pkcs1-private-pem'` — private key encoded in pcks1 scheme as pem string.
136+
* `'public'` or `'pkcs8-public'` == `'pkcs8-public-pem'` — public key encoded in pcks8 scheme as pem string.
137+
* `'pkcs8'` or `'pkcs8-private'` == `'pkcs8-private-pem'` — private key encoded in pcks8 scheme as pem string.
138+
* `'pkcs1-der'` == `'pkcs1-private-der'` — private key encoded in pcks1 scheme as binary buffer.
141139
* `'pkcs8-public-der'` — public key encoded in pcks8 scheme as binary buffer.
142140

143141
**Code example**

0 commit comments

Comments
 (0)