== How to fix it in Cryptodome

=== Code examples

include::../../common/fix/code-rationale.adoc[]

==== Noncompliant code example

include::../../common/fix/rsa.adoc[]

[source,python,diff-id=6,diff-type=noncompliant]
----
from Crypto.PublicKey import RSA

key_rsa1024 = RSA.generate(1024) # Noncompliant
----

include::../../common/fix/dsa.adoc[]

[source,python,diff-id=7,diff-type=noncompliant]
----
from Crypto.PublicKey import DSA

key_dsa1024 = DSA.generate(1024) # Noncompliant
----

include::../../common/fix/ec.adoc[]

[source,python,diff-id=8,diff-type=noncompliant]
----
from Crypto.PublicKey import DSA

key_p192 = ECC.generate(curve="secp192r1") # Noncompliant
----

==== Compliant solution

[source,python,diff-id=6,diff-type=compliant]
----
from Crypto.PublicKey import RSA

key_rsa1024 = RSA.generate(3072)
----

[source,python,diff-id=7,diff-type=compliant]
----
from Crypto.PublicKey import DSA

key_dsa1024 = DSA.generate(3072)
----

[source,python,diff-id=8,diff-type=compliant]
----
from Crypto.PublicKey import DSA

key_ed25519 = ECC.generate(curve="ed25519")
----

=== How does this work?

include::../../common/fix/fix.adoc[]

=== Going the extra mile

include::../../common/extra-mile/pre-quantum.adoc[]
