4 releases (2 breaking)

0.3.0 Jun 20, 2024
0.2.1 Oct 13, 2023
0.2.0 Aug 24, 2023
0.1.0 Feb 11, 2023

#6 in #adaptor

Download history 240/week @ 2024-07-19 231/week @ 2024-07-26 137/week @ 2024-08-02 145/week @ 2024-08-09 116/week @ 2024-08-16 231/week @ 2024-08-23 47/week @ 2024-08-30 5/week @ 2024-09-06 23/week @ 2024-09-13 28/week @ 2024-09-20 35/week @ 2024-09-27 17/week @ 2024-10-04 31/week @ 2024-10-11 59/week @ 2024-10-18 22/week @ 2024-10-25 24/week @ 2024-11-01

138 downloads per month

MIT/Apache

16KB
300 lines

r2d2 adaptor for cryptoki

Crates.io Documentation

Session pool manager for cryptoki.

Example

use r2d2_cryptoki::{*, cryptoki::{context::*, types::AuthPin}};

let pkcs11 = Pkcs11::new("libsofthsm2.so").unwrap();
pkcs11.initialize(CInitializeArgs::OsThreads).unwrap();
let slots = pkcs11.get_slots_with_token().unwrap();
let slot = slots.first().unwrap();
let manager = SessionManager::new(pkcs11, *slot, SessionType::RwUser(AuthPin::new("fedcba".to_string())));

let pool = r2d2::Pool::builder().build(manager).unwrap();

let session = pool.get().unwrap();
println!("{:?}", session.get_session_info().unwrap());

Dependencies

~3–8MB
~81K SLoC