Create a Keypair
This snippet demonstrates how your mobile apps can generate the private and public key. The private key is automatically saved to your app's Keystore.
Key pairs are used in the SDK to sign challenges. The private key remains on the device, whereas the public key gets uploaded to the server as part of the mechanisms enrollment. The Algorithm used is SHA256withRSA with a Keysize of 2048 and the key pairs are stored in the Android Keystore.
private void generateKeyPair(String keyName, boolean requiresAuthentication) {
KeyStoreHelper.createKeyPair(keyName, Algorithm.valueOf("SHA256withRSA"), requiresAuthentication, new IResultCallback<PublicKey>() {
@Override
public void handleResult(PublicKey publicKey, VerifySdkException verifySdkException) {
if (verifySdkException == null) {
// keypair successfully generated
}
}
})
}