Skip to content

Instantly share code, notes, and snippets.

@yakivmospan
Created November 1, 2017 17:56
Show Gist options
  • Save yakivmospan/69d85c94bafaff3d517606ccbb3a136c to your computer and use it in GitHub Desktop.
Save yakivmospan/69d85c94bafaff3d517606ccbb3a136c to your computer and use it in GitHub Desktop.
@TargetApi(Build.VERSION_CODES.M)
private fun initGeneratorWithKeyGenParameterSpec(generator: KeyPairGenerator, alias: String) {
val builder = KeyGenParameterSpec.Builder(alias, KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT)
.setBlockModes(KeyProperties.BLOCK_MODE_ECB)
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1)
generator.initialize(builder.build())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment