decrypt

@JvmName(name = "decryptGeneric")
suspend fun SealedBox<*, *, *>.decrypt(key: SymmetricKey<*, *, *>): KmmResult<ByteArray>(source)
@JvmName(name = "decryptGeneric")
suspend fun SealedBox<*, *, *>.decrypt(key: SpecializedSymmetricKey): KmmResult<ByteArray>(source)

Attempts to decrypt this ciphertext (which may also hold an IV/nonce, and in case of an authenticated ciphertext, authenticated data and auth tag) using the provided key. This is the generic, untyped decryption function for convenience. Compared to its narrower-typed cousins is possible to mismatch the characteristics of key and SealedBox.


@JvmName(name = "decryptAuthenticatedIntegrated")
suspend fun <I : NonceTrait> SealedBox<AuthCapability.Authenticated.WithDedicatedMac, I, KeyType.WithDedicatedMacKey>.decrypt(    key: SymmetricKey.WithDedicatedMac<*>,     authenticatedData: ByteArray = byteArrayOf()): KmmResult<ByteArray>(source)
@JvmName(name = "decryptAuthenticatedGeneric")
suspend fun <A : AuthCapability.Authenticated<out K>, I : NonceTrait, K : KeyType> SealedBox<A, I, out K>.decrypt(    key: SymmetricKey<A, I, out K>,     authenticatedData: ByteArray = byteArrayOf()): KmmResult<ByteArray>(source)

Attempts to decrypt this ciphertext (which may also hold an IV/nonce) using the provided key. Do provide authenticatedData if required, or else decryption will fail! This is the generic, untyped decryption function for convenience. Compared to its narrower-typed cousins is possible to mismatch the characteristics of key and SealedBox.


Attempts to decrypt this ciphertext (which may also hold an IV/nonce) using the provided key. This constrains the key's characteristics to the characteristics of the SealedBox to decrypt. It does not, however, prevent mixing up different encryption algorithms with the same characteristics. I.e., it is possible to feed a AES.ECB key into a AES.CBC. In such cases, this function will immediately return a KmmResult.failure.


@JvmName(name = "decryptRawUnauthedWithNonce")
suspend fun SymmetricKey<AuthCapability.Unauthenticated, NonceTrait.Required, KeyType.Integrated>.decrypt(    nonce: ByteArray,     encryptedData: ByteArray): KmmResult<ByteArray>(source)

Directly decrypts raw encryptedData, feeding nonce into the decryption process.


@JvmName(name = "decryptRawUnauthedNoNonce")
suspend fun SymmetricKey<AuthCapability.Unauthenticated, NonceTrait.Without, KeyType.Integrated>.decrypt(    encryptedData: ByteArray): KmmResult<ByteArray>(source)

Directly decrypts raw encryptedData.


@JvmName(name = "decryptRawAuthedWithNonce")
suspend fun <A : AuthCapability.Authenticated<*>> SymmetricKey<A, NonceTrait.Required, *>.decrypt(    nonce: ByteArray,     encryptedData: ByteArray,     authTag: ByteArray,     authenticatedData: ByteArray = byteArrayOf()): KmmResult<ByteArray>(source)

Directly decrypts raw encryptedData, feeding nonce, authTag, and authenticatedData into the decryption process.

Return

at.asitplus.KmmResult.failure on illegal auth tag length


@JvmName(name = "decryptRawAuthedNoNonce")
suspend fun <A : AuthCapability.Authenticated<*>> SymmetricKey<A, NonceTrait.Without, *>.decrypt(    encryptedData: ByteArray,     authTag: ByteArray,     authenticatedData: ByteArray = byteArrayOf()): KmmResult<ByteArray>(source)

Directly decrypts raw encryptedData, feeding authTag, and authenticatedData into the decryption process.

Return

at.asitplus.KmmResult.failure on illegal auth tag length