Enum sequoia_ipc::sexp::Sexp

source ·
pub enum Sexp {
    String(String_),
    List(Vec<Sexp>),
}
Expand description

An S-Expression.

An S-Expression is either a string, or a list of S-Expressions.

Variants§

§

String(String_)

Just a string.

§

List(Vec<Sexp>)

A list of S-Expressions.

Implementations§

source§

impl Sexp

source

pub fn finish_decryption<R>( &self, recipient: &Key<PublicParts, R>, ciphertext: &Ciphertext, plaintext_len: Option<usize>, padding: bool ) -> Result<SessionKey>
where R: KeyRole,

Completes the decryption of this S-Expression representing a wrapped session key.

Such an expression is returned from gpg-agent’s PKDECRYPT command. padding must be set according to the status messages sent.

source

pub fn to_signature(&self) -> Result<Signature>

Parses this s-expression to a signature.

Such an expression is returned from gpg-agent’s PKSIGN command.

source

pub fn to_secret_key(&self, pk: Option<&PublicKey>) -> Result<SecretKeyMaterial>

Parses this s-expression to a private key.

Such an expression is returned from gpg-agent’s EXPORT_KEY command.

When exporting NIST and brainpool curves, gpg doesn’t indicate whether the curve is an ECDSA curve (for signing) or an ECDH curve (for encryption). As mpi::SecretKeyMaterial needs this information, it is necessary for the caller to provide it. This information can be extract from the public key. If None is provided and the sexp is unambiguous (e.g., it’s an RSA key), then the secret key material is returned in the expected form. If the sexp is ambiguous and pk is None, then mpi::SecretKeyMaterial::Unknown is returned.

source

pub fn string(&self) -> Option<&String_>

Casts this to a string.

source

pub fn list(&self) -> Option<&[Sexp]>

Casts this to a list.

source

pub fn serialize(&self, o: &mut dyn Write) -> Result<()>

Writes a serialized version of the object to o.

Trait Implementations§

source§

impl Clone for Sexp

source§

fn clone(&self) -> Sexp

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Sexp

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<String_> for Sexp

source§

fn from(v: String_) -> Sexp

Converts to this type from the input type.
source§

impl From<Vec<Sexp>> for Sexp

source§

fn from(v: Vec<Sexp>) -> Sexp

Converts to this type from the input type.
source§

impl<'a> Parse<'a, Sexp> for Sexp

source§

fn from_reader<R: 'a + Read + Send + Sync>(reader: R) -> Result<Sexp>

Reads from the given reader.
source§

fn from_file<P: AsRef<Path>>(path: P) -> Result<Sexp>

Reads from the given file. Read more
source§

fn from_bytes<D: AsRef<[u8]> + ?Sized>(data: &'a D) -> Result<Sexp>

Reads from the given slice. Read more
source§

fn from_buffered_reader<R>(reader: R) -> Result<T, Error>
where R: BufferedReader<Cookie> + 'a,

Reads from the given buffered reader.
source§

impl PartialEq for Sexp

source§

fn eq(&self, other: &Sexp) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<&Ciphertext> for Sexp

source§

fn try_from(ciphertext: &Ciphertext) -> Result<Self>

Constructs an S-Expression representing ciphertext.

The resulting expression is suitable for gpg-agent’s INQUIRE CIPHERTEXT inquiry.

§

type Error = Error

The type returned in the event of a conversion error.
source§

impl Eq for Sexp

source§

impl StructuralPartialEq for Sexp

Auto Trait Implementations§

§

impl Freeze for Sexp

§

impl RefUnwindSafe for Sexp

§

impl Send for Sexp

§

impl Sync for Sexp

§

impl Unpin for Sexp

§

impl UnwindSafe for Sexp

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

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

source§

fn vzip(self) -> V