pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Petr Masopust <petr.masop...@i.cz>
Subject Re: Signatures compatibility between pdfbox 1.8 and 2.0
Date Wed, 28 Jun 2017 08:24:29 GMT
sign(externalSigning.getContent()) is "called" by external company and I 
have only their result. They have also original file but I don't know 
their exact algorithm. I don't understand how can differ signature (or 
checksum to be precise) for the same pdf file (and other parameters like 
signing time) from different pdfbox versions ?

Petr Masopust

On 28.6.2017 10:16, Tilman Hausherr wrote:
> Am 28.06.2017 um 10:11 schrieb Petr Masopust:
>> Hello,
>>
>> signatureEncoded is equal to cmsSignature in your code. It is 
>> computed by external company and I don't know how they create it and 
>> have no control about their code. But their signature was correctly 
>> inserted with pdfbox 1.8.12 and has invalid checksum with pdfbox 2.0.3.
>
> But you did not call sign(externalSigning.getContent()), that is the 
> problem. So your code leaves it unclear where your signature came 
> from, i.e. whether it was calculated from the full PDF minus the 
> signature content area.
>
> Tilman
>
>
>>
>> Best regards
>> Petr Masopust
>>
>> On 28.6.2017 10:04, Tilman Hausherr wrote:
>>> Am 28.06.2017 um 09:55 schrieb Petr Masopust:
>>>>
>>>>                 final ExternalSigningSupport externalSigningSupport 
>>>> = doc.saveIncrementalForExternalSigning(sink);
>>>> externalSigningSupport.setSignature(signatureEncoded); 
>>>
>>>
>>> It's too difficult to read your hex dump. However your code above 
>>> looks weird: signatureEncoded is never computed. In the 
>>> CreateVisibleSignature sample code, it looks like this:
>>>
>>>
>>>                 ExternalSigningSupport externalSigning = 
>>> doc.saveIncrementalForExternalSigning(fos);
>>>                 // invoke external signature service
>>>                 byte[] cmsSignature = 
>>> sign(externalSigning.getContent());
>>>
>>>                 externalSigning.setSignature(cmsSignature);
>>>
>>>                 doc.close();
>>>
>>>                 signatureOptions.close();
>>>
>>>
>>> I strongly recommend to start with the sample code.
>>>
>>> Tilman
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>
>>
>>
>> -- 
>>
>> *Petr Masopust*
>> Programátor analytik
>>
>> ------------------------------------------------------------------------
>>
>> *ICZ a.s.*
>> Na hřebenech II 1718/10
>> 140 00 Praha 4
>> Česká republika
>> www.i.cz
>>
>> *Tel.:* +420 222 271 578
>> *GSM:* +420 724 429 623
>> *Fax:* +420 222 271 112
>> *E-mail:* petr.masopust@i.cz
>>
>
>


-- 

*Petr Masopust*
Programátor analytik

------------------------------------------------------------------------

*ICZ a.s.*
Na hřebenech II 1718/10
140 00 Praha 4
Česká republika
www.i.cz

*Tel.:* +420 222 271 578
*GSM:* +420 724 429 623
*Fax:* +420 222 271 112
*E-mail:* petr.masopust@i.cz


Mime
View raw message