include::../description.adoc[]

== Noncompliant Code Example

----
val keyPairGen1 = KeyPairGenerator.getInstance("RSA")
keyPairGen1.initialize(1024) // Noncompliant

val keyPairGen5 = KeyPairGenerator.getInstance("EC")
val ecSpec1 = ECGenParameterSpec("secp112r1") // Noncompliant
keyPairGen5.initialize(ecSpec1)

val keyGen1 = KeyGenerator.getInstance("AES")
keyGen1.init(64) // Noncompliant
----

== Compliant Solution

----
val keyPairGen6 = KeyPairGenerator.getInstance("RSA")
keyPairGen6.initialize(2048) // Compliant

val keyPairGen5 = KeyPairGenerator.getInstance("EC")
val ecSpec1 = ECGenParameterSpec("secp256r1") // Compliant
keyPairGen5.initialize(ecSpec1)

val keyGen2 = KeyGenerator.getInstance("AES")
keyGen2.init(128) // Compliant
----

include::../see.adoc[]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
