pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tilman Hausherr (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PDFBOX-4312) byte array format to pass to sign method
Date Wed, 19 Sep 2018 20:12:00 GMT

    [ https://issues.apache.org/jira/browse/PDFBOX-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16621136#comment-16621136
] 

Tilman Hausherr commented on PDFBOX-4312:
-----------------------------------------

This code seems to work... the problem is something with the append mode of FileOutputStream.
So use the code below, or the long code I posted earlier today.

{code:java}
    public void saveIncrementalNEW( String fileName ) throws IOException, COSVisitorException
    {
        FileInputStream fis = new FileInputStream(fileName);
        byte[] ba = IOUtils.toByteArray(fis);
        fis.close();
        FileOutputStream fos = new FileOutputStream(fileName);
        fos.write(ba);
        fis = new FileInputStream(fileName);        
        saveIncremental(fis, fos);
    }{code}

> byte array format to pass to sign method
> ----------------------------------------
>
>                 Key: PDFBOX-4312
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4312
>             Project: PDFBox
>          Issue Type: Wish
>          Components: .NET, PDModel, Signing
>    Affects Versions: 1.8.9
>            Reporter: bal
>            Priority: Major
>         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: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Mime
View raw message