Struct yubihsm::session::Session[][src]

pub struct Session<A: Adapter> { /* fields omitted */ }

Encrypted session with a YubiHSM. A session is needed to perform any command.

Sessions are eneric over Adapter types in case a different one needs to be swapped in, which is primarily useful for substituting the MockHsm.

Sessions are automatically closed on Drop, releasing YubiHSM2 session resources and wiping the ephemeral keys used to encrypt the session.

Methods

impl<A: Adapter> Session<A>
[src]

Create a new session, eagerly connecting to the YubiHSM

Initialize a new encrypted session, deferring actually establishing a session until open() is called

Connect to the YubiHSM (if we aren't already connected)

Get the current session ID

Do we currently have an open session with the HSM?

Borrow the adapter for this session (if available)

Get the serial number of the underlying HSM, if it's available

Trait Implementations

impl<A: Adapter> Drop for Session<A>
[src]

Close session automatically on drop

Make a best effort to close the session

NOTE: this runs the potential of panicking in a drop handler, which results in the following when it occurs (Aieee!):

"thread panicked while panicking. aborting"

Because of this, it's very important send_encrypted_command and everything it calls be panic-free.

Auto Trait Implementations

impl<A> Send for Session<A> where
    <A as Adapter>::Config: Send

impl<A> Sync for Session<A> where
    <A as Adapter>::Config: Sync