31 lines
632 B
Plaintext
31 lines
632 B
Plaintext
== How to fix it in Cryptodome
|
|
|
|
=== Code examples
|
|
|
|
include::../../common/fix/code-rationale.adoc[]
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,python,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
from Crypto.Cipher import DES # pycryptodome
|
|
from Cryptodome.Cipher import DES # pycryptodomex
|
|
|
|
cipher = DES.new(key, DES.MODE_OFB) # Noncompliant
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,python,diff-id=1,diff-type=compliant]
|
|
----
|
|
from Crypto.Cipher import AES # pycryptodome
|
|
from Cryptodome.Cipher import AES # pycryptodomex
|
|
|
|
cipher = AES.new(key, AES.MODE_CCM)
|
|
----
|
|
|
|
=== How does this work?
|
|
|
|
include::../../common/fix/strong-cryptography.adoc[]
|
|
|