我正在尝试在 Java 服务器和 Android 客户端之间做一些加密。经过一番研究,和
这是我的加密设置:
public static String encryptionAlgoirthm = "DES";
public static short encryptionBitCount = 128;
public static String hashingAlgorithm = "PBEWithMD5AndDES";
public static short hashingCount = 512;
public static String cipherTransformation = "DES/CBC/PKCS5Padding";
但是当尝试在我的 CentOS VPS 上运行服务器时,我得到以下信息:
Algorithm [PBEWithMD5AndDES] of type [SecretKeyFactory] from provider [gnu.javax.security.auth.callback.GnuCallbacks: name=GNU-CALLBACKS version=2.1] is not found.
这是代码:
KeySpec keySpec = new PBEKeySpec(EncryptionSettings.password, EncryptionSettings.salt, EncryptionSettings.hashingCount, EncryptionSettings.encryptionBitCount);
SecretKey tmpKey = null;
try
{
tmpKey = SecretKeyFactory.getInstance(EncryptionSettings.hashingAlgorithm).generateSecret(keySpec);
}
catch (final InvalidKeySpecException e)
{
Console.writeFatalError("Unable to generate key: invalid key specification");
}
catch (final NoSuchAlgorithmException e)
{
Console.writeFatalError("Unable to generate key: encryption algorithm not supported - " + e.getMessage());
}
我该如何解决?