Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.pdfbox.pdmodel.encryption;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigInteger;
Expand Down Expand Up @@ -888,7 +887,7 @@ else if (encRevision == REVISION_3 || encRevision == REVISION_4)
{
iterationKey[j] = (byte)(iterationKey[j] ^ i);
}
ByteArrayInputStream input = new ByteArrayInputStream(result.toByteArray());
byte[] input = result.toByteArray();
result.reset();
encryptDataRC4(iterationKey, input, result);
}
Expand Down Expand Up @@ -926,7 +925,7 @@ public byte[] computeOwnerPassword(byte[] ownerPassword, byte[] userPassword,
byte[] paddedUser = truncateOrPad( userPassword );

ByteArrayOutputStream encrypted = new ByteArrayOutputStream();
encryptDataRC4(rc4Key, new ByteArrayInputStream(paddedUser), encrypted);
encryptDataRC4(rc4Key, paddedUser, encrypted);

if (encRevision == REVISION_3 || encRevision == REVISION_4)
{
Expand All @@ -938,7 +937,7 @@ public byte[] computeOwnerPassword(byte[] ownerPassword, byte[] userPassword,
{
iterationKey[j] = (byte)(iterationKey[j] ^ (byte)i);
}
ByteArrayInputStream input = new ByteArrayInputStream( encrypted.toByteArray() );
byte[] input = encrypted.toByteArray();
encrypted.reset();
encryptDataRC4(iterationKey, input, encrypted );
}
Expand Down