Adding pull secretstream definition
This commit is contained in:
1 parent
28995c065f
commit
df87dae376
11 files changed
+223
-30
No files matched your search
@@ -30,7 +30,7 @@ actual class Crypto internal actual constructor() {
|
||||
|
||||
actual fun crypto_hash_sha256_update(state: Sha256State, input: UByteArray) {
|
||||
println("Debug crypto_hash_sha256_update")
|
||||
getSodium().crypto_hash_sha256_update(state, input.toUInt8Array(), )
|
||||
getSodium().crypto_hash_sha256_update(state, input.toUInt8Array())
|
||||
}
|
||||
|
||||
actual fun crypto_hash_sha256_final(state: Sha256State): UByteArray {
|
||||
@@ -46,7 +46,7 @@ actual class Crypto internal actual constructor() {
|
||||
|
||||
actual fun crypto_hash_sha512_update(state: Sha512State, input: UByteArray) {
|
||||
println("Debug crypto_hash_sha512_update")
|
||||
getSodium().crypto_hash_sha512_update(state, input.toUInt8Array(), )
|
||||
getSodium().crypto_hash_sha512_update(state, input.toUInt8Array())
|
||||
}
|
||||
|
||||
actual fun crypto_hash_sha512_final(state: Sha512State): UByteArray {
|
||||
@@ -61,7 +61,7 @@ actual class Crypto internal actual constructor() {
|
||||
|
||||
/**
|
||||
* Initialize a state and generate a random header. Both are returned inside
|
||||
* `SecretStreamStateAndHeader` object
|
||||
* `SecretStreamStateAndHeader` object.
|
||||
*/
|
||||
actual fun crypto_secretstream_xchacha20poly1305_init_push(key: UByteArray): dynamic {
|
||||
println("Debug crypto_secretstream_xchacha20poly1305_init_push")
|
||||
@@ -72,6 +72,16 @@ actual class Crypto internal actual constructor() {
|
||||
return SecretStreamStateAndHeader(state, header)
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize state from header and key. The state can then be used for decryption.
|
||||
*/
|
||||
actual fun crypto_secretstream_xchacha20poly1305_init_pull(header: UByteArray, key: UByteArray):
|
||||
dynamic {
|
||||
println("Debug crypto_secretstream_xchacha20poly1305_init_pull")
|
||||
return getSodium().crypto_secretstream_xchacha20poly1305_init_pull(header.toUInt8Array(),
|
||||
key.toUInt8Array())
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypt next block of data using the previously initialized state. Returns encrypted block.
|
||||
*/
|
||||
@@ -82,7 +92,20 @@ actual class Crypto internal actual constructor() {
|
||||
tag: UByte
|
||||
): UByteArray {
|
||||
println("Debug crypto_secretstream_xchacha20poly1305_push")
|
||||
return getSodium().crypto_secretstream_xchacha20poly1305_push(state, m.toUInt8Array(), ,
|
||||
ad.toUInt8Array(), , tag).toUByteArray()
|
||||
return getSodium().crypto_secretstream_xchacha20poly1305_push(state, m.toUInt8Array(),
|
||||
ad.toUInt8Array(), tag).toUByteArray()
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypt next block of data using the previously initialized state. Returns decrypted block.
|
||||
*/
|
||||
actual fun crypto_secretstream_xchacha20poly1305_pull(
|
||||
state: SecretStreamState,
|
||||
c: UByteArray,
|
||||
ad: UByteArray
|
||||
): UByteArray {
|
||||
println("Debug crypto_secretstream_xchacha20poly1305_pull")
|
||||
return getSodium().crypto_secretstream_xchacha20poly1305_pull(state, c.toUInt8Array(),
|
||||
ad.toUInt8Array()).toUByteArray()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user