Created
June 26, 2019 08:58
-
-
Save BDOMDev/80924c283eecafc373b2a5ec651c6d79 to your computer and use it in GitHub Desktop.
Decrypt a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment