2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2021-09-24 14:44:46 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
=== Noncompliant code example
|
2021-09-24 14:44:46 +02:00
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,kotlin]
|
2021-09-24 14:44:46 +02:00
|
|
|
----
|
|
|
|
val sr = SecureRandom()
|
|
|
|
sr.setSeed(123456L) // Noncompliant
|
|
|
|
val v = sr.nextInt()
|
|
|
|
----
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,kotlin]
|
2021-09-24 14:44:46 +02:00
|
|
|
----
|
|
|
|
val sr = SecureRandom("abcdefghijklmnop".toByteArray(charset("us-ascii"))) // Noncompliant
|
|
|
|
val v = sr.nextInt()
|
|
|
|
----
|
|
|
|
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
=== Compliant solution
|
2021-09-24 14:44:46 +02:00
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,kotlin]
|
2021-09-24 14:44:46 +02:00
|
|
|
----
|
|
|
|
val sr = SecureRandom()
|
|
|
|
val v = sr.nextInt()
|
|
|
|
----
|
|
|
|
|
|
|
|
|
2021-11-01 15:00:32 +01:00
|
|
|
include::../see.adoc[]
|
2021-09-24 14:44:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
endif::env-github,rspecator-view[]
|