SecurityHandler.java (pdfbox-2.0.23-src) | : | SecurityHandler.java (pdfbox-2.0.24-src) | ||
---|---|---|---|---|
skipping to change at line 383 | skipping to change at line 383 | |||
cipher.init(decrypt ? Cipher.DECRYPT_MODE : Cipher.ENCRYPT_MODE, keySpec , ips); | cipher.init(decrypt ? Cipher.DECRYPT_MODE : Cipher.ENCRYPT_MODE, keySpec , ips); | |||
return cipher; | return cipher; | |||
} | } | |||
private boolean prepareAESInitializationVector(boolean decrypt, byte[] iv, I nputStream data, OutputStream output) throws IOException | private boolean prepareAESInitializationVector(boolean decrypt, byte[] iv, I nputStream data, OutputStream output) throws IOException | |||
{ | { | |||
if (decrypt) | if (decrypt) | |||
{ | { | |||
// read IV from stream | // read IV from stream | |||
int ivSize = (int) IOUtils.populateBuffer(data, iv); | int ivSize = (int) IOUtils.populateBuffer(data, iv); | |||
if (ivSize == -1) | if (ivSize == 0) | |||
{ | { | |||
return false; | return false; | |||
} | } | |||
if (ivSize != iv.length) | if (ivSize != iv.length) | |||
{ | { | |||
throw new IOException( | throw new IOException( | |||
"AES initialization vector not fully read: only " | "AES initialization vector not fully read: only " | |||
+ ivSize + " bytes read instead of " + iv.length ); | + ivSize + " bytes read instead of " + iv.length ); | |||
} | } | |||
} | } | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |