pub struct Pkcs11Context { /* private fields */ }Expand description
PKCS#11 library context.
Wraps the Cryptoki Pkcs11 handle with thread-safe reference counting
and automatic initialization/finalization.
Implementations§
Source§impl Pkcs11Context
impl Pkcs11Context
Sourcepub fn with_pkcs11<F, R>(&self, f: F) -> HsmResult<R>
pub fn with_pkcs11<F, R>(&self, f: F) -> HsmResult<R>
Get the underlying Pkcs11 handle.
§Panics
Panics if the mutex is poisoned (should never happen in normal operation). Execute a closure with the PKCS#11 handle.
Returns HsmError::LibraryLoad if this is a placeholder context.
Sourcepub fn library_info(&self) -> HsmResult<String>
pub fn library_info(&self) -> HsmResult<String>
Get library information.
Sourcepub fn placeholder() -> Self
pub fn placeholder() -> Self
Create a placeholder context for use when HSM is not configured.
Any PKCS#11 operation on a placeholder will return HsmError::LibraryLoad.
Trait Implementations§
Source§impl Clone for Pkcs11Context
impl Clone for Pkcs11Context
Source§fn clone(&self) -> Pkcs11Context
fn clone(&self) -> Pkcs11Context
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Pkcs11Context
impl RefUnwindSafe for Pkcs11Context
impl Send for Pkcs11Context
impl Sync for Pkcs11Context
impl Unpin for Pkcs11Context
impl UnsafeUnpin for Pkcs11Context
impl UnwindSafe for Pkcs11Context
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more