peer-certificate-to-rsa-pubkey
v1.0.0
Published
Creates RSA Public Key DER Buffer of TLSSocket.getPeerCertificate Result
Downloads
69
Readme
peer-certificate-to-rsa-pubkey
Creates RSA Public Key DER Buffer of TLSSocket.getPeerCertificate Result.
Based on this stackoverflow question and answer.
Install
npm install peer-certificate-to-rsa-pubkey
Usage
var rsaPubKey = require('peer-certificate-to-rsa-pubkey')
const exampleRequestHandler = (req, res) => {
const rsaPubKeyBuffer = /* Buffer */ rsaPubKey(res.connection.getPeerCertificate())
// rsaPubKeyBuffer is a DER represantion of the public key
}
If TLSSocket.getPeerCertificate does not return RSA encrypted public key information an error will be thrown.
Testing and Code Coverage
npm test