Trait RpkValidator

Source
pub trait RpkValidator {
    // Required method
    fn validate_rpk(
        &self,
        asn1_public_key: &[u8],
        session: &CoapSession<'_>,
        validated: bool,
    ) -> bool;
}
Expand description

Trait for types that can validate that a raw public key is the one expected for a given peer.

Required Methods§

Source

fn validate_rpk( &self, asn1_public_key: &[u8], session: &CoapSession<'_>, validated: bool, ) -> bool

Validates the raw public key of a peer.

This function is provided with the public key (asn1_public_key), the respective session, and the TLS library’s validated status, and should return true if the connection is to be accepted and false if the connection should be aborted.

asn1_encoded_key should be the certificate structure defined in RFC 7250, section 3, which you might be able to parse with crates like x509-cert and spki to obtain and match the SubjectPublicKeyInformation encoded within.

See the libcoap documentation for more information.

Implementors§

Source§

impl<T: Fn(&[u8], &CoapSession<'_>, bool) -> bool> RpkValidator for T