Obtaining SSL certificate data.
Very often we as web developers we require to obtain SSL certificate data for certain domain and there is a very useful online service for web developers and SEO professionals on "WhoisXML API" that
provides Domain & IP Data Intelligence for Greater Enterprise Security.
Using it's APIs you can perform many handy data requests, for example you can get SSL certificate data for a certain website.
Output data will contain Audit Date, IP Address, SSL Certificate Chain Details, Domain Name, Port Number and additional SSL Certificate Data.
Python Knowledge Base: Make coding great again.
- Updated:
2024-11-20 by Andrey BRATUS, Senior Data Analyst.
Python code to get any domain SSL certificate data:
Domain SSL certificate data output:
This Python script below will use information from "WhoisXML API" and provide you a result in a JSON format without the need to use a web browser.
Getting domain SSL certificate data can be easily automated now !
# SSL certificate API USE
import requests
website = 'python-code.pro'
APIKEY ='at_ZUVkrukr4Uhhhsfq2j6dyv2VhFGWYV'
sslCertificateInfoURL = f'https://ssl-certificates.whoisxmlapi.com/api/v1?apiKey={APIKEY}&domainName={website}'
r = requests.get(sslCertificateInfoURL)
sslCertificateInfo = r.json()
print(f'SSL Certificate Info for {website} domain.\n')
sslCertificateInfo
SSL Certificate Info for python-code.pro domain.
{'auditCreated': '2022-09-01 10:42:23 UTC',
'domain': 'python-code.pro',
'ip': '89.108.102.163',
'port': 443,
'certificates': [{'chainHierarchy': 'end-user',
'validationType': 'domain',
'validFrom': '2022-08-03 05:51:04 UTC',
'validTo': '2022-11-01 05:51:03 UTC',
'serialNumber': '04:E1:57:D9:2E:79:63:12:DC:D9:D5:B6:42:8B:49:95:F3:06',
'signatureAlgorithm': 'SHA256-RSA',
'subject': {'commonName': 'python-code.pro'},
'issuer': {'country': 'US',
'organization': "Let's Encrypt",
'commonName': 'R3'},
'pem': '-----BEGIN CERTIFICATE-----\nMIIFOTCCBGgAwIBAgISBOFX2S55YxLc2dW2QotJlfMGMA0GCSqGSIb3DQEBCwUA\nMDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD\nEwJSMzAeFw0yMjA4MDMwNTUxMDRaFw0yMjExM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68PR3UhAykC\nIQC4jd9rn/TRiPZmiYcg7ZNlm0v/0XllUUvRUh9hvQie3AB1ACl5vvCeOTkh8FZz\nn2Old+W+V32cYAr4+U1dJlwlXceEAAABgmJ431QAAAQDAEYwRAIgOpP5PBVPHZsN\nZWtOeMmtnM919YmUCo/A9hiJ3bw6Hc4CIFAZ/+7ROi5bG3pIh2R58p1YlwX9g+Oy\nDQuMENadSDQ3MA0GCSqGSIb3DQEBCwUAA4IBAQBd/FaMbljTN0g+xDrLuzz9p3CT\nD4RhsCz023nYqV1GJaCjLqIw9y5HlyqKTwCd80hYOE79UhHTGPk/b67etsmtEJhu\nGwHW/vnmFnLWUwizBxoC2lrksI/wfIC47CN5QIsNAAhzZ5Lj/bVujMBB0g+94zpn\nKjkDSAwD52DUHVwM7Js8abkoadqff0HKJLk5QClthQ8bkwgYyXAtInzmLLbAsvFX\ntPo8I6/sqHdydsrdXCKE2OAfByGaIYSaBrj/ihfReO2OxZcacVIEiZt0RfgMF7Nm\nhbHUPl8eHMdo6mp1ECOpEgdkeRIcagkDtNA2DjSwCDNrf2HTkNsHF3DV6BZI\n-----END CERTIFICATE-----\n',
'extensions': {'authorityKeyIdentifier': '14:2E:B3:17:B7:58:56:CB:AE:50:09:40:E6:1F:AF:9D:8B:14:C2:C6',
'subjectKeyIdentifier': '26:0F:2D:13:05:EA:19:92:9A:E3:EC:4A:0C:B4:E9:68:0A:75:AA:3D',
'keyUsage': ['Digital Signature', 'Key Encipherment'],
'extendedKeyUsage': ['Server Authentication', 'Client Authentication'],
'authorityInfoAccess': {'issuers': ['http://r3.i.lencr.org/'],
'ocsp': ['http://r3.o.lencr.org']},
'subjectAlternativeNames': {'dnsNames': ['python-code.pro',
'www.python-code.pro']},
'certificatePolicies': [{'policyIdentifier': '2.23.140.1.2.1',
'policyQualifiers': None},
{'policyIdentifier': '1.3.6.1.4.1.44947.1.1.1',
'policyQualifiers': [{'policyQualifierId': '1.3.6.1.5.5.7.2.1',
'cpsUri': 'http://cps.letsencrypt.org'}]}]},
'publicKey': {'type': 'RSA',
'bits': 2048,
'pem': '-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAOCAQ8AMIIBCgKCAQEAsCejvOt1jPdeS64idUh+\n1mRw9bMz9Rkgok48F2pWj+f71pk9fyFwuwPy2cJPIORU2xReRfciUFZQjnniLtUP\nDjZtR7ZM/XwgGPMG2PlJnZbaiEoIfD7NjqmGhOD+NN/djx6GfhpvhDqSQ/4Uqriz\nArhruBU8Vo1SYr8jF+17E1YgdIRvqseylYUC5iS7jr0YPS6PT8KtY5HirgK830vb\ncDBn5On8F7kpCCxzCvkgn3kI0lQx5WaD8fC7JeUGW47r9ykd+CxVEZzfnLl8bONa\nsNA931AhAfuxqmj/SvhvCn5jbsy18HwbsQJuoU/qKLN6D/kzESiVWwWqziXNv43d\n/wIDAQAB\n-----END PUBLIC KEY-----\n'}}]}