Closed shea256 closed 9 years ago
It'd be nice to be able to use the PEM format in addition to DER.
Conversion from PEM to DER should be quite simple, I even wrote a quick DER-to-PEM function:
var base64 = require('base64-js'), convertHex = require('convert-hex'); var derToPem = function(derPrivateKey) { var byteArrayPrivateKey = convertHex.hexToBytes(derPrivateKey); var base64PrivateKey = base64.fromByteArray(byteArrayPrivateKey); var pemBeginning = '-----BEGIN PRIVATE KEY-----'; var pemEnding = '-----END PRIVATE KEY-----'; var pemMiddle = base64PrivateKey.match(/.{1,64}/g).join('\n'); var pemPrivateKey = [pemBeginning, pemMiddle, pemEnding].join('\n'); return pemPrivateKey; };
Let me know what you think, thanks!
Fixed in 2ac0a3a, sorry for delay!
Awesome! No worries.
It'd be nice to be able to use the PEM format in addition to DER.
Conversion from PEM to DER should be quite simple, I even wrote a quick DER-to-PEM function:
Let me know what you think, thanks!