Expand description

Library for PKCS #11 HSM usage with Sequoia PGP.

Example use, uploading an OpenPGP key to a PKCS #11 device:

use openpgp_pkcs11_sequoia::Op11;

// PKCS #11 driver module
let module = "/usr/lib64/pkcs11/yubihsm_pkcs11.so";

// Serial of the PKCS #11 slot
let serial = "07550916";

// Open PKCS #11 context and slot
let mut pkcs11 = Op11::open(module)?;
let slot = pkcs11.slot(serial)?;

// Open a read-write session, log in as user
let session = slot.open_rw_session()?;

// Upload an OpenPGP component key to the PKCS #11 device as id "3"
session.upload_key(&[3], &pgp_key, &common_name)?;