Starting delegated implementation
This commit is contained in:
1 parent
1848de0e8d
commit
e3fe276e4c
6 files changed
+89
-11
No files matched your search
@@ -1,7 +1,6 @@
|
||||
package com.ionspin.kotlin.crypto
|
||||
|
||||
import com.ionspin.kotlin.crypto.authenticated.*
|
||||
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2b
|
||||
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bMultipart
|
||||
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bPure
|
||||
import com.ionspin.kotlin.crypto.hash.sha.Sha256Pure
|
||||
@@ -134,7 +133,7 @@ class MultipartAuthenticatedEncryptor internal constructor(val key : SymmetricKe
|
||||
}
|
||||
|
||||
override fun finish(): MultipartEncryptedDataDescriptor {
|
||||
val finished = primitive.finish()
|
||||
val finished = primitive.finishEncryption()
|
||||
return MultipartEncryptedDataDescriptor(finished.first, finished.second)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ class XChaCha20Poly1305Pure(val key: UByteArray, val additionalData: UByteArray)
|
||||
}
|
||||
}
|
||||
|
||||
fun finish() : Pair<UByteArray, UByteArray> {
|
||||
fun finishEncryption() : Pair<UByteArray, UByteArray> {
|
||||
|
||||
val cipherTextPad = UByteArray(16 - processedBytes % 16) { 0U }
|
||||
val macData = cipherTextPad +
|
||||
|
||||
+3
-3
@@ -134,7 +134,7 @@ class XChaCha20Poly1305Test {
|
||||
)
|
||||
val xChaChaPoly = XChaCha20Poly1305Pure(key, nonce, additionalData)
|
||||
val firstChunk = xChaChaPoly.encryptPartialData(message)
|
||||
val finalChunk = xChaChaPoly.finish()
|
||||
val finalChunk = xChaChaPoly.finishEncryption()
|
||||
val result = firstChunk + finalChunk
|
||||
|
||||
result.contentEquals(expected)
|
||||
@@ -165,11 +165,11 @@ class XChaCha20Poly1305Test {
|
||||
)
|
||||
val xChaChaPoly = XChaCha20Poly1305Pure(key, nonce, additionalData)
|
||||
val firstChunk = xChaChaPoly.encryptPartialData(message)
|
||||
val finalChunk = xChaChaPoly.finish()
|
||||
val finalChunk = xChaChaPoly.finishEncryption()
|
||||
val result = firstChunk + finalChunk
|
||||
result.contentEquals(expected)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user