pub struct Token { /* private fields */ }Expand description
Encapsulates a token.
A Backend provides access to one or more slots, which may or
may not contain a token. Each token holds one or more Keys.
Before a token has been initialize its slot ID is the only way to
identify it. Afterwards, the token’s unique ID (which not all
backends support) or the token’s label (which is not guaranteed to
be unique, but is by convention) should be used.
Implementations§
Source§impl Token
impl Token
Sourcepub fn info(&self) -> &TokenInfo
pub fn info(&self) -> &TokenInfo
Returns information about the token.
See cryptoki::TokenInfo for more details.
Sourcepub fn open_ro_session(&self) -> Result<Session>
pub fn open_ro_session(&self) -> Result<Session>
Opens a read-only session to the token.
This is needed to sign or decrypt a message, for instance.
A user is not logged into the session. You should either use
Token::open_ro_user_session, or follow up by calling the
low-level Session’s login method.
Sourcepub fn open_ro_user_session<P>(&self, pin: P) -> Result<Session>
pub fn open_ro_user_session<P>(&self, pin: P) -> Result<Session>
Opens a read-only session to the token, and logs in as the user.
This is needed to sign or decrypt a message, for instance.
Sourcepub fn open_rw_session(&self) -> Result<Session>
pub fn open_rw_session(&self) -> Result<Session>
Opens a read-write session to the token.
This is needed to generate or import a key, for instance.
A user is not logged into the session. You should either use
Token::open_rw_user_session, or follow up by calling the
low-level Session’s login method.