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

#2 in #adaptor

Download history 111/week @ 2024-05-16 10/week @ 2024-05-23 2/week @ 2024-05-30 5/week @ 2024-06-13 379/week @ 2024-06-20 220/week @ 2024-06-27 223/week @ 2024-07-04 290/week @ 2024-07-11 280/week @ 2024-07-18 242/week @ 2024-07-25 113/week @ 2024-08-01 184/week @ 2024-08-08 92/week @ 2024-08-15 209/week @ 2024-08-22 92/week @ 2024-08-29

590 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