def test_dnsnames_non_unicode_match(self): certificate = cert_with_urls(NON_UNICODE_TLD) check = dnsnames.CheckTldMatches() result = check.check(certificate) self.assertIn(dnsnames.NonUnicodeAddress().description, ''.join([obs.description for obs in result])) self.assertEqual(len(result), 1)
def test_dnsnames_no_tld_match(self): certificate = cert_with_urls(NOT_TLD) check = dnsnames.CheckTldMatches() result = check.check(certificate) self.assertIn(dnsnames.NoTldMatch().description, ''.join([obs.description for obs in result]))
def test_dnsnames_tld_match(self): certificate = cert_with_urls(EXAMPLE) check = dnsnames.CheckTldMatches() result = check.check(certificate) self.assertEqual(len(result), 0)
def test_dnsnames_wildcard_tld_match(self): certificate = cert_with_urls(WILDCARD_TLD) check = dnsnames.CheckTldMatches() result = check.check(certificate) self.assertIn(dnsnames.GenericWildcard().description, ''.join([obs.description for obs in result]))
from ct.cert_analysis import common_name from ct.cert_analysis import crl_pointers from ct.cert_analysis import dnsnames from ct.cert_analysis import extensions from ct.cert_analysis import ip_addresses from ct.cert_analysis import ocsp_pointers from ct.cert_analysis import serial_number from ct.cert_analysis import validity ALL_CHECKS = [serial_number.CheckNegativeSerialNumber(), validity.CheckValidityNotBeforeFuture(), validity.CheckValidityCorrupt(), validity.CheckIsExpirationDateWellDefined(), dnsnames.CheckValidityOfDnsnames(), dnsnames.CheckCorruptSANExtension(), dnsnames.CheckTldMatches(), common_name.CheckSCNTldMatches(), common_name.CheckLackOfSubjectCommonName(), common_name.CheckCorruptSubjectCommonName(), extensions.CheckCorrectExtensions(), ip_addresses.CheckPrivateIpAddresses(), ip_addresses.CheckCorruptIpAddresses(), algorithm.CheckSignatureAlgorithmsMismatch(), algorithm.CheckCertificateAlgorithmSHA1After2017(), algorithm.CheckTbsCertificateAlgorithmSHA1Ater2017(), ca_field.CheckCATrue(), ocsp_pointers.CheckOcspExistence(), ocsp_pointers.CheckCorruptOrMultipleAiaExtension(), crl_pointers.CheckCrlExistence(), crl_pointers.CheckCorruptOrMultipleCrlExtension(),]