Trait PkiCnValidator

Source
pub trait PkiCnValidator {
    // Required method
    fn validate_cn(
        &self,
        cn: &CStr,
        asn1_public_cert: &[u8],
        session: &CoapSession<'_>,
        depth: c_uint,
        validated: bool,
    ) -> bool;
}
Expand description

Trait for types that can check whether a peer’s or CA certificate’s common name is allowed/as expected for a session.

Required Methods§

Source

fn validate_cn( &self, cn: &CStr, asn1_public_cert: &[u8], session: &CoapSession<'_>, depth: c_uint, validated: bool, ) -> bool

Validates the common name of a peer or intermediate certificate.

Aside from the common name given as cn, this function is also provided with the raw bytes of the ASN.1/DER encoded public certificate (asn1_public_cert), the respective session, the TLS library’s validated status and the current depth that should be validated.

depth will be 0 for the peer’s certificate, and larger than 0 for a CA certificate.

Should return true if the connection is to be accepted and false if the connection should be aborted.

See the libcoap documentation for more background information.

Implementors§

Source§

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