Skip to main content

DeviceKeystore

Trait DeviceKeystore 

Source
pub trait DeviceKeystore: Send + Sync {
    // Required methods
    fn seal(
        &self,
        associated_data: Vec<u8>,
        plaintext: Vec<u8>,
    ) -> StorageResult<Vec<u8>>;
    fn open_sealed(
        &self,
        associated_data: Vec<u8>,
        ciphertext: Vec<u8>,
    ) -> StorageResult<Vec<u8>>;
}
Expand description

Device keystore interface used to seal and open account keys.

Required Methods§

Source

fn seal( &self, associated_data: Vec<u8>, plaintext: Vec<u8>, ) -> StorageResult<Vec<u8>>

Seals plaintext under the device-bound key, authenticating associated_data.

The associated data is not encrypted, but it is integrity-protected as part of the seal operation. Any mismatch when opening must fail.

§Errors

Returns an error if the keystore refuses the operation or the seal fails.

Source

fn open_sealed( &self, associated_data: Vec<u8>, ciphertext: Vec<u8>, ) -> StorageResult<Vec<u8>>

Opens ciphertext under the device-bound key, verifying associated_data.

The same associated data used during sealing must be supplied or the open operation must fail.

§Errors

Returns an error if authentication fails or the keystore cannot open.

Trait Implementations§

Source§

impl<T> FfiConverterArc<T> for dyn DeviceKeystore

Source§

const TYPE_ID_META: MetadataBuffer

Source§

type FfiType = Handle

Source§

fn lower(obj: Arc<Self>) -> Self::FfiType

Source§

fn try_lift(handle: Self::FfiType) -> Result<Arc<Self>>

Source§

fn write(obj: Arc<Self>, buf: &mut Vec<u8>)

Source§

fn try_read(buf: &mut &[u8]) -> Result<Arc<Self>>

Source§

impl<T> LiftRef<T> for dyn DeviceKeystore

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§