2
以下代碼無法編譯消息:cannot instantiate type SymmetricKey
SymmetricKey爲 接口。我該如何解決?實例化接口時出錯
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InitializationVector iv = new InitializationVector("helo".getBytes());
SymmetricKey key = new SymmetricKey("AES_256","key", 0, "key".length());
OutputStream os = EncryptorFactory.getEncryptorOutputStream(key, baos, "AES/CBC/PKCS5",);
os.write("somedata".getBytes());
byte[] encryptedData = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(encryptedData);
InputStream is = DecryptorFactory.getDecryptorInputStream(key, bais, "AES/CBC/PKCS5", iv);