private static KeyPair generateCertificate(final Context context) throws GeneralSecurityException {
		final KeyPairGenerator keypair_generator = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore");
		keypair_generator.initialize(new KeyPairGeneratorSpec.Builder(context).setAlias(KEYPAIR_ALIAS)//.setKeySize(1024)
				.setSubject(new X500Principal("CN=Island")).setSerialNumber(new BigInteger("123456789"))
				.setStartDate(new Date()).setEndDate(new Date(System.currentTimeMillis() + 25/* years */* 365 * 24 * 3600_000L)).build());
		return keypair_generator.generateKeyPair();
	}
Utility for signing and verification with Android Keystore.

Created by Oasis on 2017/9/22.
engine/src/main/java/com/oasisfeng/island/util/Cryptography.java