Skip to main content

Keystore

Struct Keystore 

Source
pub struct Keystore { /* private fields */ }
Expand description

An open keystore connection.

Construct one with Keystore::new by naming a registered backend. The backend’s instance is held behind a Box<dyn StoreInstance> so the public API is backend-agnostic.

Implementations§

Source§

impl Keystore

Source

pub fn new(backend_name: &str, opts: &Options) -> Result<Self>

Open a keystore backed by backend_name. The caller may supply backend-specific options (path, slot, pin, …).

Source

pub fn from_instance(instance: Box<dyn StoreInstance>) -> Self

Wrap an already-constructed instance. Used by tests and by FFI paths that have already resolved the backend.

Source

pub fn instance_mut(&mut self) -> &mut dyn StoreInstance

Borrow the underlying instance mutably. The FFI layer uses this to dispatch put_* calls.

Source

pub fn instance(&self) -> &dyn StoreInstance

Borrow the underlying instance. The FFI layer uses this to dispatch get_* / enumerate calls.

Source

pub fn put_secret( &mut self, module: &str, app: &str, key_id: &str, key: *mut c_void, ) -> Result<()>

Source

pub fn get_secret( &self, module: &str, app: &str, key_id: &str, ) -> Result<*mut c_void>

Source

pub fn put_public( &mut self, module: &str, app: &str, identity: &str, key: *mut c_void, sig: &[u8], ) -> Result<()>

Source

pub fn get_public( &self, module: &str, app: &str, identity: &str, ) -> Result<(*mut c_void, Vec<u8>)>

Source

pub fn sign( &self, module: &str, app: &str, key_id: &str, algorithm: &str, message: &[u8], ) -> Result<Vec<u8>>

Sign a message with a remotely-held key (see StoreInstance::sign).

Source

pub fn enumerate( &self, module: &str, app: &str, compartment: Compartment, ) -> Result<Vec<(*mut c_void, String)>>

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.