pub trait CryptoClient: PollClient {
Show 20 methods
// Provided methods
fn agree(
&mut self,
mechanism: Mechanism,
private_key: KeyId,
public_key: KeyId,
attributes: StorageAttributes,
) -> ClientResult<'_, Agree, Self> { ... }
fn decrypt<'c>(
&'c mut self,
mechanism: Mechanism,
key: KeyId,
message: &[u8],
associated_data: &[u8],
nonce: &[u8],
tag: &[u8],
) -> ClientResult<'c, Decrypt, Self> { ... }
fn delete(&mut self, key: KeyId) -> ClientResult<'_, Delete, Self> { ... }
fn clear(&mut self, key: KeyId) -> ClientResult<'_, Clear, Self> { ... }
fn delete_all(
&mut self,
location: Location,
) -> ClientResult<'_, DeleteAllKeys, Self> { ... }
fn derive_key(
&mut self,
mechanism: Mechanism,
base_key: KeyId,
additional_data: Option<MediumData>,
attributes: StorageAttributes,
) -> ClientResult<'_, DeriveKey, Self> { ... }
fn deserialize_key<'c>(
&'c mut self,
mechanism: Mechanism,
serialized_key: &[u8],
format: KeySerialization,
attributes: StorageAttributes,
) -> ClientResult<'c, DeserializeKey, Self> { ... }
fn encrypt<'c>(
&'c mut self,
mechanism: Mechanism,
key: KeyId,
message: &[u8],
associated_data: &[u8],
nonce: Option<ShortData>,
) -> ClientResult<'c, Encrypt, Self> { ... }
fn exists(
&mut self,
mechanism: Mechanism,
key: KeyId,
) -> ClientResult<'_, Exists, Self> { ... }
fn generate_key(
&mut self,
mechanism: Mechanism,
attributes: StorageAttributes,
) -> ClientResult<'_, GenerateKey, Self> { ... }
fn generate_secret_key(
&mut self,
size: usize,
persistence: Location,
) -> ClientResult<'_, GenerateSecretKey, Self> { ... }
fn hash(
&mut self,
mechanism: Mechanism,
message: Message,
) -> ClientResult<'_, Hash, Self> { ... }
fn random_bytes(
&mut self,
count: usize,
) -> ClientResult<'_, RandomBytes, Self> { ... }
fn serialize_key(
&mut self,
mechanism: Mechanism,
key: KeyId,
format: KeySerialization,
) -> ClientResult<'_, SerializeKey, Self> { ... }
fn sign<'c>(
&'c mut self,
mechanism: Mechanism,
key: KeyId,
data: &[u8],
format: SignatureSerialization,
) -> ClientResult<'c, Sign, Self> { ... }
fn verify<'c>(
&'c mut self,
mechanism: Mechanism,
key: KeyId,
message: &[u8],
signature: &[u8],
format: SignatureSerialization,
) -> ClientResult<'c, Verify, Self> { ... }
fn unsafe_inject_key(
&mut self,
mechanism: Mechanism,
raw_key: &[u8],
persistence: Location,
format: KeySerialization,
) -> ClientResult<'_, UnsafeInjectKey, Self> { ... }
fn unsafe_inject_shared_key(
&mut self,
raw_key: &[u8],
location: Location,
) -> ClientResult<'_, UnsafeInjectSharedKey, Self> { ... }
fn unwrap_key<'c>(
&'c mut self,
mechanism: Mechanism,
wrapping_key: KeyId,
wrapped_key: Message,
associated_data: &[u8],
nonce: &[u8],
attributes: StorageAttributes,
) -> ClientResult<'c, UnwrapKey, Self> { ... }
fn wrap_key(
&mut self,
mechanism: Mechanism,
wrapping_key: KeyId,
key: KeyId,
associated_data: &[u8],
nonce: Option<ShortData>,
) -> ClientResult<'_, WrapKey, Self> { ... }
}
Available on crate feature
crypto-client
only.Expand description
Trussed Client interface that Trussed apps can rely on.
Provided Methods§
fn agree( &mut self, mechanism: Mechanism, private_key: KeyId, public_key: KeyId, attributes: StorageAttributes, ) -> ClientResult<'_, Agree, Self>
fn decrypt<'c>( &'c mut self, mechanism: Mechanism, key: KeyId, message: &[u8], associated_data: &[u8], nonce: &[u8], tag: &[u8], ) -> ClientResult<'c, Decrypt, Self>
fn delete(&mut self, key: KeyId) -> ClientResult<'_, Delete, Self>
Sourcefn clear(&mut self, key: KeyId) -> ClientResult<'_, Clear, Self>
fn clear(&mut self, key: KeyId) -> ClientResult<'_, Clear, Self>
Clear private data from the key
This will not delete all metadata from storage.
Other backends can retain metadata required for unwrap_key
to work properly
and delete this metadata only once delete
is called.
Sourcefn delete_all(
&mut self,
location: Location,
) -> ClientResult<'_, DeleteAllKeys, Self>
fn delete_all( &mut self, location: Location, ) -> ClientResult<'_, DeleteAllKeys, Self>
Skips deleting read-only / manufacture keys (currently, “low ID”).
fn derive_key( &mut self, mechanism: Mechanism, base_key: KeyId, additional_data: Option<MediumData>, attributes: StorageAttributes, ) -> ClientResult<'_, DeriveKey, Self>
fn deserialize_key<'c>( &'c mut self, mechanism: Mechanism, serialized_key: &[u8], format: KeySerialization, attributes: StorageAttributes, ) -> ClientResult<'c, DeserializeKey, Self>
fn encrypt<'c>( &'c mut self, mechanism: Mechanism, key: KeyId, message: &[u8], associated_data: &[u8], nonce: Option<ShortData>, ) -> ClientResult<'c, Encrypt, Self>
fn exists( &mut self, mechanism: Mechanism, key: KeyId, ) -> ClientResult<'_, Exists, Self>
fn generate_key( &mut self, mechanism: Mechanism, attributes: StorageAttributes, ) -> ClientResult<'_, GenerateKey, Self>
fn generate_secret_key( &mut self, size: usize, persistence: Location, ) -> ClientResult<'_, GenerateSecretKey, Self>
fn hash( &mut self, mechanism: Mechanism, message: Message, ) -> ClientResult<'_, Hash, Self>
fn random_bytes(&mut self, count: usize) -> ClientResult<'_, RandomBytes, Self>
fn serialize_key( &mut self, mechanism: Mechanism, key: KeyId, format: KeySerialization, ) -> ClientResult<'_, SerializeKey, Self>
fn sign<'c>( &'c mut self, mechanism: Mechanism, key: KeyId, data: &[u8], format: SignatureSerialization, ) -> ClientResult<'c, Sign, Self>
fn verify<'c>( &'c mut self, mechanism: Mechanism, key: KeyId, message: &[u8], signature: &[u8], format: SignatureSerialization, ) -> ClientResult<'c, Verify, Self>
fn unsafe_inject_key( &mut self, mechanism: Mechanism, raw_key: &[u8], persistence: Location, format: KeySerialization, ) -> ClientResult<'_, UnsafeInjectKey, Self>
fn unwrap_key<'c>( &'c mut self, mechanism: Mechanism, wrapping_key: KeyId, wrapped_key: Message, associated_data: &[u8], nonce: &[u8], attributes: StorageAttributes, ) -> ClientResult<'c, UnwrapKey, Self>
fn wrap_key( &mut self, mechanism: Mechanism, wrapping_key: KeyId, key: KeyId, associated_data: &[u8], nonce: Option<ShortData>, ) -> ClientResult<'_, WrapKey, Self>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.