== How to fix it in Core PHP

=== Code examples

==== Noncompliant code example

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

[source,php,diff-id=1,diff-type=noncompliant]
----
$config = [
    "digest_alg"       => "sha512",
    "private_key_bits" => 1024,                 // Noncompliant
    "private_key_type" => OPENSSL_KEYTYPE_RSA,
];

$res = openssl_pkey_new($config);
----

==== Compliant solution

[source,php,diff-id=1,diff-type=compliant]
----
$config = [
    "digest_alg"       => "sha512",
    "private_key_bits" => 2048,
    "private_key_type" => OPENSSL_KEYTYPE_RSA,
];

$res = openssl_pkey_new($config);
----

=== How does this work?

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

=== Going the extra mile

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