# pkcs15-smartcard-sign

> This module allows you to sign anything with a private key stored on PKCS #15 smartcard.

Latest version **1.0.0** (published 2017-06-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install pkcs15-smartcard-sign
pnpm add pkcs15-smartcard-sign
yarn add pkcs15-smartcard-sign
bun add pkcs15-smartcard-sign
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-06-10 |
| First published | 2017-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Antelle |
| Maintainers | antelle |
| Keywords | pkcs#15, sign, signature, crypto, smartcard, smart, card, sha256, sha |

## Links

- npm: https://www.npmjs.com/package/pkcs15-smartcard-sign
- Repository: https://github.com/antelle/pkcs15-smartcard-sign
- Homepage: https://github.com/antelle/pkcs15-smartcard-sign#readme
- Issues: https://github.com/antelle/pkcs15-smartcard-sign/issues
- npm.io page: https://npm.io/package/pkcs15-smartcard-sign

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-06-10

## README

# 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`](https://linux.die.net/man/1/pkcs15-crypt) to process signatures. If it's not installed, you will get an error. 

## Example

```javascript
const signer = require('pkcs15-smartcard-sign');

// Basic usage:
//  - SHA-256
//  - Read key with ID 02
//  - Promot for PIN
signer.sign({
    data: Buffer.from('something')
}).then(signature => {
    console.log(signature.toString('hex'));
}).catch(err => {
    console.error(err);
});

// Advanced options
signer.sign({
    data,
    // predefined PIN
    pin: '0000',
    // ID of the key to use (on the smart card)
    key: '03',
    // algo: sha256 or sha512
    algo: 'sha512',
    // select N-th smart card reader configured by the system
    reader: 2,
    // verify with this public key after sign
    verifyKey: fs.readFileSync('your-public-key.pem')
});
```

---
_Source: https://npm.io/package/pkcs15-smartcard-sign · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
