From e8837a07218974eb81fc7c15b92e70997efd21d0 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 24 Nov 2018 19:47:56 -0700 Subject: [PATCH] output der as binstr, add comment --- README.md | 2 +- bin/rasha.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dba6aac..cef1c3a 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Rasha.generate({ format: 'jwk' }).then(function (keypair) { * `format` defaults to `'jwk'` * `'pkcs1'` (traditional) - * `'pkcs8'` + * `'pkcs8'` * `modulusLength` defaults to 2048 (must not be lower) * generally you shouldn't pick a larger key size - they're slow * **2048** is more than sufficient diff --git a/bin/rasha.js b/bin/rasha.js index 9cabedc..b71f425 100755 --- a/bin/rasha.js +++ b/bin/rasha.js @@ -20,6 +20,10 @@ if (-1 !== [ 'jwk', 'pem', 'json', 'der', 'pkcs1', 'pkcs8', 'spki' ].indexOf(inf , modulusLength: parseInt(format, 10) || 2048 , encoding: parseInt(format, 10) ? null : format }).then(function (key) { + if ('der' === infile || 'der' === format) { + key.private = key.private.toString('binary'); + key.public = key.public.toString('binary'); + } console.log(key.private); console.log(key.public); }).catch(function (err) {