Skip to content

Instantly share code, notes, and snippets.

@BDOMDev
Created June 26, 2019 08:58
Show Gist options
  • Select an option

  • Save BDOMDev/80924c283eecafc373b2a5ec651c6d79 to your computer and use it in GitHub Desktop.

Select an option

Save BDOMDev/80924c283eecafc373b2a5ec651c6d79 to your computer and use it in GitHub Desktop.

Revisions

  1. BDOMDev created this gist Jun 26, 2019.
    8 changes: 8 additions & 0 deletions Utils.kt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    @Throws(Exception::class)
    fun decrypt(yourKey: SecretKey, fileData: ByteArray): ByteArray {
    val decrypted: ByteArray
    val cipher = Cipher.getInstance("AES", "BC")
    cipher.init(Cipher.DECRYPT_MODE, yourKey, IvParameterSpec(ByteArray(cipher.blockSize)))
    decrypted = cipher.doFinal(fileData)
    return decrypted
    }