pub enum Identity {
Unencrypted(UnencryptedKey),
Encrypted(EncryptedKey),
Unsupported(UnsupportedKey),
}Available on crate feature
ssh only.Expand description
An SSH private key for decrypting an age file.
Variants§
Unencrypted(UnencryptedKey)
An unencrypted key.
Encrypted(EncryptedKey)
An encrypted key.
Unsupported(UnsupportedKey)
A key that we know how to parse, but that we do not support.
Implementations§
source§impl Identity
impl Identity
sourcepub fn from_buffer<R: BufRead>(
data: R,
filename: Option<String>
) -> Result<Self>
pub fn from_buffer<R: BufRead>( data: R, filename: Option<String> ) -> Result<Self>
Parses one or more identities from a buffered input containing valid UTF-8.
filename is the path to the file that the input is reading from, if any.
sourcepub fn with_callbacks<C: Callbacks>(self, callbacks: C) -> impl Identity
pub fn with_callbacks<C: Callbacks>(self, callbacks: C) -> impl Identity
Wraps this identity with the provided callbacks, so that if this is an encrypted identity, it can potentially be decrypted.
Trait Implementations§
source§impl From<EncryptedKey> for Identity
impl From<EncryptedKey> for Identity
source§fn from(key: EncryptedKey) -> Self
fn from(key: EncryptedKey) -> Self
Converts to this type from the input type.
source§impl From<UnsupportedKey> for Identity
impl From<UnsupportedKey> for Identity
source§fn from(key: UnsupportedKey) -> Self
fn from(key: UnsupportedKey) -> Self
Converts to this type from the input type.
source§impl Identity for Identity
impl Identity for Identity
source§fn unwrap_stanza(
&self,
stanza: &Stanza
) -> Option<Result<FileKey, DecryptError>>
fn unwrap_stanza( &self, stanza: &Stanza ) -> Option<Result<FileKey, DecryptError>>
Attempts to unwrap the given stanza with this identity. Read more
source§fn unwrap_stanzas(
&self,
stanzas: &[Stanza]
) -> Option<Result<FileKey, DecryptError>>
fn unwrap_stanzas( &self, stanzas: &[Stanza] ) -> Option<Result<FileKey, DecryptError>>
Attempts to unwrap any of the given stanzas, which are assumed to come from the
same age file header, and therefore contain the same file key. Read more