SHARE
TWEET

Untitled

a guest Jul 21st, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fun encrypt(cipherAlgorithm: String, plainText: ByteArray, key: Key): ByteArray? {
  2.     return try {
  3.         val cipher = Cipher.getInstance(cipherAlgorithm)
  4.         cipher.init(Cipher.ENCRYPT_MODE, key)
  5.         val cipherText = cipher.doFinal(plainText)
  6.         cipherText
  7.     } catch (exception: GeneralSecurityException) {
  8.         exception.printStackTrace()
  9.         null
  10.     }
  11. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top