#[non_exhaustive]pub enum KeyData {
Dsa(DsaPublicKey),
Ecdsa(EcdsaPublicKey),
Ed25519(Ed25519PublicKey),
Rsa(RsaPublicKey),
SkEcdsaSha2NistP256(SkEcdsaSha2NistP256),
SkEd25519(SkEd25519),
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.
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.
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
pub fn fingerprint(&self, hash_alg: HashAlg) -> Fingerprint
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 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 is_ed25519(&self) -> bool
pub fn is_ed25519(&self) -> bool
Is this key an Ed25519 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?
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 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<&PrivateKey> for KeyData
impl From<&PrivateKey> for KeyData
source§fn from(private_key: &PrivateKey) -> KeyData
fn from(private_key: &PrivateKey) -> 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<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.source§fn from(public_key: SkEcdsaSha2NistP256) -> KeyData
fn from(public_key: SkEcdsaSha2NistP256) -> KeyData
source§impl Ord for KeyData
impl Ord for KeyData
source§impl PartialOrd for KeyData
impl PartialOrd for KeyData
source§impl TryFrom<&KeypairData> for KeyData
impl TryFrom<&KeypairData> for KeyData
impl Eq for KeyData
impl StructuralPartialEq for KeyData
Auto Trait Implementations§
impl Freeze for KeyData
impl RefUnwindSafe for KeyData
impl Send for KeyData
impl Sync for KeyData
impl Unpin for KeyData
impl UnwindSafe for KeyData
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
)