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
+13-15Lines changed: 13 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ var key = new NodeRSA([keyData], [format], [options]);
50
50
```
51
51
52
52
**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/>
54
54
**options** — `{object}` — additional settings
55
55
56
56
#### Options
@@ -121,23 +121,21 @@ key.exportKey([format]);
121
121
122
122
#### Format string syntax
123
123
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.
124
131
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.
135
133
136
134
**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.
141
139
*`'pkcs8-public-der'` — public key encoded in pcks8 scheme as binary buffer.
0 commit comments