Trait sequoia_keystore_backend::KeyHandle

source ·
pub trait KeyHandle {
Show 15 methods // Required methods fn id(&self) -> String; fn fingerprint(&self) -> Fingerprint; fn device<'a, 'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Box<dyn DeviceHandle + Send + Sync + 'a>> + Send + 'async_trait>> where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait; fn available<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn locked<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Protection> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn decryption_capable<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn signing_capable<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn public_key<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Key<PublicParts, UnspecifiedRole>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn decrypt_ciphertext<'life0, 'life1, 'async_trait>( &'life0 mut self, ciphertext: &'life1 Ciphertext, plaintext_len: Option<usize> ) -> Pin<Box<dyn Future<Output = Result<SessionKey>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn sign<'life0, 'life1, 'async_trait>( &'life0 mut self, hash_algo: HashAlgorithm, text: &'life1 [u8] ) -> Pin<Box<dyn Future<Output = Result<(PublicKeyAlgorithm, Signature)>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn export<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<Key<SecretParts, UnspecifiedRole>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn keyid(&self) -> KeyID { ... } fn unlock<'life0, 'life1, 'async_trait>( &'life0 mut self, _password: &'life1 Password ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn lock<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait { ... } fn decrypt_pkesk<'life0, 'life1, 'async_trait>( &'life0 mut self, pkesk: &'life1 PKESK ) -> Pin<Box<dyn Future<Output = Option<(SymmetricAlgorithm, SessionKey)>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}
Expand description

A Key on a Device.

A key may or may not be available. This is a function of the device.

Required Methods§

source

fn id(&self) -> String

Returns the key’s id.

The id is a globally unique, stable, and mostly human readable identifier. An example of a good id is the concatenation of the the key’s fingerprint, and the device’s serial number, e.g., “Key 8F17777118A33DDA9BA48E62AACB3243630052D9 on Yubikey 5 #217813388320.”

source

fn fingerprint(&self) -> Fingerprint

Returns the key’s fingerprint.

source

fn device<'a, 'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Box<dyn DeviceHandle + Send + Sync + 'a>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Returns the key’s device.

source

fn available<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns whether the key is available.

source

fn locked<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Protection> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns whether the key is locked.

source

fn decryption_capable<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns whether the key is decryption capable.

source

fn signing_capable<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns whether the key is signing capable.

source

fn public_key<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Key<PublicParts, UnspecifiedRole>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the corresponding public key.

The backend SHOULD ensure that the secret key material is removed.

source

fn decrypt_ciphertext<'life0, 'life1, 'async_trait>( &'life0 mut self, ciphertext: &'life1 Ciphertext, plaintext_len: Option<usize> ) -> Pin<Box<dyn Future<Output = Result<SessionKey>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Decrypts a ciphertext.

This method has the same semantics as sequoia_openpgp::crypto::Decryptor::decrypt.

Returns the session key.

source

fn sign<'life0, 'life1, 'async_trait>( &'life0 mut self, hash_algo: HashAlgorithm, text: &'life1 [u8] ) -> Pin<Box<dyn Future<Output = Result<(PublicKeyAlgorithm, Signature)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Signs a message.

text is the message to sign.

source

fn export<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<Key<SecretParts, UnspecifiedRole>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Exports the secret key material.

Provided Methods§

source

fn keyid(&self) -> KeyID

Returns the key’s key ID.

source

fn unlock<'life0, 'life1, 'async_trait>( &'life0 mut self, _password: &'life1 Password ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Unlocks a key.

A key is typically unlocked by providing a password or pin. Not all keys are locked. If the key is not available, this should attempt to connect to the device. If the device is not available or cannot be initialized, then this should fail.

source

fn lock<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Lock a key.

Relocks the key. This usually causes the backend to forget the key’s password.

source

fn decrypt_pkesk<'life0, 'life1, 'async_trait>( &'life0 mut self, pkesk: &'life1 PKESK ) -> Pin<Box<dyn Future<Output = Option<(SymmetricAlgorithm, SessionKey)>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Decrypts a PKESK.

Implementors§