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

Tilman Hausherr commented on PDFBOX-4609:
-----------------------------------------

I don't understand you, yesterday you wrote "unable to implement the sign 
method in the SignatureInterface-derived class", today you wrote "i had 
implemented the signatureinterface".
{quote}but couldn't create the keystore as in java which contains the alias and 
the pin
{quote}
That too is shown in the examples:
{code:java}
BouncyCastleProvider provider = new BouncyCastleProvider();
KeyStore keystore = KeyStore.getInstance("PKCS12", provider);
char[] pin = args[1].toCharArray();
keystore.load(new FileInputStream(ksFile), pin);
{code}
If you're using a PKI card, then it's more difficult, it depends on the card 
software. Here's some inspiration:
 [https://stackoverflow.com/questions/16791748/sunpkcs11-and-pkcs11-middleware]
 
[https://stackoverflow.com/questions/8056818/accessing-hardware-pkcs11-token-on-a-64-bit-machine/15615068#15615068]
 
[https://github.com/nachogarrone/seguridad/blob/master/src/main/java/com/ucu/seguridad/PKCS11Util.java]
{quote}pass the correct input to sign method for valid signature
{quote}
The correct input (i.e. all except the signature area) should be passed if you 
are calling addSignature() and saveIncremental() like in the example. The 
closer you stay with the example, the higher the chance that it works.

Re the code you posted: that is the verify code. It is (probably) OK (the best 
would be you test it with a PDF that you know is good), the problem last time 
was that you signed the wrong part. You signed the PDF itself, instead of 
signing the PDF plus the increment minus the "gap". See my comments on August 
12th here.

> At least  one signature is invalid
> ----------------------------------
>
>                 Key: PDFBOX-4609
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4609
>             Project: PDFBox
>          Issue Type: Wish
>          Components: .NET
>    Affects Versions: 1.8.15
>            Reporter: bal
>            Priority: Major
>         Attachments: Debug.txt, keystore.p12
>
>
> I am getting signature is  invalid  error in the signature panel of pdf after 
> pkcs 7 signature insertion. I can see the name of the signer with the signed 
> by in signature panel. I am not able to find out disallowed changes pdfbox 
> does resulting into invalid pdf by acrobat reader.   Is it possible to 
> validate the pdf with pdfbox? Thanks in advance. 



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to