Enum ssh_key::private::KeypairData
source · [−]#[non_exhaustive]
pub enum KeypairData {
Dsa(DsaKeypair),
Ecdsa(EcdsaKeypair),
Ed25519(Ed25519Keypair),
Encrypted(Vec<u8>),
Rsa(RsaKeypair),
SkEcdsaSha2NistP256(SkEcdsaSha2NistP256),
SkEd25519(SkEd25519),
}
Expand description
Private key data: digital signature key pairs.
SSH private keys contain pairs of public and private keys for various supported digital signature algorithms.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Dsa(DsaKeypair)
alloc
only.Digital Signature Algorithm (DSA) keypair.
Ecdsa(EcdsaKeypair)
ecdsa
only.ECDSA keypair.
Ed25519(Ed25519Keypair)
Ed25519 keypair.
Encrypted(Vec<u8>)
alloc
only.Encrypted private key (ciphertext).
Rsa(RsaKeypair)
alloc
only.RSA keypair.
SkEcdsaSha2NistP256(SkEcdsaSha2NistP256)
alloc
and ecdsa
only.Security Key (FIDO/U2F) using ECDSA/NIST P-256 as specified in PROTOCOL.u2f.
SkEd25519(SkEd25519)
alloc
only.Security Key (FIDO/U2F) using Ed25519 as specified in PROTOCOL.u2f.
Implementations
sourceimpl KeypairData
impl KeypairData
sourcepub fn dsa(&self) -> Option<&DsaKeypair>
Available on crate feature alloc
only.
pub fn dsa(&self) -> Option<&DsaKeypair>
alloc
only.Get DSA keypair if this key is the correct type.
sourcepub fn ecdsa(&self) -> Option<&EcdsaKeypair>
Available on crate feature ecdsa
only.
pub fn ecdsa(&self) -> Option<&EcdsaKeypair>
ecdsa
only.Get ECDSA private key if this key is the correct type.
sourcepub fn ed25519(&self) -> Option<&Ed25519Keypair>
pub fn ed25519(&self) -> Option<&Ed25519Keypair>
Get Ed25519 private key if this key is the correct type.
sourcepub fn encrypted(&self) -> Option<&[u8]>
Available on crate feature alloc
only.
pub fn encrypted(&self) -> Option<&[u8]>
alloc
only.Get the encrypted ciphertext if this key is encrypted.
sourcepub fn rsa(&self) -> Option<&RsaKeypair>
Available on crate feature alloc
only.
pub fn rsa(&self) -> Option<&RsaKeypair>
alloc
only.Get RSA keypair if this key is the correct type.
sourcepub fn sk_ecdsa_p256(&self) -> Option<&SkEcdsaSha2NistP256>
Available on crate features alloc
and ecdsa
only.
pub fn sk_ecdsa_p256(&self) -> Option<&SkEcdsaSha2NistP256>
alloc
and ecdsa
only.Get FIDO/U2F ECDSA/NIST P-256 private key if this key is the correct type.
sourcepub fn sk_ed25519(&self) -> Option<&SkEd25519>
Available on crate feature alloc
only.
pub fn sk_ed25519(&self) -> Option<&SkEd25519>
alloc
only.Get FIDO/U2F Ed25519 private key if this key is the correct type.
sourcepub fn is_ed25519(&self) -> bool
pub fn is_ed25519(&self) -> bool
Is this key an Ed25519 key?
sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Is this key encrypted?
sourcepub fn is_sk_ecdsa_p256(&self) -> bool
Available on crate features alloc
and ecdsa
only.
pub fn is_sk_ecdsa_p256(&self) -> bool
alloc
and ecdsa
only.Is this key a FIDO/U2F ECDSA/NIST P-256 key?
sourcepub fn is_sk_ed25519(&self) -> bool
Available on crate feature alloc
only.
pub fn is_sk_ed25519(&self) -> bool
alloc
only.Is this key a FIDO/U2F Ed25519 key?
Trait Implementations
sourceimpl Clone for KeypairData
impl Clone for KeypairData
sourcefn clone(&self) -> KeypairData
fn clone(&self) -> KeypairData
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl ConstantTimeEq for KeypairData
Available on crate feature subtle
only.
impl ConstantTimeEq for KeypairData
subtle
only.sourceimpl Debug for KeypairData
impl Debug for KeypairData
sourceimpl Decode for KeypairData
impl Decode for KeypairData
sourceimpl Encode for KeypairData
impl Encode for KeypairData
sourcefn encoded_len(&self) -> Result<usize>
fn encoded_len(&self) -> Result<usize>
sourcefn encode(&self, writer: &mut impl Writer) -> Result<()>
fn encode(&self, writer: &mut impl Writer) -> Result<()>
Writer
.sourcefn encoded_len_prefixed(&self) -> Result<usize, Self::Error>
fn encoded_len_prefixed(&self) -> Result<usize, Self::Error>
uint32
length prefix. Read moresourceimpl From<DsaKeypair> for KeypairData
Available on crate feature alloc
only.
impl From<DsaKeypair> for KeypairData
alloc
only.sourcefn from(keypair: DsaKeypair) -> KeypairData
fn from(keypair: DsaKeypair) -> KeypairData
sourceimpl From<EcdsaKeypair> for KeypairData
Available on crate feature ecdsa
only.
impl From<EcdsaKeypair> for KeypairData
ecdsa
only.sourcefn from(keypair: EcdsaKeypair) -> KeypairData
fn from(keypair: EcdsaKeypair) -> KeypairData
sourceimpl From<Ed25519Keypair> for KeypairData
impl From<Ed25519Keypair> for KeypairData
sourcefn from(keypair: Ed25519Keypair) -> KeypairData
fn from(keypair: Ed25519Keypair) -> KeypairData
sourceimpl From<RsaKeypair> for KeypairData
Available on crate feature alloc
only.
impl From<RsaKeypair> for KeypairData
alloc
only.sourcefn from(keypair: RsaKeypair) -> KeypairData
fn from(keypair: RsaKeypair) -> KeypairData
sourceimpl From<SkEcdsaSha2NistP256> for KeypairData
Available on crate features alloc
and ecdsa
only.
impl From<SkEcdsaSha2NistP256> for KeypairData
alloc
and ecdsa
only.sourcefn from(keypair: SkEcdsaSha2NistP256) -> KeypairData
fn from(keypair: SkEcdsaSha2NistP256) -> KeypairData
sourceimpl From<SkEd25519> for KeypairData
Available on crate feature alloc
only.
impl From<SkEd25519> for KeypairData
alloc
only.sourcefn from(keypair: SkEd25519) -> KeypairData
fn from(keypair: SkEd25519) -> KeypairData
sourceimpl PartialEq<KeypairData> for KeypairData
Available on crate feature subtle
only.
impl PartialEq<KeypairData> for KeypairData
subtle
only.sourceimpl Signer<Signature> for KeypairData
impl Signer<Signature> for KeypairData
sourceimpl TryFrom<&KeypairData> for KeyData
impl TryFrom<&KeypairData> for KeyData
sourceimpl TryFrom<KeypairData> for PrivateKey
impl TryFrom<KeypairData> for PrivateKey
sourcefn try_from(key_data: KeypairData) -> Result<PrivateKey>
fn try_from(key_data: KeypairData) -> Result<PrivateKey>
impl Eq for KeypairData
subtle
only.