我有这样的代码:
class Crypt
{
Key KEY;
String TD;
Cipher aes = Cipher.getInstance("AES/CBC/PKCS5Padding");
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
public Crypt()
{
int keyLength = 192;
keyGen.init(keyLength);
KEY = keyGen.generateKey();它在编译时会产生以下错误:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Unhandled exception type NoSuchAlgorithmException
Unhandled exception type NoSuchPaddingException
Unhandled exception type NoSuchAlgorithmException发布于 2012-06-08 22:41:10
您的错误非常明显,与无限权限加密文件没有任何关系。它告诉您存在未处理的检查异常。
将throws Exception添加到您的构造函数中,使其如下所示:
public Crypt() throws Exception
{
int keyLength = 192;
keyGen.init(keyLength);
KEY = keyGen.generateKey();发布于 2012-06-08 22:42:20
您还将它们安装到/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security?中了吗
https://stackoverflow.com/questions/10950937
复制相似问题