#[non_exhaustive]pub enum KeypairData {
Dsa(DsaKeypair),
Ecdsa(EcdsaKeypair),
Ed25519(Ed25519Keypair),
Encrypted(Vec<u8>),
Rsa(RsaKeypair),
SkEcdsaSha2NistP256(SkEcdsaSha2NistP256),
SkEd25519(SkEd25519),
Other(OpaqueKeypair),
}
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.
Other(OpaqueKeypair)
alloc
only.Opaque keypair.
Implementations§
source§impl 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 other(&self) -> Option<&OpaqueKeypair>
Available on crate feature alloc
only.
pub fn other(&self) -> Option<&OpaqueKeypair>
alloc
only.Get the custom, opaque 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
Available on crate feature alloc
only.
pub fn is_encrypted(&self) -> bool
alloc
only.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§
source§impl Clone for KeypairData
impl Clone for KeypairData
source§fn clone(&self) -> KeypairData
fn clone(&self) -> KeypairData
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl ConstantTimeEq for KeypairData
impl ConstantTimeEq for KeypairData
source§impl Debug for KeypairData
impl Debug for KeypairData
source§impl Decode for KeypairData
impl Decode for KeypairData
source§impl Encode for KeypairData
impl Encode for KeypairData
source§fn encoded_len(&self) -> Result<usize>
fn encoded_len(&self) -> Result<usize>
source§fn encode(&self, writer: &mut impl Writer) -> Result<()>
fn encode(&self, writer: &mut impl Writer) -> Result<()>
Writer
.source§fn encoded_len_prefixed(&self) -> Result<usize, Error>
fn encoded_len_prefixed(&self) -> Result<usize, Error>
uint32
length prefix.source§fn encode_prefixed(&self, writer: &mut impl Writer) -> Result<(), Error>
fn encode_prefixed(&self, writer: &mut impl Writer) -> Result<(), Error>
uint32
length prefix
set to Encode::encoded_len
.source§impl From<DsaKeypair> for KeypairData
Available on crate feature alloc
only.
impl From<DsaKeypair> for KeypairData
alloc
only.source§fn from(keypair: DsaKeypair) -> KeypairData
fn from(keypair: DsaKeypair) -> KeypairData
source§impl From<EcdsaKeypair> for KeypairData
Available on crate feature ecdsa
only.
impl From<EcdsaKeypair> for KeypairData
ecdsa
only.source§fn from(keypair: EcdsaKeypair) -> KeypairData
fn from(keypair: EcdsaKeypair) -> KeypairData
source§impl From<Ed25519Keypair> for KeypairData
impl From<Ed25519Keypair> for KeypairData
source§fn from(keypair: Ed25519Keypair) -> KeypairData
fn from(keypair: Ed25519Keypair) -> KeypairData
source§impl From<RsaKeypair> for KeypairData
Available on crate feature alloc
only.
impl From<RsaKeypair> for KeypairData
alloc
only.source§fn from(keypair: RsaKeypair) -> KeypairData
fn from(keypair: RsaKeypair) -> KeypairData
source§impl From<SkEcdsaSha2NistP256> for KeypairData
Available on crate features alloc
and ecdsa
only.
impl From<SkEcdsaSha2NistP256> for KeypairData
alloc
and ecdsa
only.source§fn from(keypair: SkEcdsaSha2NistP256) -> KeypairData
fn from(keypair: SkEcdsaSha2NistP256) -> KeypairData
source§impl From<SkEd25519> for KeypairData
Available on crate feature alloc
only.
impl From<SkEd25519> for KeypairData
alloc
only.source§fn from(keypair: SkEd25519) -> KeypairData
fn from(keypair: SkEd25519) -> KeypairData
source§impl PartialEq for KeypairData
impl PartialEq for KeypairData
source§impl Signer<Signature> for KeypairData
Available on crate feature alloc
only.
impl Signer<Signature> for KeypairData
alloc
only.source§impl TryFrom<&KeypairData> for KeyData
impl TryFrom<&KeypairData> for KeyData
source§impl TryFrom<KeypairData> for PrivateKey
impl TryFrom<KeypairData> for PrivateKey
source§fn try_from(key_data: KeypairData) -> Result<PrivateKey>
fn try_from(key_data: KeypairData) -> Result<PrivateKey>
impl Eq for KeypairData
Auto Trait Implementations§
impl Freeze for KeypairData
impl RefUnwindSafe for KeypairData
impl Send for KeypairData
impl Sync for KeypairData
impl Unpin for KeypairData
impl UnwindSafe for KeypairData
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)