【发布时间】:2014-09-23 20:26:27
【问题描述】:
试图理解应用程序中使用 AES 解密文件的以下代码。我不是 Java 程序员。如果我知道变量字节 a[] 的值,是否可以解密文件?
static byte a[] = { ..... };
SecretKeySpec key;
if (key == null)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bos.write(a);
bos.write(abyte1);
key = new SecretKeySpec(bos.toByteArray(), "AES");
bos.close();
}
Cipher cipher = Cipher.getInstance("AES");
cipher.init(2, key);
CipherInputStream cipherinputstream = new CipherInputStream(inputstream, cipher);
【问题讨论】:
标签: java encryption aes