
* Use recommended helper method in compliant solution * Change minimal version to TLSv1.2 (to match other languages)
27 lines
487 B
Plaintext
27 lines
487 B
Plaintext
== How to fix it in Python Standard Library
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,python,diff-id=21,diff-type=noncompliant]
|
|
----
|
|
import ssl
|
|
|
|
ssl.SSLContext(ssl.PROTOCOL_SSLv3) # Noncompliant
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,python,diff-id=21,diff-type=compliant]
|
|
----
|
|
import ssl
|
|
|
|
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
|
context.minimum_version = ssl.TLSVersion.TLSv1_2
|
|
----
|
|
|
|
=== How does this work?
|
|
|
|
include::../../common/fix/fix.adoc[]
|