use of org.spongycastle.crypto.PBEParametersGenerator in project bitcoin-wallet by bitcoin-wallet.
the class Crypto method getAESPasswordKey.
/**
* Get password and generate key and iv.
*
* @param password
* The password to use in key generation
* @param salt
* The salt to use in key generation
* @return The CipherParameters containing the created key
*/
private static CipherParameters getAESPasswordKey(final char[] password, final byte[] salt) {
final PBEParametersGenerator generator = new OpenSSLPBEParametersGenerator();
generator.init(PBEParametersGenerator.PKCS5PasswordToBytes(password), salt, NUMBER_OF_ITERATIONS);
final ParametersWithIV key = (ParametersWithIV) generator.generateDerivedParameters(KEY_LENGTH, IV_LENGTH);
return key;
}
Aggregations