PBKD with tests. Some improvements in keys listing
This commit is contained in:
1 parent
46a8b5bc06
commit
9efa763b45
10 files changed
+94
-51
No files matched your search
@@ -1,9 +1,36 @@
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import net.sergeych.crypto2.PBKD
|
||||
import net.sergeych.crypto2.initCrypto
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class PBKDTest {
|
||||
|
||||
@Test
|
||||
fun testDerive() {
|
||||
fun testDerive() = runTest {
|
||||
initCrypto()
|
||||
val (k1, k2, k3) = PBKD.deriveMultipleKeys("foobar", 3)
|
||||
PBKD.clearCache()
|
||||
println(k1)
|
||||
println(k2)
|
||||
println(k3)
|
||||
// println("------------------- Secret ket encryption!")
|
||||
// val s = UniversalKey.newSecretKey()
|
||||
// println(s)
|
||||
// println(s.publicKey)
|
||||
// println("------------------- public key signing")
|
||||
// val i = UniversalKey.newSigningKey()
|
||||
// println(i)
|
||||
// println(i.verifyingKey)
|
||||
// println("------------------- symmetric")
|
||||
// println(UniversalKey.newSymmetricKey())
|
||||
for( k in listOf(k1,k2,k3)) {
|
||||
val i = k.id
|
||||
val kx = i.kdp!!.deriveKey("foobar")
|
||||
assertEquals(k, kx)
|
||||
assertEquals(i, kx.id)
|
||||
assertEquals(i.kdp, kx.id.kdp)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user