ssl.cert_time_to_seconds
Prev: ssl.AlertDescription | Up: ssl | Next: ssl.CertificateError
Rel: ssl.AlertDescription, ssl.CertificateError, ssl.create_connection, ssl.create_default_context
Ref: docs.python.org — ssl.cert_time_to_seconds
Tags: #public #python3 #stdlib #ssl
Import
import ssl
from ssl import cert_time_to_seconds
Signature & Overview
ssl.cert_time_to_seconds(cert_time)
Return the time in seconds since the Epoch, given the timestring representing the "notBefore" or "notAfter" date from a certificate in "%b %d %H:%M:%S %Y %Z" strptime format (C locale).
Usage
import ssl
ts = ssl.cert_time_to_seconds("Jan 1 00:00:00 2026 GMT")
assert isinstance(ts, int) and ts > 1_700_000_000
Gotchas
- Parses
notBefore/notAfterstrings fromssock.getpeercert()into Unix epoch seconds (UTC).
REPL Inspect
from ssl import cert_time_to_seconds
help(cert_time_to_seconds)
Linked from
- tuts/python3/stdlib_module/ssl
- tuts/python3/stdlib_module/ssl/AlertDescription
- tuts/python3/stdlib_module/ssl/CertificateError
- tuts/python3/stdlib_module/ssl/create_connection
- tuts/python3/stdlib_module/ssl/create_default_context
- tuts/python3/stdlib_module/ssl/DefaultVerifyPaths
- tuts/python3/stdlib_module/ssl/DER_cert_to_PEM_cert
- tuts/python3/stdlib_module/ssl/get_default_verify_paths
- tuts/python3/stdlib_module/ssl/get_protocol_name
- tuts/python3/stdlib_module/ssl/get_server_certificate
- tuts/python3/stdlib_module/ssl/MemoryBIO
- tuts/python3/stdlib_module/ssl/namedtuple
- tuts/python3/stdlib_module/ssl/Options
- tuts/python3/stdlib_module/ssl/PEM_cert_to_DER_cert
- tuts/python3/stdlib_module/ssl/Purpose
- tuts/python3/stdlib_module/ssl/RAND_add
- tuts/python3/stdlib_module/ssl/RAND_bytes
- tuts/python3/stdlib_module/ssl/RAND_status
- tuts/python3/stdlib_module/ssl/socket
- tuts/python3/stdlib_module/ssl/socket_error
- tuts/python3/stdlib_module/ssl/SSLCertVerificationError
- tuts/python3/stdlib_module/ssl/SSLContext
- tuts/python3/stdlib_module/ssl/SSLEOFError
- tuts/python3/stdlib_module/ssl/SSLError
- tuts/python3/stdlib_module/ssl/SSLErrorNumber
- tuts/python3/stdlib_module/ssl/SSLObject
- tuts/python3/stdlib_module/ssl/SSLSession
- tuts/python3/stdlib_module/ssl/SSLSocket
- tuts/python3/stdlib_module/ssl/SSLSyscallError
- tuts/python3/stdlib_module/ssl/SSLWantReadError
- tuts/python3/stdlib_module/ssl/SSLWantWriteError
- tuts/python3/stdlib_module/ssl/SSLZeroReturnError
Related notes
- tuts/python3/stdlib_module/ssl/AlertDescription Linked here; links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/CertificateError Linked here; links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/create_connection Linked here; links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/create_default_context Linked here; links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/ssl/DefaultVerifyPaths links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/DER_cert_to_PEM_cert links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/get_default_verify_paths links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/get_protocol_name links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/get_server_certificate links to this page; shared tags: #ssl, #stdlib