Enum ssh_key::public::KeyData

source ·
#[non_exhaustive]
pub enum KeyData { Dsa(DsaPublicKey), Ecdsa(EcdsaPublicKey), Ed25519(Ed25519PublicKey), Rsa(RsaPublicKey), SkEcdsaSha2NistP256(SkEcdsaSha2NistP256), SkEd25519(SkEd25519), }
Expand description

Public key data.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Dsa(DsaPublicKey)

Digital Signature Algorithm (DSA) public key data.

§

Ecdsa(EcdsaPublicKey)

Elliptic Curve Digital Signature Algorithm (ECDSA) public key data.

§

Ed25519(Ed25519PublicKey)

Ed25519 public key data.

§

Rsa(RsaPublicKey)

RSA public key data.

§

SkEcdsaSha2NistP256(SkEcdsaSha2NistP256)

Security Key (FIDO/U2F) using ECDSA/NIST P-256 as specified in PROTOCOL.u2f.

§

SkEd25519(SkEd25519)

Security Key (FIDO/U2F) using Ed25519 as specified in PROTOCOL.u2f.

Implementations§

source§

impl KeyData

source

pub fn algorithm(&self) -> Algorithm

Get the Algorithm for this public key.

source

pub fn dsa(&self) -> Option<&DsaPublicKey>

Get DSA public key if this key is the correct type.

source

pub fn ecdsa(&self) -> Option<&EcdsaPublicKey>

Get ECDSA public key if this key is the correct type.

source

pub fn ed25519(&self) -> Option<&Ed25519PublicKey>

Get Ed25519 public key if this key is the correct type.

source

pub fn fingerprint(&self, hash_alg: HashAlg) -> Fingerprint

Compute key fingerprint.

Use Default::default() to use the default hash function (SHA-256).

source

pub fn rsa(&self) -> Option<&RsaPublicKey>

Get RSA public key if this key is the correct type.

source

pub fn sk_ecdsa_p256(&self) -> Option<&SkEcdsaSha2NistP256>

Get FIDO/U2F ECDSA/NIST P-256 public key if this key is the correct type.

source

pub fn sk_ed25519(&self) -> Option<&SkEd25519>

Get FIDO/U2F Ed25519 public key if this key is the correct type.

source

pub fn is_dsa(&self) -> bool

Is this key a DSA key?

source

pub fn is_ecdsa(&self) -> bool

Is this key an ECDSA key?

source

pub fn is_ed25519(&self) -> bool

Is this key an Ed25519 key?

source

pub fn is_rsa(&self) -> bool

Is this key an RSA key?

source

pub fn is_sk_ecdsa_p256(&self) -> bool

Is this key a FIDO/U2F ECDSA/NIST P-256 key?

source

pub fn is_sk_ed25519(&self) -> bool

Is this key a FIDO/U2F Ed25519 key?

Trait Implementations§

source§

impl Clone for KeyData

source§

fn clone(&self) -> KeyData

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 KeyData

source§

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

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

impl From<&PrivateKey> for KeyData

source§

fn from(private_key: &PrivateKey) -> KeyData

Converts to this type from the input type.
source§

impl From<&PublicKey> for KeyData

source§

fn from(public_key: &PublicKey) -> KeyData

Converts to this type from the input type.
source§

impl From<DsaPublicKey> for KeyData

source§

fn from(public_key: DsaPublicKey) -> KeyData

Converts to this type from the input type.
source§

impl From<EcdsaPublicKey> for KeyData

source§

fn from(public_key: EcdsaPublicKey) -> KeyData

Converts to this type from the input type.
source§

impl From<Ed25519PublicKey> for KeyData

source§

fn from(public_key: Ed25519PublicKey) -> KeyData

Converts to this type from the input type.
source§

impl From<KeyData> for PublicKey

source§

fn from(key_data: KeyData) -> PublicKey

Converts to this type from the input type.
source§

impl From<PrivateKey> for KeyData

source§

fn from(private_key: PrivateKey) -> KeyData

Converts to this type from the input type.
source§

impl From<PublicKey> for KeyData

source§

fn from(public_key: PublicKey) -> KeyData

Converts to this type from the input type.
source§

impl From<RsaPublicKey> for KeyData

source§

fn from(public_key: RsaPublicKey) -> KeyData

Converts to this type from the input type.
source§

impl From<SkEcdsaSha2NistP256> for KeyData

source§

fn from(public_key: SkEcdsaSha2NistP256) -> KeyData

Converts to this type from the input type.
source§

impl From<SkEd25519> for KeyData

source§

fn from(public_key: SkEd25519) -> KeyData

Converts to this type from the input type.
source§

impl Ord for KeyData

source§

fn cmp(&self, other: &KeyData) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for KeyData

source§

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

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

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

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

impl PartialOrd for KeyData

source§

fn partial_cmp(&self, other: &KeyData) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl TryFrom<&KeypairData> for KeyData

§

type Error = Error

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

fn try_from(keypair_data: &KeypairData) -> Result<KeyData>

Performs the conversion.
source§

impl Verifier<Signature> for KeyData

source§

fn verify(&self, message: &[u8], signature: &Signature) -> Result<()>

Use Self to verify that the provided signature for a given message bytestring is authentic. Read more
source§

impl Eq for KeyData

source§

impl StructuralPartialEq for KeyData

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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.