Struct sequoia_octopus_librnp::RnpContext[][src]

pub struct RnpContext { /* fields omitted */ }

Implementations

impl RnpContext[src]

pub fn insert_cert(&mut self, cert: Cert)[src]

Inserts a cert into the keystore.

This strips any secret key material.

Locking

This acquires a write lock on the keystore and, if the certificate is already present, a write lock on the certificate’s cell.

pub fn insert_cert_external(&mut self, cert: Cert)[src]

Inserts a cert from an external source into the keystore.

This strips any secret key material.

certs from external sources won’t be serialized.

Locking

This acquires a write lock on the keystore and, if the certificate is already present, a write lock on the certificate’s cell.

pub fn insert_key(&mut self, cert: Cert)[src]

Inserts a key into the keystore.

Secret key material is preserved.

Locking

This acquires a write lock on the keystore and, if the certificate is already present, a write lock on the certificate’s cell.

pub fn cert(&self, by: &RnpIdentifier) -> Option<Cert>[src]

Retrieves a certificate from the keystore by userid.

RNP searches both the certring and the keyring, and the keyhandle can thus refer to two certificates, potentially different versions of the same, or even different certificates! Since we merge the key keyrings, this is not a problem for us.

Locking

This acquires a read lock on the keystore and one or more certificates’ cells. See the corresponding search methods for details.

pub fn cert_by_userid(&self, uid: &UserID) -> Option<Cert>[src]

Retrieves a certificate by userid.

XXX: This is super dodgy. rnp.h says “Note: only valid userids are checked while searching by userid.” but it is not clear what that means.

XXX: I think it would be better to fail these lookups. Are they used by TB?

Locking

This acquires a read lock on the keystore. Currently, this function performs a linear scan of all keys. As such, it potentially acquires (in turn) a read lock on all of the certificates’ cells.

pub fn cert_by_subkey_fp(&self, fp: &Fingerprint) -> Option<Cert>[src]

Retrieves a certificate from the keystore by (sub)key fingerprint.

Locking

This acquires a read lock on the keystore and, if a matching certificate is present, a read lock on the certificate’s cell.

pub fn cert_by_subkey_id(&self, id: &KeyID) -> Option<Cert>[src]

Retrieves a certificate from the keystore by (sub)key keyid.

Locking

This acquires a read lock on the keystore and, if a matching certificate is present, a read lock on the certificate’s cell.

pub fn cert_by_subkey_grip(&self, grip: &Keygrip) -> Option<Cert>[src]

Retrieves a certificate from the keystore by (sub)key keygrip.

Locking

This acquires a read lock on the keystore and, if a matching certificate is present, a read lock on the certificate’s cell.

impl RnpContext[src]

pub fn request_password(
    &mut self,
    cert: Option<&Cert>,
    reason: RnpPasswordFor
) -> Option<Password>
[src]

pub fn decrypt_key_for(
    &mut self,
    cert: Option<&Cert>,
    key: Key<SecretParts, UnspecifiedRole>,
    reason: RnpPasswordFor
) -> Result<Key<SecretParts, UnspecifiedRole>>
[src]

Decrypts the given key, if necessary.

pub fn key_is_locked(&mut self, key: &Key<SecretParts, UnspecifiedRole>) -> bool[src]

Returns false iff the key has not been unlocked.

pub fn key_lock(&mut self, key: &Key<SecretParts, UnspecifiedRole>)[src]

Locks the key.

pub fn key_unlock(
    &mut self,
    key: Key<SecretParts, UnspecifiedRole>,
    password: Option<Password>
) -> Result<()>
[src]

Unlocks the key.

If password is None, this function will ask for a password using the callback.

Trait Implementations

impl Default for RnpContext[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,