#[non_exhaustive]pub enum KeyData {
Dsa(DsaPublicKey),
Ecdsa(EcdsaPublicKey),
Ed25519(Ed25519PublicKey),
Rsa(RsaPublicKey),
MlDsa44Ed25519(MlDsa44Ed25519PublicKey),
MlDsa87P384(MlDsa87P384PublicKey),
SkEcdsaSha2NistP256(SkEcdsaSha2NistP256),
SkEd25519(SkEd25519),
Certificate(Box<Certificate>),
Other(OpaquePublicKey),
}Expand description
Public key data.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Dsa(DsaPublicKey)
alloc only.Digital Signature Algorithm (DSA) public key data.
Ecdsa(EcdsaPublicKey)
ecdsa only.Elliptic Curve Digital Signature Algorithm (ECDSA) public key data.
Ed25519(Ed25519PublicKey)
Ed25519 public key data.
Rsa(RsaPublicKey)
alloc only.RSA public key data.
MlDsa44Ed25519(MlDsa44Ed25519PublicKey)
ed25519 and mldsa only.MLDSA44-Ed25519 public key data.
MlDsa87P384(MlDsa87P384PublicKey)
mldsa and p384 only.MLDSA87-P384 public key data.
SkEcdsaSha2NistP256(SkEcdsaSha2NistP256)
ecdsa only.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.
Certificate(Box<Certificate>)
alloc only.Certificate key as specified in draft-ietf-sshm-cert.
Other(OpaquePublicKey)
alloc only.Opaque public key data.
Implementations§
Source§impl KeyData
impl KeyData
Sourcepub fn dsa(&self) -> Option<&DsaPublicKey>
Available on crate feature alloc only.
pub fn dsa(&self) -> Option<&DsaPublicKey>
alloc only.Get DSA public key if this key is the correct type.
Sourcepub fn ecdsa(&self) -> Option<&EcdsaPublicKey>
Available on crate feature ecdsa only.
pub fn ecdsa(&self) -> Option<&EcdsaPublicKey>
ecdsa only.Get ECDSA public key if this key is the correct type.
Sourcepub fn ed25519(&self) -> Option<&Ed25519PublicKey>
pub fn ed25519(&self) -> Option<&Ed25519PublicKey>
Get Ed25519 public key if this key is the correct type.
Sourcepub fn fingerprint(&self, hash_alg: HashAlg) -> Fingerprint
Available on crate feature sha2 only.
pub fn fingerprint(&self, hash_alg: HashAlg) -> Fingerprint
sha2 only.Compute key fingerprint.
Use Default::default() to use the default hash function (SHA-256).
Sourcepub fn rsa(&self) -> Option<&RsaPublicKey>
Available on crate feature alloc only.
pub fn rsa(&self) -> Option<&RsaPublicKey>
alloc only.Get RSA public key if this key is the correct type.
Sourcepub fn mldsa44_ed25519(&self) -> Option<&MlDsa44Ed25519PublicKey>
Available on crate features ed25519 and mldsa only.
pub fn mldsa44_ed25519(&self) -> Option<&MlDsa44Ed25519PublicKey>
ed25519 and mldsa only.Get MLDSA44-Ed25519 public key if this key is the correct type.
Sourcepub fn mldsa87_p384(&self) -> Option<&MlDsa87P384PublicKey>
Available on crate features mldsa and p384 only.
pub fn mldsa87_p384(&self) -> Option<&MlDsa87P384PublicKey>
mldsa and p384 only.Get MLDSA87-P384 public key if this key is the correct type.
Sourcepub fn sk_ecdsa_p256(&self) -> Option<&SkEcdsaSha2NistP256>
Available on crate feature ecdsa only.
pub fn sk_ecdsa_p256(&self) -> Option<&SkEcdsaSha2NistP256>
ecdsa only.Get FIDO/U2F ECDSA/NIST P-256 public key if this key is the correct type.
Sourcepub fn sk_ed25519(&self) -> Option<&SkEd25519>
pub fn sk_ed25519(&self) -> Option<&SkEd25519>
Get FIDO/U2F Ed25519 public key if this key is the correct type.
Sourcepub fn other(&self) -> Option<&OpaquePublicKey>
Available on crate feature alloc only.
pub fn other(&self) -> Option<&OpaquePublicKey>
alloc only.Get the custom, opaque public key if this key is the correct type.
Sourcepub fn certificate(&self) -> Option<&Certificate>
Available on crate feature alloc only.
pub fn certificate(&self) -> Option<&Certificate>
alloc only.Get the certificate if this key is the correct type.
Sourcepub fn into_certificate(self) -> Option<Certificate>
Available on crate feature alloc only.
pub fn into_certificate(self) -> Option<Certificate>
alloc only.Get the certificate, consuming the KeyData, 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_mldsa44_ed25519(&self) -> bool
Available on crate features ed25519 and mldsa only.
pub fn is_mldsa44_ed25519(&self) -> bool
ed25519 and mldsa only.Is this key an ML-DSA key?
Sourcepub fn is_mldsa87_p384(&self) -> bool
Available on crate features mldsa and p384 only.
pub fn is_mldsa87_p384(&self) -> bool
mldsa and p384 only.Is this key an ML-DSA-87/P-384 composite key?
Sourcepub fn is_sk_ecdsa_p256(&self) -> bool
Available on crate feature ecdsa only.
pub fn is_sk_ecdsa_p256(&self) -> bool
ecdsa only.Is this key a FIDO/U2F ECDSA/NIST P-256 key?
Sourcepub fn is_sk_ed25519(&self) -> bool
pub fn is_sk_ed25519(&self) -> bool
Is this key a FIDO/U2F Ed25519 key?
Sourcepub fn is_other(&self) -> bool
Available on crate feature alloc only.
pub fn is_other(&self) -> bool
alloc only.Is this a key with a custom algorithm?
Sourcepub fn is_certificate(&self) -> bool
Available on crate feature alloc only.
pub fn is_certificate(&self) -> bool
alloc only.Is this a certificate?
Sourcepub fn decode_as(
reader: &mut Decoder<impl Reader>,
algorithm: Algorithm,
) -> Result<Self>
pub fn decode_as( reader: &mut Decoder<impl Reader>, algorithm: Algorithm, ) -> Result<Self>
Decode KeyData for the specified algorithm.
§Errors
- Returns
Error::AlgorithmUnknownif the providedalgorithmis unknown or unsupported by this library. - Returns
Error::Encodingin the event of an encoding error.
Sourcepub fn decode_as_certificate(
reader: &mut Decoder<impl Reader>,
algorithm: Algorithm,
) -> Result<Self>
Available on crate feature alloc only.
pub fn decode_as_certificate( reader: &mut Decoder<impl Reader>, algorithm: Algorithm, ) -> Result<Self>
alloc only.Decode KeyData as a certificate with the specified algorithm.
§Errors
Propagates errors from Certificate::decode_as.
Trait Implementations§
Source§impl Encode for KeyData
impl Encode for KeyData
Source§fn encoded_len(&self) -> Result<usize>
fn encoded_len(&self) -> Result<usize>
Source§fn encoded_len_prefixed(&self) -> Result<usize, Error>
fn encoded_len_prefixed(&self) -> Result<usize, Error>
uint32 length prefix. Read moreimpl Eq for KeyData
Source§impl From<&PrivateKey> for KeyData
impl From<&PrivateKey> for KeyData
Source§fn from(private_key: &PrivateKey) -> KeyData
fn from(private_key: &PrivateKey) -> KeyData
Source§impl From<Certificate> for KeyData
Available on crate feature alloc only.
impl From<Certificate> for KeyData
alloc only.Source§fn from(certificate: Certificate) -> KeyData
fn from(certificate: Certificate) -> KeyData
Source§impl From<DsaPublicKey> for KeyData
Available on crate feature alloc only.
impl From<DsaPublicKey> for KeyData
alloc only.Source§fn from(public_key: DsaPublicKey) -> KeyData
fn from(public_key: DsaPublicKey) -> KeyData
Source§impl From<EcdsaPublicKey> for KeyData
Available on crate feature ecdsa only.
impl From<EcdsaPublicKey> for KeyData
ecdsa only.Source§fn from(public_key: EcdsaPublicKey) -> KeyData
fn from(public_key: EcdsaPublicKey) -> KeyData
Source§impl From<Ed25519PublicKey> for KeyData
impl From<Ed25519PublicKey> for KeyData
Source§fn from(public_key: Ed25519PublicKey) -> KeyData
fn from(public_key: Ed25519PublicKey) -> KeyData
Source§impl From<MlDsa44Ed25519PublicKey> for KeyData
Available on crate features ed25519 and mldsa only.
impl From<MlDsa44Ed25519PublicKey> for KeyData
ed25519 and mldsa only.Source§fn from(public_key: MlDsa44Ed25519PublicKey) -> KeyData
fn from(public_key: MlDsa44Ed25519PublicKey) -> KeyData
Source§impl From<MlDsa87P384PublicKey> for KeyData
Available on crate features mldsa and p384 only.
impl From<MlDsa87P384PublicKey> for KeyData
mldsa and p384 only.Source§fn from(public_key: MlDsa87P384PublicKey) -> KeyData
fn from(public_key: MlDsa87P384PublicKey) -> KeyData
Source§impl From<PrivateKey> for KeyData
impl From<PrivateKey> for KeyData
Source§fn from(private_key: PrivateKey) -> KeyData
fn from(private_key: PrivateKey) -> KeyData
Source§impl From<RsaPublicKey> for KeyData
Available on crate feature alloc only.
impl From<RsaPublicKey> for KeyData
alloc only.Source§fn from(public_key: RsaPublicKey) -> KeyData
fn from(public_key: RsaPublicKey) -> KeyData
Source§impl From<SkEcdsaSha2NistP256> for KeyData
Available on crate feature ecdsa only.
impl From<SkEcdsaSha2NistP256> for KeyData
ecdsa only.