List of utility methods to do Key Pair Create
Key | generateKeyAES() generate Key AES return new SecretKeySpec(KEY_VALUE_128_BIT, AES_ALGO); |
byte[] | generateKeyDigest(int keyLength, String password) generate Key Digest try { MessageDigest digester = MessageDigest.getInstance("MD5"); int length = (keyLength + 15) / 16 * 16; byte[] passwordBytes = password.getBytes("UTF-8"); byte[] temp = digester.digest(passwordBytes); byte[] key = Arrays.copyOf(temp, length); for (int i = 1; i < length / 16; i++) { temp = Arrays.copyOf(temp, 16 + passwordBytes.length); ... |
Key | generateKeyFromString(final String secKey, String algorithm) generate Key From String final byte[] keyVal = Base64.getDecoder().decode(secKey.getBytes()); final Key key = new SecretKeySpec(keyVal, algorithm); return key; |
KeyPair | generateKeyPair() generate Key Pair return generateKeyPair(1024);
|
KeyPair | generateKeyPair() generate Key Pair try { final KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); keyPairGenerator.initialize(KEY_SIZE); return keyPairGenerator.generateKeyPair(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); |
KeyPair | generateKeyPair() Generate key which contains a pair of private and public key using 1024 bytes KeyPairGenerator keyGen = KeyPairGenerator.getInstance(ALGORITHM);
keyGen.initialize(keyLength);
KeyPair keyPair = keyGen.generateKeyPair();
return keyPair;
|
KeyPair | generateKeyPair() generate Key Pair return generateKeyPair("RSA"); |
KeyPair | generateKeyPair() generate Key Pair if (generator == null) { generator = KeyPairGenerator.getInstance("RSA"); generator.initialize(2048); return generator.genKeyPair(); |
KeyPair | generateKeyPair() generate Key Pair KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); keyPairGenerator.initialize(getKeySize()); KeyPair keyPair = keyPairGenerator.generateKeyPair(); return keyPair; |
KeyPair | generateKeyPair() generate Key Pair KeyPairGenerator gen = KeyPairGenerator.getInstance(encryptionAlgorithm);
gen.initialize(keysize);
return gen.generateKeyPair();
|