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
* keyData — `{string|buffer}` — key in PEM string **or** Buffer containing PEM string **or** Buffer containing DER encoded data.
107
+
* keyData — `{string|buffer}` — may be:
108
+
* key in PEM string
109
+
* Buffer containing PEM string
110
+
* Buffer containing DER encoded data
111
+
* Object contains key components
108
112
* format — `{string}` — format id for export/import.
109
113
110
114
#### Format string syntax
@@ -114,6 +118,7 @@ Scheme — NodeRSA supports multiple format schemes for import/export keys:
114
118
115
119
*`'pkcs1'` — public key starts from `'-----BEGIN RSA PUBLIC KEY-----'` header and private key starts from `'-----BEGIN RSA PRIVATE KEY-----'` header
116
120
*`'pkcs8'` — public key starts from `'-----BEGIN PUBLIC KEY-----'` header and private key starts from `'-----BEGIN PRIVATE KEY-----'` header
121
+
*`'components'` — use it for import/export key from/to raw components (see example below). For private key, importing data should contain all private key components, for public key: only public exponent (`e`) and modulus (`n`). All components (except `e`) should be Buffer, `e` could be Buffer or just normal Number.
117
122
118
123
Key type — can be `'private'` or `'public'`. Default `'private'`<br/>
119
124
Output type — can be:
@@ -139,6 +144,22 @@ var publicDer = key.exportKey('pkcs8-public-der');
0 commit comments