Skip to content

Instantly share code, notes, and snippets.

@BDOMDev
Last active June 26, 2019 08:59
Show Gist options
  • Save BDOMDev/936f9bd4fd39f950d7fd7de119a648e0 to your computer and use it in GitHub Desktop.
Save BDOMDev/936f9bd4fd39f950d7fd7de119a648e0 to your computer and use it in GitHub Desktop.
fun encryptDownloadedFile() {
try {
val filePath = filesDir.absolutePath + "/filename"
val fileData = readFile(filePath)
//get secret key
val secretKey = getSecretKey(sharedPref)
//encrypt file
val encodedData = encrypt(secretKey, fileData)
saveFile(encodedData, filePath)
} catch (e: Exception) {
Log.d(mTag, e.message)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment