def _get_primary_cn(tls_cert): """Retrieve primary cn for TLS certificate :param tls_cert: the TLS certificate :returns: primary cn of the TLS certificate """ return cert_parser.get_host_names(tls_cert)['cn']
def test_alt_subject_name_parses(self): hosts = cert_parser.get_host_names(ALT_EXT_CRT) self.assertEqual('www.cnfromsubject.org', hosts['cn']) self.assertEqual('www.hostfromdnsname1.com', hosts['dns_names'][0]) self.assertEqual('www.hostfromdnsname2.com', hosts['dns_names'][1]) self.assertEqual('www.hostfromdnsname3.com', hosts['dns_names'][2]) self.assertEqual('www.hostfromdnsname4.com', hosts['dns_names'][3])
def test_alt_subject_name_parses(self): hosts = cert_parser.get_host_names(ALT_EXT_CRT) self.assertEqual(hosts['cn'], 'www.CNFromSubject.org') self.assertEqual(hosts['dns_names'][0], 'www.hostFrom_dNSName1.com') self.assertEqual(hosts['dns_names'][1], 'www.hostFrom_dNSName2.com') self.assertEqual(hosts['dns_names'][2], 'www.hostFrom_dNSName3.com') self.assertEqual(hosts['dns_names'][3], 'www.hostFrom_dNSName4.com')
def test_alt_subject_name_parses(self): hosts = cert_parser.get_host_names(ALT_EXT_CRT) self.assertEqual("www.CNFromSubject.org", hosts["cn"]) self.assertEqual("www.hostFrom_dNSName1.com", hosts["dns_names"][0]) self.assertEqual("www.hostFrom_dNSName2.com", hosts["dns_names"][1]) self.assertEqual("www.hostFrom_dNSName3.com", hosts["dns_names"][2]) self.assertEqual("www.hostFrom_dNSName4.com", hosts["dns_names"][3])
def _get_primary_cn(self, tls_cert): """Returns primary CN for Certificate.""" return cert_parser.get_host_names(tls_cert.get_certificate())['cn']