Added rekey and keygen to secretstream

This commit is contained in:
Ugljesa Jovanovic authored and Ugljesa Jovanovic committed 2020-08-29 17:25:59 +02:00
1 parent 91cd41c8c1
commit d5b1e7f7f3
5 files changed
+49 -2

No files matched your search

@@ -11,11 +11,22 @@ data class SecretStreamStateAndHeader(val state: SecretStreamState, val header :
data class DecryptedDataAndTag(val decryptedData : UByteArray, val tag : UByte)
val crypto_secretstream_xchacha20poly1305_TAG_MESSAGE = 0
val crypto_secretstream_xchacha20poly1305_TAG_PUSH = 1
val crypto_secretstream_xchacha20poly1305_TAG_REKEY = 2
val crypto_secretstream_xchacha20poly1305_TAG_FINAL = 3
val crypto_secretstream_xchacha20poly1305_HEADERBYTES = 24
val crypto_secretstream_xchacha20poly1305_KEYBYTES = 32
val crypto_secretstream_xchacha20poly1305_ABYTES = 17
expect object SecretStream {
fun xChaCha20Poly1305InitPush(key: UByteArray) : SecretStreamStateAndHeader
fun xChaCha20Poly1305Push(state : SecretStreamState, message: UByteArray, additionalData : UByteArray = ubyteArrayOf(), tag: UByte) : UByteArray
fun xChaCha20Poly1305InitPull(key: UByteArray, header: UByteArray) : SecretStreamStateAndHeader
fun xChaCha20Poly1305Pull(state : SecretStreamState, ciphertext: UByteArray, additionalData : UByteArray = ubyteArrayOf()) : DecryptedDataAndTag
fun xChaCha20Poly1305Keygen() : UByteArray
fun xChaCha20Poly1305Rekey(state: SecretStreamState)
}