I am creating a RSA key pair in my Android KeyStore. I am using eclipse.
I need to use KeyGenParameterSpec class to give my key an alias, so that I can delete it later, but I cant find this class. Can anyone let me know which jar would this be present in.
The official page says that its present at android.security.keystore.KeyGenParameterSpec
, but the problem is that I cant find this jar.
Thanks in advance!
KeyGenParameterSpec
is in the package android.security.keystore
, but you can't see the constructor because it is annotate with @hide
as you can see in the source code.
Quoting form the doclava documentation:
When applied to a package, class, method or field, @hide removes that node and all of its children from the documentation.
If you want to create a KeyGenParameterSpec
you need to use the Builder:
new KeyGenParameterSpec.Builder(KEY_NAME, KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
.setBlockModes(KeyProperties.BLOCK_MODE_CBC)
.setUserAuthenticationRequired(true)
.setUserAuthenticationValidityDurationSeconds(AUTHENTICATION_DURATION_SECONDS)
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7)
.build()