napi-crypto
This was developed against openssl library of nodejs using n-api, currently only works on Windows
Install
$ npm install napi-crypto
Usage
NapiCrypto.createKeyPair()
Example
const NapiCrypto = ; NapiCrypto;// returns object with members privateKey and publicKey, there value is a string
NapiCrypto.createKeyPairAsync()
Example
const NapiCrypto = ; NapiCrypto; // returns a promise resolving with either an error or object with members privateKey and publicKey, each value is a string
NapiCrypto.createCSR(options)
certificate - buffer of certificate privateKey - buffer of privateKey
Example
const NapiCrypto = ; const certificate = ;const privateKey = ;NapiCrypto;// returns buffer on renewed CSR
NapiCrypto.getFingerprint(cert, digest)
Cert - buffer of certificate Digest - one of md5, sha1, sha256 or sha512 - defaults to sha1
Example
const NapiCrypto = ; const cert = ;NapiCrypto;// returns fingerprint of cert
Todo
- improve tests
- cross-platform builds
- ci with appveyor and travis
- pre-built binaries
- publish to npm
- improve error handling
- add async method if possible
- generate RSA, DSA and EC key pairs
- add self-sign cert method
- improve createCSR to allow generating new one and not just renwing an existing one