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
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl ConstantTimeEq for KeypairData
Available on crate feature subtle
only.
impl ConstantTimeEq for KeypairData
subtle
only.sourceimpl Debug for KeypairData
impl Debug for KeypairData
sourceimpl 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
Converts to this type from the input type.
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
Converts to this type from the input type.
sourceimpl From<Ed25519Keypair> for KeypairData
impl From<Ed25519Keypair> for KeypairData
sourcefn from(keypair: Ed25519Keypair) -> KeypairData
fn from(keypair: Ed25519Keypair) -> KeypairData
Converts to this type from the input type.
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
Converts to this type from the input type.
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>
Performs the conversion.
impl Eq for KeypairData
subtle
only.Auto Trait Implementations
impl RefUnwindSafe for KeypairData
impl Send for KeypairData
impl Sync for KeypairData
impl Unpin for KeypairData
impl UnwindSafe for KeypairData
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, S> SignerMut<S> for T where
T: Signer<S>,
S: Signature,
impl<T, S> SignerMut<S> for T where
T: Signer<S>,
S: Signature,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more