I am trying to write an encryption code using Cipher Algorithm "AES/CBC/PKCS7Padding"
, HMAC algorithm "HmacSHA256"
and key derivation algorithm "PBKDF2WithHmacSHA256"
with the help of android JNCryptor. But it shows:
CryptorException: Failed to generate key from password using PBKDF2WithHmacSHA256
and
NoSuchAlgorithmException: SecretKeyFactory PBKDF2WithHmacSHA256 implementation not found
try {
SecretKeyFactory factory = SecretKeyFactory
.getInstance(KEY_DERIVATION_ALGORITHM);
SecretKey tmp = factory.generateSecret(new PBEKeySpec(password,
salt, getPBKDFIterations(), AES_256_KEY_SIZE * 8));
return new SecretKeySpec(tmp.getEncoded(), AES_NAME);
} catch (GeneralSecurityException e) {
throw new CryptorException(String.format(
"Failed to generate key from password using %s.",
KEY_DERIVATION_ALGORITHM), e);
}
any help will be appreciated.