Hi,
I'm trying out your excellent library and the one thing I'm missing is the ability to capture PIN as entered by the client (basically the C_Login function).
I'm currently using this workaround:
native_pkcs11_traits::register_backend(Box::new(Backend::default()));
unsafe {
info!("replacing login");
FUNC_LIST.C_Login = Some(C_Login_2);
FUNC_LIST.C_GetTokenInfo = Some(C_GetTokenInfo_2);
}
with:
#[unsafe(no_mangle)]
pub extern "C" fn C_Login_2(
_h_session: CK_SESSION_HANDLE,
user_type: CK_USER_TYPE,
p_pin: CK_UTF8CHAR_PTR,
ul_pin_len: CK_ULONG,
) -> CK_RV {
let pin = str::from_utf8(unsafe { slice::from_raw_parts(p_pin, ul_pin_len as usize) }).unwrap();
info!("got pin {user_type:?}, {pin}");
CKR_OK
}
which kind of works but sadly makes me deal with the low-level types.
Would support for capturing C_Login via high-level API (e.g. native_pkcs11_traits::Backend) be a good fit?
(I think it'd be possible to provide a default no-op function there so that the API stays stable).
Thanks for such a great library! 👋
Hi,
I'm trying out your excellent library and the one thing I'm missing is the ability to capture PIN as entered by the client (basically the
C_Loginfunction).I'm currently using this workaround:
with:
which kind of works but sadly makes me deal with the low-level types.
Would support for capturing
C_Loginvia high-level API (e.g.native_pkcs11_traits::Backend) be a good fit?(I think it'd be possible to provide a default no-op function there so that the API stays stable).
Thanks for such a great library! 👋