From 2934350485f1a5f00e99d0f2f024894b5544e5cd Mon Sep 17 00:00:00 2001 From: Johann150 Date: Fri, 26 Mar 2021 12:48:34 +0100 Subject: [PATCH] add function to check for cert of a domain --- src/certificates.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/certificates.rs b/src/certificates.rs index 766de30..a76c624 100644 --- a/src/certificates.rs +++ b/src/certificates.rs @@ -206,6 +206,12 @@ impl CertStore { Ok(Self { certs }) } + + /// Checks if a certificate fitting a specific domain has been loaded. + /// The same rules about using a certificate at the level above apply. + pub fn has_domain(&self, domain: &str) -> bool { + self.certs.iter().any(|(s, _)| domain.ends_with(s)) + } } impl ResolvesServerCert for CertStore {