Skip to content

Instantly share code, notes, and snippets.

@yakivmospan
Created November 20, 2017 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yakivmospan/a782d836934043f0406f347d6ae53aa8 to your computer and use it in GitHub Desktop.
Save yakivmospan/a782d836934043f0406f347d6ae53aa8 to your computer and use it in GitHub Desktop.
fun unWrapKey(wrappedKeyData: String, algorithm: String, wrappedKeyType: Int, keyToUnWrapWith: Key?): Key {
val encryptedKeyData = Base64.decode(wrappedKeyData, Base64.DEFAULT)
cipher.init(Cipher.UNWRAP_MODE, keyToUnWrapWith)
return cipher.unwrap(encryptedKeyData, algorithm, wrappedKeyType)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment