我正在尝试在android JNCryptor的帮助下使用 Cipher Algorithm "AES/CBC/PKCS7Padding"
、 HMAC algorithm"HmacSHA256"
和 key derivation algorithm编写加密代码。但它显示:"PBKDF2WithHmacSHA256"
CryptorException: Failed to generate key from password using PBKDF2WithHmacSHA256
和
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);
}
任何帮助将不胜感激。