PKCS #15 Smartcard Sign
This module allows you to sign anything with a private key stored on PKCS #15 smartcard.
For example, you can upload your key to YubiKey and generate signatures.
How it works
It's using pkcs15-crypto
to process signatures. If it's not installed, you will get an error.
Example
const signer = require('pkcs15-smartcard-sign');
signer.sign({
data: Buffer.from('something')
}).then(signature => {
console.log(signature.toString('hex'));
}).catch(err => {
console.error(err);
});
signer.sign({
data,
pin: '0000',
key: '03',
algo: 'sha512',
reader: 2,
verifyKey: fs.readFileSync('your-public-key.pem')
});