pub struct AgentClient<S> { /* private fields */ }
Expand description

SSH agent client.

Implementations§

source§

impl<S> AgentClient<S>

source

pub fn connect(stream: S) -> Self

Connect to an SSH agent via the provided stream (on Unix, usually a Unix-domain socket).

source

pub fn pid(&self) -> Option<u32>

Get the agent PID.

source§

impl<S: ClientStream> AgentClient<S>

source

pub fn add_identity<K>( &mut self, key: &K, constraints: &[Constraint] ) -> Result<(), Error>
where K: Encodable, K::Error: Error + Send + Sync + 'static,

Send a key to the agent, with a (possibly empty) slice of constraints to apply when using the key to sign.

source

pub fn add_smartcard_key( &mut self, id: &str, pin: &[u8], constraints: &[Constraint] ) -> Result<(), Error>

Add a smart card to the agent, with a (possibly empty) set of constraints to apply when signing.

source

pub fn lock(&mut self, passphrase: &[u8]) -> Result<(), Error>

Lock the agent, making it refuse to sign until unlocked.

source

pub fn unlock(&mut self, passphrase: &[u8]) -> Result<(), Error>

Unlock the agent, allowing it to sign again.

source

pub fn request_identities<K>(&mut self) -> Result<Vec<K>, Error>
where K: Encodable, K::Error: Error + Send + Sync + 'static,

Ask the agent for a list of the currently registered secret keys.

source

pub fn sign<K>(&mut self, public: &K, data: &[u8]) -> Result<Signature, Error>
where K: Encodable + Debug,

Ask the agent to sign the supplied piece of data.

source

pub fn remove_identity<K>(&mut self, public: &K) -> Result<(), Error>
where K: Encodable,

Ask the agent to remove a key from its memory.

source

pub fn remove_smartcard_key( &mut self, id: &str, pin: &[u8] ) -> Result<(), Error>

Ask the agent to remove a smartcard from its memory.

source

pub fn remove_all_identities(&mut self) -> Result<(), Error>

Ask the agent to forget all known keys.

source

pub fn extension(&mut self, typ: &[u8], ext: &[u8]) -> Result<(), Error>

Send a custom message to the agent.

source

pub fn query_extension( &mut self, typ: &[u8], ext: Buffer ) -> Result<bool, Error>

Ask the agent about supported extensions.

Auto Trait Implementations§

§

impl<S> Freeze for AgentClient<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for AgentClient<S>
where S: RefUnwindSafe,

§

impl<S> Send for AgentClient<S>
where S: Send,

§

impl<S> Sync for AgentClient<S>
where S: Sync,

§

impl<S> Unpin for AgentClient<S>
where S: Unpin,

§

impl<S> UnwindSafe for AgentClient<S>
where S: UnwindSafe,

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> 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, 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.