On this page
ssl.Purpose
Prev: ssl.PEM_cert_to_DER_cert | Up: ssl | Next: ssl.RAND_add
Rel: ssl.AlertDescription, ssl.cert_time_to_seconds, ssl.CertificateError, ssl.create_connection
Ref: docs.python.org — ssl.Purpose
Tags: #public #python3 #stdlib #ssl
Import
import ssl
from ssl import Purpose
Signature & Overview
ssl.Purpose(*values)
SSLContext purpose flags with X509v3 Extended Key Usage objects
Methods & Attributes
Purpose.count(self, value, /)— Return number of occurrences of value.Purpose.fromname(name)— Create _ASN1Object from short name, long name or OIDPurpose.fromnid(nid)— Create _ASN1Object from OpenSSL numeric IDPurpose.index(self, value, start=0, stop=9223372036854775807, /)— Return first index of value.
Usage
import ssl
ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
assert ctx.check_hostname is True
Gotchas
SERVER_AUTHvsCLIENT_AUTH: PassPurpose.SERVER_AUTHwhen you are the client authenticating a server, andPurpose.CLIENT_AUTHwhen you are a server authenticating clients.
REPL Inspect
from ssl import Purpose
help(Purpose)
Linked from
Related notes
- tuts/python3/stdlib_module/ssl/PEM_cert_to_DER_cert Linked here; links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/RAND_add 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/AlertDescription Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/cert_time_to_seconds Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/CertificateError Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/create_connection Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/create_default_context shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/DefaultVerifyPaths shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/DER_cert_to_PEM_cert shared tags: #ssl, #stdlib