List of usage examples for android.security.keystore KeyProperties DIGEST_SHA256
String DIGEST_SHA256
To view the source code for android.security.keystore KeyProperties DIGEST_SHA256.
Click Source Link
From source file:Main.java
@TargetApi(Build.VERSION_CODES.M) private static void generateNewKey() { try {/* w ww . ja v a 2s . c om*/ KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(KeyProperties.KEY_ALGORITHM_RSA, KEY_PROVIDER); keyPairGenerator.initialize(new KeyGenParameterSpec.Builder(KEY_ALIAS, KeyProperties.PURPOSE_DECRYPT) .setDigests(KeyProperties.DIGEST_SHA256, KeyProperties.DIGEST_SHA512) .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_RSA_OAEP).build()); keyPairGenerator.generateKeyPair(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuchProviderException e) { e.printStackTrace(); } catch (InvalidAlgorithmParameterException e) { e.printStackTrace(); } }