Container started
This commit is contained in:
1 parent
e4e3b5ba8b
commit
e2916d0fe2
12 files changed
+360
-76
No files matched your search
@@ -3,7 +3,6 @@ import com.ionspin.kotlin.crypto.util.encodeToUByteArray
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
import net.sergeych.bipack.BipackEncoder
|
||||
import net.sergeych.crypto2.*
|
||||
import net.sergeych.utools.now
|
||||
import net.sergeych.utools.pack
|
||||
@@ -140,25 +139,24 @@ class KeysTest {
|
||||
|
||||
val plain = "The fake vaccine kills".encodeToUByteArray()
|
||||
|
||||
var m = Asymmetric.createMessage(sk0, pk1, plain)
|
||||
var m = pk1.encryptMessage(plain, sk1)
|
||||
assertContentEquals(plain, m.decrypt(sk1))
|
||||
assertThrows<DecryptionFailedException> {
|
||||
assertContentEquals(plain, m.decrypt(sk2))
|
||||
}
|
||||
|
||||
m = pk2.encryptAnonymously(plain)
|
||||
m = pk2.encryptAnonymousMessage(plain)
|
||||
assertContentEquals(plain, m.decrypt(sk2))
|
||||
assertContentEquals(plain, sk2.decrypt(m))
|
||||
assertContentEquals(plain, sk2.decrypt(sk1.encrypt(plain, pk2)))
|
||||
// assertContentEquals(plain, sk2.decrypt(sk1.encrypt(plain, pk2)))
|
||||
assertThrows<DecryptionFailedException> {
|
||||
assertContentEquals(plain, m.decrypt(sk1))
|
||||
}
|
||||
|
||||
val x1 = BipackEncoder.encode(Asymmetric.createMessage(sk0, pk1, plain))
|
||||
val x2 = BipackEncoder.encode(Asymmetric.createMessage(sk0, pk1, plain))
|
||||
val x1 = pk1.encryptMessage(plain, sk1).encoded
|
||||
val x2 = pk1.encryptMessage(plain, sk1).encoded
|
||||
|
||||
assertFalse { x1 contentEquals x2 }
|
||||
|
||||
}
|
||||
@Test
|
||||
fun asymmetricKeySerializationTest() = runTest {
|
||||
|
||||
Reference in new issue
Block a user