You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Luc Claes (JIRA)" <ji...@apache.org> on 2009/10/09 17:08:31 UTC
[jira] Created: (PDFBOX-538) CryptographyException on Adobe
Distiller generated file
CryptographyException on Adobe Distiller generated file
-------------------------------------------------------
Key: PDFBOX-538
URL: https://issues.apache.org/jira/browse/PDFBOX-538
Project: PDFBox
Issue Type: Bug
Components: Parsing
Affects Versions: 0.8.0-incubator
Reporter: Luc Claes
Well... this is actually *not* a PDFBox bug, but an Adobe Distiller (7.0.x) one...
The following exception is thrown in StandardSecurityHandler.computeEncryptedKey:
org.apache.pdfbox.exceptions.CryptographyException: Error: length should be 5 when revision is two actual=16
The PDF file is accepted by various readers and contains the following object:
2106 0 obj
<<
/Filter /Standard
/V 1
/R 2
/Length 128
/P -12
/O (f¥—èàãØ‡æa§»eücmý/Æ6ïàY÷[*™6)
/U (å£átÂ>c÷sÉcû^KÞ•À›¶YjCò~)
>>
endobj
Referenced by an encrypt tag:
/Encrypt 2106 0 R
PDFBox rejects (rightly) such an object with version 1, revision 2 and a length != 5*8
That said, we are parsing many of those files to feed a Lucene index. Could the validation be relaxed ?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [jira] Updated: (PDFBOX-538) CryptographyException on Adobe Distiller
generated file
Posted by Ad...@swmc.com.
So I take it version 1 revision 2 doesn't support 128 bits keys? Because
16 bytes would be a 128-bit key, which is what is specified as the
"Length", so that all seems to match.
You add a boolean to the StandardSecurityHandler alwaysAllow128BitKey and
then use that in computeEncryptedKey(). That way it'll do the validation
by default but still allow you to override this.
--Adam
"Luc Claes (JIRA)" <ji...@apache.org>
10/09/2009 08:08
Please respond to
pdfbox-dev@incubator.apache.org
To
pdfbox-dev@incubator.apache.org
cc
Subject
[jira] Updated: (PDFBOX-538) CryptographyException on Adobe Distiller
generated file
[
https://issues.apache.org/jira/browse/PDFBOX-538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Luc Claes updated PDFBOX-538:
-----------------------------
Description:
Well... this is actually *not* a PDFBox bug, but an Adobe Distiller
(7.0.x) one...
The following exception is thrown in
StandardSecurityHandler.computeEncryptedKey:
org.apache.pdfbox.exceptions.CryptographyException: Error: length should
be 5 when revision is two actual=16
The PDF file is accepted by various readers and contains the following
object:
2106 0 obj
<<
/Filter /Standard
/V 1
/R 2
/Length 128
/P -12
/O (f¥—èàãØ‡�æa§�»eücmý/Æ6ïàY÷[*™6)
/U (å£átÂ>c÷sÉcû^KÞ•À›¶YjCò~)
>>
endobj
Referenced by an encrypt tag:
/Encrypt 2106 0 R
PDFBox rejects (rightly) such an object with version 1, revision 2 and a
length != 5*8
That said, we are parsing many of those files to feed a Lucene index.
Could the validation be relaxed ?
was:
Well... this is actually *not* a PDFBox bug, but an Adobe Distiller
(7.0.x) one...
The following exception is thrown in
StandardSecurityHandler.computeEncryptedKey:
org.apache.pdfbox.exceptions.CryptographyException: Error: length should
be 5 when revision is two actual=16
The PDF file is accepted by various readers and contains the following
object:
2106 0 obj
<<
/Filter /Standard
/V 1
/R 2
/Length 128
/P -12
/O (f¥—èàãØ‡æa§»eücmý/Æ6ïàY÷[*™6)
/U (å£átÂ>c÷sÉcû^KÞ•À›¶YjCò~)
>>
endobj
Referenced by an encrypt tag:
/Encrypt 2106 0 R
PDFBox rejects (rightly) such an object with version 1, revision 2 and a
length != 5*8
That said, we are parsing many of those files to feed a Lucene index.
Could the validation be relaxed ?
Issue Type: Improvement (was: Bug)
> CryptographyException on Adobe Distiller generated file
> -------------------------------------------------------
>
> Key: PDFBOX-538
> URL: https://issues.apache.org/jira/browse/PDFBOX-538
> Project: PDFBox
> Issue Type: Improvement
> Components: Parsing
> Affects Versions: 0.8.0-incubator
> Reporter: Luc Claes
>
> Well... this is actually *not* a PDFBox bug, but an Adobe Distiller
(7.0.x) one...
> The following exception is thrown in
StandardSecurityHandler.computeEncryptedKey:
> org.apache.pdfbox.exceptions.CryptographyException: Error: length should
be 5 when revision is two actual=16
> The PDF file is accepted by various readers and contains the following
object:
> 2106 0 obj
> <<
> /Filter /Standard
> /V 1
> /R 2
> /Length 128
> /P -12
> /O (f¥—èàãØ‡�æa§�»eücmý/Æ6ïàY÷[*™6)
> /U (å£átÂ>c÷sÉcû^KÞ•À›¶YjCò~)
> >>
> endobj
> Referenced by an encrypt tag:
> /Encrypt 2106 0 R
> PDFBox rejects (rightly) such an object with version 1, revision 2 and a
length != 5*8
> That said, we are parsing many of those files to feed a Lucene index.
Could the validation be relaxed ?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
〉 Click here to submit conditions
This email and any content within or attached hereto from Sun West Mortgage Company, Inc. is confidential and/or legally privileged. The information is intended only for the use of the individual or entity named on this email. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this email information is strictly prohibited, and that the documents should be returned to this office immediately by email. Receipt by anyone other than the intended recipient is not a waiver of any privilege. Please do not include your social security number, account number, or any other personal or financial information in the content of the email. Should you have any questions, please call (800) 453 7884.
[jira] Updated: (PDFBOX-538) CryptographyException on Adobe
Distiller generated file
Posted by "Luc Claes (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Luc Claes updated PDFBOX-538:
-----------------------------
Description:
Well... this is actually *not* a PDFBox bug, but an Adobe Distiller (7.0.x) one...
The following exception is thrown in StandardSecurityHandler.computeEncryptedKey:
org.apache.pdfbox.exceptions.CryptographyException: Error: length should be 5 when revision is two actual=16
The PDF file is accepted by various readers and contains the following object:
2106 0 obj
<<
/Filter /Standard
/V 1
/R 2
/Length 128
/P -12
/O (f¥—èàãØ‡�æa§�»eücmý/Æ6ïàY÷[*™6)
/U (å£átÂ>c÷sÉcû^KÞ•À›¶YjCò~)
>>
endobj
Referenced by an encrypt tag:
/Encrypt 2106 0 R
PDFBox rejects (rightly) such an object with version 1, revision 2 and a length != 5*8
That said, we are parsing many of those files to feed a Lucene index. Could the validation be relaxed ?
was:
Well... this is actually *not* a PDFBox bug, but an Adobe Distiller (7.0.x) one...
The following exception is thrown in StandardSecurityHandler.computeEncryptedKey:
org.apache.pdfbox.exceptions.CryptographyException: Error: length should be 5 when revision is two actual=16
The PDF file is accepted by various readers and contains the following object:
2106 0 obj
<<
/Filter /Standard
/V 1
/R 2
/Length 128
/P -12
/O (f¥—èàãØ‡æa§»eücmý/Æ6ïàY÷[*™6)
/U (å£átÂ>c÷sÉcû^KÞ•À›¶YjCò~)
>>
endobj
Referenced by an encrypt tag:
/Encrypt 2106 0 R
PDFBox rejects (rightly) such an object with version 1, revision 2 and a length != 5*8
That said, we are parsing many of those files to feed a Lucene index. Could the validation be relaxed ?
Issue Type: Improvement (was: Bug)
> CryptographyException on Adobe Distiller generated file
> -------------------------------------------------------
>
> Key: PDFBOX-538
> URL: https://issues.apache.org/jira/browse/PDFBOX-538
> Project: PDFBox
> Issue Type: Improvement
> Components: Parsing
> Affects Versions: 0.8.0-incubator
> Reporter: Luc Claes
>
> Well... this is actually *not* a PDFBox bug, but an Adobe Distiller (7.0.x) one...
> The following exception is thrown in StandardSecurityHandler.computeEncryptedKey:
> org.apache.pdfbox.exceptions.CryptographyException: Error: length should be 5 when revision is two actual=16
> The PDF file is accepted by various readers and contains the following object:
> 2106 0 obj
> <<
> /Filter /Standard
> /V 1
> /R 2
> /Length 128
> /P -12
> /O (f¥—èàãØ‡�æa§�»eücmý/Æ6ïàY÷[*™6)
> /U (å£átÂ>c÷sÉcû^KÞ•À›¶YjCò~)
> >>
> endobj
> Referenced by an encrypt tag:
> /Encrypt 2106 0 R
> PDFBox rejects (rightly) such an object with version 1, revision 2 and a length != 5*8
> That said, we are parsing many of those files to feed a Lucene index. Could the validation be relaxed ?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (PDFBOX-538) CryptographyException on Adobe
Distiller generated file
Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12764332#action_12764332 ]
Andreas Lehmkühler commented on PDFBOX-538:
-------------------------------------------
IMO it is possible to replace the exception with a log entry. Is it possible to provide us with a sample file?
> CryptographyException on Adobe Distiller generated file
> -------------------------------------------------------
>
> Key: PDFBOX-538
> URL: https://issues.apache.org/jira/browse/PDFBOX-538
> Project: PDFBox
> Issue Type: Improvement
> Components: Parsing
> Affects Versions: 0.8.0-incubator
> Reporter: Luc Claes
>
> Well... this is actually *not* a PDFBox bug, but an Adobe Distiller (7.0.x) one...
> The following exception is thrown in StandardSecurityHandler.computeEncryptedKey:
> org.apache.pdfbox.exceptions.CryptographyException: Error: length should be 5 when revision is two actual=16
> The PDF file is accepted by various readers and contains the following object:
> 2106 0 obj
> <<
> /Filter /Standard
> /V 1
> /R 2
> /Length 128
> /P -12
> /O (f¥—èàãØ‡�æa§�»eücmý/Æ6ïàY÷[*™6)
> /U (å£átÂ>c÷sÉcû^KÞ•À›¶YjCò~)
> >>
> endobj
> Referenced by an encrypt tag:
> /Encrypt 2106 0 R
> PDFBox rejects (rightly) such an object with version 1, revision 2 and a length != 5*8
> That said, we are parsing many of those files to feed a Lucene index. Could the validation be relaxed ?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (PDFBOX-538) CryptographyException on Adobe
Distiller generated file
Posted by "Luc Claes (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765512#action_12765512 ]
Luc Claes commented on PDFBOX-538:
----------------------------------
There seems to be a confusion between the 'version' and 'revison' encryption dictionnary entries.
The PDF spec says:
(7.6.1) For version 1: Encryption of data using the RC4 or AES algorithms" in 7.6.2, "General Encryption Algorithm," with an encryption key length of 40 bits; see below.
...
Length integer (Optional; PDF 1.4; only if V is 2 or 3) The length of the encryption key, in bits. The value shall be a multiple of 8, in the range 40 to 128. Default value: 40.
...
Note that length is optional and meaningful only if v > 1. If v is 1, the length is always of 40 bits.
A working patch of StandardSecurityHandler.java consists of
1) replacing in decryptDocument()
int dicLength = dictionary.getLength()/8;
by
int dicLength = (dictionary.getVersion() == 1) ? 5 : (dictionary.getLength()/8);
2) deleting the two erroneous tests in getUserPassword() and computeEncryptedKey():
if( (encRevision == 2) && (length != 5) )
{
throw new CryptographyException(
"Error: Expected length=5 actual=" + length );
}
(the revision was evaluated instead of the version, and the test is now useless)
Unfortunately, I'm unable to provide you 'publicly' with such a document.
> CryptographyException on Adobe Distiller generated file
> -------------------------------------------------------
>
> Key: PDFBOX-538
> URL: https://issues.apache.org/jira/browse/PDFBOX-538
> Project: PDFBox
> Issue Type: Improvement
> Components: Parsing
> Affects Versions: 0.8.0-incubator
> Reporter: Luc Claes
>
> Well... this is actually *not* a PDFBox bug, but an Adobe Distiller (7.0.x) one...
> The following exception is thrown in StandardSecurityHandler.computeEncryptedKey:
> org.apache.pdfbox.exceptions.CryptographyException: Error: length should be 5 when revision is two actual=16
> The PDF file is accepted by various readers and contains the following object:
> 2106 0 obj
> <<
> /Filter /Standard
> /V 1
> /R 2
> /Length 128
> /P -12
> /O (f¥—èàãØ‡�æa§�»eücmý/Æ6ïàY÷[*™6)
> /U (å£átÂ>c÷sÉcû^KÞ•À›¶YjCò~)
> >>
> endobj
> Referenced by an encrypt tag:
> /Encrypt 2106 0 R
> PDFBox rejects (rightly) such an object with version 1, revision 2 and a length != 5*8
> That said, we are parsing many of those files to feed a Lucene index. Could the validation be relaxed ?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (PDFBOX-538) CryptographyException on Adobe
Distiller generated file
Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765917#action_12765917 ]
Andreas Lehmkühler commented on PDFBOX-538:
-------------------------------------------
Thanks for the detailed explanation. Obviously there is another possible value of V=4 since pdf 1.5 in the pdf-reference v1.7. IMO we have to take that value also into amount to be 1.5 compliant. If we really support that value or just throw an exception or log an error/warning that's another story.
> CryptographyException on Adobe Distiller generated file
> -------------------------------------------------------
>
> Key: PDFBOX-538
> URL: https://issues.apache.org/jira/browse/PDFBOX-538
> Project: PDFBox
> Issue Type: Bug
> Components: Parsing
> Affects Versions: 0.8.0-incubator
> Reporter: Luc Claes
>
> Well... this is actually *not* a PDFBox bug, but an Adobe Distiller (7.0.x) one...
> The following exception is thrown in StandardSecurityHandler.computeEncryptedKey:
> org.apache.pdfbox.exceptions.CryptographyException: Error: length should be 5 when revision is two actual=16
> The PDF file is accepted by various readers and contains the following object:
> 2106 0 obj
> <<
> /Filter /Standard
> /V 1
> /R 2
> /Length 128
> /P -12
> /O (f¥—èàãØ‡�æa§�»eücmý/Æ6ïàY÷[*™6)
> /U (å£átÂ>c÷sÉcû^KÞ•À›¶YjCò~)
> >>
> endobj
> Referenced by an encrypt tag:
> /Encrypt 2106 0 R
> PDFBox rejects (rightly) such an object with version 1, revision 2 and a length != 5*8
> That said, we are parsing many of those files to feed a Lucene index. Could the validation be relaxed ?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (PDFBOX-538) CryptographyException on Adobe
Distiller generated file
Posted by "Luc Claes (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Luc Claes updated PDFBOX-538:
-----------------------------
Issue Type: Bug (was: Improvement)
> CryptographyException on Adobe Distiller generated file
> -------------------------------------------------------
>
> Key: PDFBOX-538
> URL: https://issues.apache.org/jira/browse/PDFBOX-538
> Project: PDFBox
> Issue Type: Bug
> Components: Parsing
> Affects Versions: 0.8.0-incubator
> Reporter: Luc Claes
>
> Well... this is actually *not* a PDFBox bug, but an Adobe Distiller (7.0.x) one...
> The following exception is thrown in StandardSecurityHandler.computeEncryptedKey:
> org.apache.pdfbox.exceptions.CryptographyException: Error: length should be 5 when revision is two actual=16
> The PDF file is accepted by various readers and contains the following object:
> 2106 0 obj
> <<
> /Filter /Standard
> /V 1
> /R 2
> /Length 128
> /P -12
> /O (f¥—èàãØ‡�æa§�»eücmý/Æ6ïàY÷[*™6)
> /U (å£átÂ>c÷sÉcû^KÞ•À›¶YjCò~)
> >>
> endobj
> Referenced by an encrypt tag:
> /Encrypt 2106 0 R
> PDFBox rejects (rightly) such an object with version 1, revision 2 and a length != 5*8
> That said, we are parsing many of those files to feed a Lucene index. Could the validation be relaxed ?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.