[
https://issues.apache.org/jira/browse/PDFBOX-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16659456#comment-16659456
]
Tilman Hausherr commented on PDFBOX-4312:
-----------------------------------------
Sadly, that means that .net and/or IKVM don't work properly there.
What you could do is to write a .net C++ tool to search for the last EOF and
then copy the byte range (34 bytes in my file) at the offset where the last
/ByteRange is, and also do the same with the signature bytes, i.e. to copy them
after the last "/Contents <". The stuff that is at the end of the PDF must be
clipped off.
Try first to do this manually with a PDF file, because there's still the
problem I mentioned on Sept 14. Use NOTEPAD++ or a similar editor. When
copying, make sure to copy the exact number of bytes into a selected area with
the same number of bytes. Note that the byterange has spaces ("0 770 19716
7093] " in my file). The signature has 3062 bytes in my file, so leave all the
rest 0000's untouched; the reserved signature size is 18944 bytes in my file,
i.e. 0x2500 * 2. In NOTEPAD++ you can get the offset-at-cursor with CTRL-G and
then click the radio button on the right. Use this also to check that you
didn't move anything. When done, open the file with Adobe Reader and check the
signature. This would either confirm or disprove my allegation from September
14.
If I were you, I'd let this go (isn't this all frustrating?) and either use
IKVM to try PDFBox 2.0.12 (that one doesn't use FileChannels, it writes the
incremental part in memory), or use PDFBox in Java. Or use a product made for
.net. Your current strategy carries a huge risk: you're using an old PDFBox
version on an unsupported platform (.net) with a buggy converter (IKVM) that
hasn't been updated since 2012 and has been officially discontinued last year.
> Signature is not getting inserted into 00000 area
> -------------------------------------------------
>
> Key: PDFBOX-4312
> URL: https://issues.apache.org/jira/browse/PDFBOX-4312
> Project: PDFBox
> Issue Type: Bug
> Components: .NET, PDModel, Signing
> Affects Versions: 1.8.9, 1.8.15
> Reporter: bal
> Priority: Major
> Fix For: 1.8.17
>
> Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf,
> testingSignature-signed-SaveIncremental-2param-good.pdf,
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7
> signature to byte array using Convert.FromBase64String method in .net . I am
> passing this byte array to sign method in signature interface which gets
> called after calling saveincremental. My byte array is inserting proper but
> the name of which signature is not shown when i open pdf. May be my byte
> conversion may not proper or something else i am doing wrong. please let me
> know.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]