peer-certificate-to-rsa-pubkey

1.0.0 • Public • Published

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

/peer-certificate-to-rsa-pubkey/

    Package Sidebar

    Install

    npm i peer-certificate-to-rsa-pubkey

    Weekly Downloads

    7

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • nicolindemann