Skip to main content

HsmBackend

Trait HsmBackend 

Source
pub trait HsmBackend: Send + Sync {
    // Required methods
    fn seal(&self, share: &[u8], label: &str) -> Result<SealedShare, HsmError>;
    fn unseal(&self, sealed: &SealedShare) -> Result<Vec<u8>, HsmError>;
    fn generate_key(&self, label: &str) -> Result<String, HsmError>;
    fn delete_key(&self, handle: &str) -> Result<(), HsmError>;
    fn attest(&self, challenge: &[u8]) -> Result<Vec<u8>, HsmError>;
    fn name(&self) -> &str;
}
Expand description

Trait for HSM share protection backends.

Required Methods§

Source

fn seal(&self, share: &[u8], label: &str) -> Result<SealedShare, HsmError>

Seal (encrypt) a share inside the HSM.

Source

fn unseal(&self, sealed: &SealedShare) -> Result<Vec<u8>, HsmError>

Unseal (decrypt) a share from the HSM.

Source

fn generate_key(&self, label: &str) -> Result<String, HsmError>

Generate a new key inside the HSM. Returns the handle.

Source

fn delete_key(&self, handle: &str) -> Result<(), HsmError>

Delete a key from the HSM.

Source

fn attest(&self, challenge: &[u8]) -> Result<Vec<u8>, HsmError>

Attestation: prove the HSM is genuine.

Source

fn name(&self) -> &str

Backend name.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§