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
impl Keystore
Sourcepub fn new(backend_name: &str, opts: &Options) -> Result<Self>
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, …).
Sourcepub fn from_instance(instance: Box<dyn StoreInstance>) -> Self
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.
Sourcepub fn instance_mut(&mut self) -> &mut dyn StoreInstance
pub fn instance_mut(&mut self) -> &mut dyn StoreInstance
Borrow the underlying instance mutably. The FFI layer uses this
to dispatch put_* calls.
Sourcepub fn instance(&self) -> &dyn StoreInstance
pub fn instance(&self) -> &dyn StoreInstance
Borrow the underlying instance. The FFI layer uses this to
dispatch get_* / enumerate calls.
pub fn put_secret( &mut self, module: &str, app: &str, key_id: &str, key: *mut c_void, ) -> Result<()>
pub fn get_secret( &self, module: &str, app: &str, key_id: &str, ) -> Result<*mut c_void>
pub fn put_public( &mut self, module: &str, app: &str, identity: &str, key: *mut c_void, sig: &[u8], ) -> Result<()>
pub fn get_public( &self, module: &str, app: &str, identity: &str, ) -> Result<(*mut c_void, Vec<u8>)>
Sourcepub fn sign(
&self,
module: &str,
app: &str,
key_id: &str,
algorithm: &str,
message: &[u8],
) -> Result<Vec<u8>>
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).
pub fn enumerate( &self, module: &str, app: &str, compartment: Compartment, ) -> Result<Vec<(*mut c_void, String)>>
Auto Trait Implementations§
impl !RefUnwindSafe for Keystore
impl !UnwindSafe for Keystore
impl Freeze for Keystore
impl Send for Keystore
impl Sync for Keystore
impl Unpin for Keystore
impl UnsafeUnpin for Keystore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more