Skip to content

Commit

Permalink
PDFBOX-5866: also truncate the O and U entries, as suggested by Micha…
Browse files Browse the repository at this point in the history
…el Klink

git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1919783 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Aug 9, 2024
1 parent 0e11fd2 commit 403f44b
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ public byte[] getOwnerKey() throws IOException
if( owner != null )
{
o = owner.getBytes();
int r = getRevision();
if (r <= 4)
{
o = Arrays.copyOf(o, 32);
}
else if (r == 6)
{
o = Arrays.copyOf(o, 48);
}
}
return o;
}
Expand Down Expand Up @@ -307,6 +316,15 @@ public byte[] getUserKey() throws IOException
if( user != null )
{
u = user.getBytes();
int r = getRevision();
if (r <= 4)
{
u = Arrays.copyOf(u, 32);
}
else if (r == 6)
{
u = Arrays.copyOf(u, 48);
}
}
return u;
}
Expand Down

0 comments on commit 403f44b

Please sign in to comment.