Java 当使用bouncy castle作为加密提供程序和GCM时,cipherOutputStream.close()不';t似乎不会抛出invalidCipherTextException
当使用Bouncy Castle作为提供程序和GCM时,如果我故意修改密码文本,则应引发invalidCipherTextException,如果我在cipherOutputStream.close()的调试模式下单步执行,则可以看到invalidCipherTextException,但无法捕获此异常Java 当使用bouncy castle作为加密提供程序和GCM时,cipherOutputStream.close()不';t似乎不会抛出invalidCipherTextException,java,bouncycastle,Java,Bouncycastle,当使用Bouncy Castle作为提供程序和GCM时,如果我故意修改密码文本,则应引发invalidCipherTextException,如果我在cipherOutputStream.close()的调试模式下单步执行,则可以看到invalidCipherTextException,但无法捕获此异常 BufferedInputStream is = new BufferedInputStream(new FileInputStream(user.encrypte
BufferedInputStream is = new BufferedInputStream(new FileInputStream(user.encryptedDirectory.containedFiles.get(counter)));
CipherOutputStream os = new CipherOutputStream(new FileOutputStream(user.unencryptedDirectory.location.toAbsolutePath() + "\\"+ user.encryptedDirectory.containedFiles.get(counter).getName() + ""), cipher);
copy(is,os);
is.close();
os.close();
private static void copy(InputStream is, OutputStream os) throws IOException {
int i;
byte[] b = new byte[1024];
while((i=is.read(b))!=-1) {
os.write(b, 0, i);
}
}
我是否需要重写以调用cipher.doFinal(),还是我误解了什么