I am trying to generate a private key with a password using a SecretKeyFactory and when I start the program I have a runtime exception that says algorithm not available. But in others PCs it works fine! Any help ?
private static void generatePrivateKey(String pwd) {
try {
PBEKeySpec keySpec = new PBEKeySpec(pwd.toCharArray());
SecretKeyFactory kf = SecretKeyFactory.getInstance("PBEWithHmacSHA256AndAES_128");
PRIVATE_KEY = kf.generateSecret(keySpec);
} catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
e.printStackTrace();
}
}