Almacenamiento de contraseña SHA2 con Java
Estoy tratando de hacer una llamada XML-RPC que requiere el hash HmacSHA-256 de una cadena particular. Actualmente estoy usando la biblioteca Jasypt con el siguiente código:
StandardPBEStringEncryptor sha256 = new StandardPBEStringEncryptor();
sha256.setPassword(key);
sha256.setAlgorithm("PBEWithHmacSHA2");
Al intentar usar sha256.encrypt (cadena) me sale este error:
Exception in thread "main" org.jasypt.exceptions.EncryptionInitializationException: java.security.NoSuchAlgorithmException: PBEWithHmacAndSHA256 SecretKeyFactory not available at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:597) at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.initialize(StandardPBEStringEncryptor.java:488) at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.encrypt(StandardPBEStringEncryptor.java:541) at nysenateapi.XmlRpc.main(XmlRpc.java:52) Caused by: java.security.NoSuchAlgorithmException: PBEWithHmacAndSHA256 SecretKeyFactory not available at javax.crypto.SecretKeyFactory.(DashoA13*..) at javax.crypto.SecretKeyFactory.getInstance(DashoA13*..) at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:584) ... 3 more
Descargué la extensión de criptografía JCE y coloqué los frascos en mi buildpath, pero eso no parece haber hecho nada. Intenté usar varias combinaciones en setAlgorithm arriba, incluyendo "PBE", "PBEWithSha" (1 | 2 | 128 | 256) ?, "PBEWithHmacSha", etc.
También intenté usar BouncyCastle pero tampoco tuve suerte allí. Cualquier ayuda u orientación apreciada!