Browse Source

output der as binstr, add comment

AJ ONeal 1 month ago
parent
commit
e8837a0721
2 changed files with 5 additions and 1 deletions
  1. 1
    1
      README.md
  2. 4
    0
      bin/rasha.js

+ 1
- 1
README.md View File

@@ -32,7 +32,7 @@ Rasha.generate({ format: 'jwk' }).then(function (keypair) {
32 32
 
33 33
 * `format` defaults to `'jwk'`
34 34
   * `'pkcs1'` (traditional)
35
-  * `'pkcs8'`
35
+  * `'pkcs8'` <!-- * `'ssh'` -->
36 36
 * `modulusLength` defaults to 2048 (must not be lower)
37 37
   * generally you shouldn't pick a larger key size - they're slow
38 38
   * **2048** is more than sufficient

+ 4
- 0
bin/rasha.js View File

@@ -20,6 +20,10 @@ if (-1 !== [ 'jwk', 'pem', 'json', 'der', 'pkcs1', 'pkcs8', 'spki' ].indexOf(inf
20 20
   , modulusLength: parseInt(format, 10) || 2048
21 21
   , encoding: parseInt(format, 10) ? null : format
22 22
   }).then(function (key) {
23
+    if ('der' === infile || 'der' === format) {
24
+      key.private = key.private.toString('binary');
25
+      key.public = key.public.toString('binary');
26
+    }
23 27
     console.log(key.private);
24 28
     console.log(key.public);
25 29
   }).catch(function (err) {