Skip to main content

Pkcs11Instance

Struct Pkcs11Instance 

Source
pub struct Pkcs11Instance {
    pub config: Config,
    /* private fields */
}
Expand description

One open PKCS#11-backed keystore connection.

Owns the cryptoki client and the live session. Both are Send + Sync (the underlying PKCS#11 module was initialised with CKF_OS_LOCKING_OK), so the trait object is sound without a manual unsafe impl.

Fields§

§config: Config

Resolved configuration parsed from Options at open time.

Trait Implementations§

Source§

impl StoreInstance for Pkcs11Instance

Source§

fn put_secret( &mut self, _module: &str, _app: &str, _key_id: &str, _key: *mut c_void, ) -> Result<()>

Insert a secret key into the private compartment, indexed by key_id.
Source§

fn get_secret( &self, _module: &str, _app: &str, _key_id: &str, ) -> Result<*mut c_void>

Fetch a secret key from the private compartment by key_id. Returns crate::error::Error::ValueNotFound if absent.
Source§

fn put_public( &mut self, _module: &str, _app: &str, _identity: &str, _key: *mut c_void, _sig: &[u8], ) -> Result<()>

Insert a public key into the public compartment, indexed by identity, with a detached signature over the identity.
Source§

fn get_public( &self, _module: &str, _app: &str, _identity: &str, ) -> Result<(*mut c_void, Vec<u8>)>

Fetch a public key from the public compartment by identity. Returns the key handle and the stored signature bytes.
Source§

fn enumerate( &self, _module: &str, _app: &str, _compartment: Compartment, ) -> Result<Vec<(*mut c_void, String)>>

Enumerate entries in one compartment of one (module, app) scope. Each entry is the opaque key handle paired with its index string (key_id for private, canonical identity for public).
Source§

fn sign( &self, _module: &str, _app: &str, _key_id: &str, _algorithm: &str, _message: &[u8], ) -> Result<Vec<u8>, Error>

Sign message with the remote key named by key_id, using the provider-specific algorithm name (e.g. "ECDSA_SHA_256" on AWS KMS, "EC_SIGN_P256_SHA256" on Cloud KMS, "ES256" on Key Vault). Input is the raw message — providers that sign digests hash it themselves or the backend does. This is the remote-sign half of the sign-with-handle contract: backends that hold keys out-of-process (cloud KMS, PKCS#11, TPM) implement it; local backends keep the default.
Source§

impl Sync for Pkcs11Instance

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.