@@ -10,7 +10,6 @@ import java.io.ByteArrayInputStream
1010import java.io.ByteArrayOutputStream
1111import java.io.InputStream
1212import java.security.SecureRandom
13- import java.util.Random
1413import kage.crypto.scrypt.ScryptIdentity
1514import kage.crypto.scrypt.ScryptRecipient
1615import kage.crypto.stream.EncryptOutputStream.Companion.CHUNK_SIZE
@@ -104,7 +103,7 @@ class AgeTest {
104103
105104 // Encrypt exactly 2 chunks
106105 val i = ByteArray (CHUNK_SIZE * 2 )
107- Random ().nextBytes(i)
106+ SecureRandom ().nextBytes(i)
108107
109108 val bais = ByteArrayInputStream (i)
110109 val baos = ByteArrayOutputStream ()
@@ -123,9 +122,9 @@ class AgeTest {
123122 fun testScryptEncryptDecryptExactBlock () {
124123 val (recipient, identity) = genX25519Identity()
125124
126- // Encrypt exactly 1 chunks
125+ // Encrypt exactly 1 chunk
127126 val i = ByteArray (CHUNK_SIZE )
128- Random ().nextBytes(i)
127+ SecureRandom ().nextBytes(i)
129128
130129 val bais = ByteArrayInputStream (i)
131130 val baos = ByteArrayOutputStream ()
@@ -170,7 +169,7 @@ class AgeTest {
170169 val (otherRecipient, otherIdentity) = genX25519Identity()
171170
172171 val payload = ByteArray (1023 )
173- Random ().nextBytes(payload)
172+ SecureRandom ().nextBytes(payload)
174173
175174 val bais = ByteArrayInputStream (payload)
176175 val ageFile = Age .encrypt(listOf (otherRecipient, recipient), bais)
@@ -188,7 +187,7 @@ class AgeTest {
188187 val (_, otherIdentity) = genX25519Identity()
189188
190189 val payload = ByteArray (1023 )
191- Random ().nextBytes(payload)
190+ SecureRandom ().nextBytes(payload)
192191
193192 val bais = ByteArrayInputStream (payload)
194193 val ageFile = Age .encrypt(listOf (recipient), bais)
@@ -203,7 +202,7 @@ class AgeTest {
203202 val scryptRecipient = ScryptRecipient (" mypass1" .toByteArray())
204203
205204 val payload = ByteArray (1023 )
206- Random ().nextBytes(payload)
205+ SecureRandom ().nextBytes(payload)
207206
208207 val bais = ByteArrayInputStream (payload)
209208
0 commit comments