Struct cryptoki::types::session::Session [−][src]
Type that identifies a session
It will automatically get closed (and logout) on drop. Session does not implement Sync to prevent the same Session instance to be used from multiple threads. A Session needs to be created in its own thread or to be passed by ownership to another thread.
Implementations
impl<'a> Session<'a>
[src]
pub fn decrypt(
&self,
mechanism: &Mechanism,
key: ObjectHandle,
encrypted_data: &[u8]
) -> Result<Vec<u8>>
[src]
&self,
mechanism: &Mechanism,
key: ObjectHandle,
encrypted_data: &[u8]
) -> Result<Vec<u8>>
Single-part decryption operation
impl<'a> Session<'a>
[src]
pub fn encrypt(
&self,
mechanism: &Mechanism,
key: ObjectHandle,
data: &[u8]
) -> Result<Vec<u8>>
[src]
&self,
mechanism: &Mechanism,
key: ObjectHandle,
data: &[u8]
) -> Result<Vec<u8>>
Single-part encryption operation
impl<'a> Session<'a>
[src]
pub fn generate_key_pair(
&self,
mechanism: &Mechanism,
pub_key_template: &[Attribute],
priv_key_template: &[Attribute]
) -> Result<(ObjectHandle, ObjectHandle)>
[src]
&self,
mechanism: &Mechanism,
pub_key_template: &[Attribute],
priv_key_template: &[Attribute]
) -> Result<(ObjectHandle, ObjectHandle)>
Generate a public/private key pair
impl<'a> Session<'a>
[src]
pub fn find_objects(&self, template: &[Attribute]) -> Result<Vec<ObjectHandle>>
[src]
Search for session objects matching a template
pub fn create_object(&self, template: &[Attribute]) -> Result<ObjectHandle>
[src]
Create a new object
pub fn destroy_object(&self, object: ObjectHandle) -> Result<()>
[src]
Destroy an object
pub fn get_attribute_info(
&self,
object: ObjectHandle,
attributes: &[AttributeType]
) -> Result<Vec<AttributeInfo>>
[src]
&self,
object: ObjectHandle,
attributes: &[AttributeType]
) -> Result<Vec<AttributeInfo>>
Get the attribute info of an object: if the attribute is present and its size.
pub fn get_attributes(
&self,
object: ObjectHandle,
attributes: &[AttributeType]
) -> Result<Vec<Attribute>>
[src]
&self,
object: ObjectHandle,
attributes: &[AttributeType]
) -> Result<Vec<Attribute>>
Get the attributes values of an object. Ignore the unavailable one. One has to call the get_attribute_info method to check which ones are unavailable.
impl<'a> Session<'a>
[src]
pub fn close(&self)
[src]
Close a session This will be called on drop as well.
pub fn login(&self, user_type: UserType) -> Result<()>
[src]
Log a session in
Do not fail if the user is already logged in. It happens if another session on the same slot has already called the log in operation. Record the login call and only log out when there aren’t anymore sessions requiring log in state.
pub fn logout(&self) -> Result<()>
[src]
Log a session out
Will also be called on drop.
impl<'a> Session<'a>
[src]
pub fn sign(
&self,
mechanism: &Mechanism,
key: ObjectHandle,
data: &[u8]
) -> Result<Vec<u8>>
[src]
&self,
mechanism: &Mechanism,
key: ObjectHandle,
data: &[u8]
) -> Result<Vec<u8>>
Sign data in single-part
pub fn verify(
&self,
mechanism: &Mechanism,
key: ObjectHandle,
data: &[u8],
signature: &[u8]
) -> Result<()>
[src]
&self,
mechanism: &Mechanism,
key: ObjectHandle,
data: &[u8],
signature: &[u8]
) -> Result<()>
Verify data in single-part
impl<'a> Session<'a>
[src]
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Session<'a>
impl<'a> !Sync for Session<'a>
impl<'a> Unpin for Session<'a>
impl<'a> !UnwindSafe for Session<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,