Struct cryptoki::Pkcs11[][src]

pub struct Pkcs11 { /* fields omitted */ }

Main PKCS11 context. Should usually be unique per application.


impl Pkcs11[src]

pub fn initialize(&self, init_args: CInitializeArgs) -> Result<()>[src]

Initialize the PKCS11 library

pub fn finalize(self)[src]

Finalize the PKCS11 library. Indicates that the application no longer needs to use PKCS11. The library is also automatically finalized on drop.

impl Pkcs11[src]

pub fn open_session_no_callback(
    slot_id: Slot,
    flags: Flags
) -> Result<Session<'_>>

Open a new session with no callback set

impl Pkcs11[src]

pub fn get_slots_with_token(&self) -> Result<Vec<Slot>>[src]

Get all slots available with a token

pub fn get_all_slots(&self) -> Result<Vec<Slot>>[src]

Get all slots

pub fn init_token(&self, slot: Slot, pin: &str) -> Result<()>[src]

Initialize a token

Currently will use an empty label for all tokens.

impl Pkcs11[src]

pub fn new<P>(filename: P) -> Result<Self> where
    P: AsRef<Path>, 

Instantiate a new context from the path of a PKCS11 dynamic llibrary implementation.

pub fn set_pin(&self, slot: Slot, pin: &str) -> Result<()>[src]

Set the PIN used when logging in sessions. The pin set is the one that is going to be use with all user type specified when logging in. It needs to be changed before calling login with a different user type.

pub fn clear_pin(&self, slot: Slot)[src]

Clear the pin store. Ignore if the pin was not set previously on the slot. Note that the pin will be cleared anyway on drop.

Trait Implementations

impl Debug for Pkcs11[src]

impl Drop for Pkcs11[src]

Auto Trait Implementations

impl !RefUnwindSafe for Pkcs11

impl Send for Pkcs11

impl Sync for Pkcs11

impl Unpin for Pkcs11

impl !UnwindSafe for Pkcs11

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.