pub trait PublicKey {
    // Required methods
    fn public_bytes(&self) -> &[u8] ;
    fn verify(
        &self,
        algorithm: Algorithm,
        message: &[u8],
        signature: &[u8]
    ) -> ProtoResult<()>;
}
Available on crate feature dnssec only.
Expand description

PublicKeys implement the ability to ideally be zero copy abstractions over public keys for verifying signed content.

In DNS the KEY and DNSKEY types are generally the RData types which store public key material.

Required Methods§

source

fn public_bytes(&self) -> &[u8]

Returns the public bytes of the public key, in DNS format

source

fn verify( &self, algorithm: Algorithm, message: &[u8], signature: &[u8] ) -> ProtoResult<()>

Verifies the hash matches the signature with the current key.

Arguments
  • message - the message to be validated, see hash_rrset
  • signature - the signature to use to verify the hash, extracted from an RData::RRSIG for example.
Return value

True if and only if the signature is valid for the hash. This will always return false if the key.

Implementors§

source§

impl PublicKey for PublicKeyBuf

source§

impl PublicKey for Ec

Available on crate feature ring only.
source§

impl<'k> PublicKey for PublicKeyEnum<'k>

source§

impl<'k> PublicKey for Ed25519<'k>

source§

impl<'k> PublicKey for Rsa<'k>