You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Alexis Suter (JIRA)" <ji...@apache.org> on 2017/12/06 16:46:00 UTC

[jira] [Comment Edited] (PDFBOX-4020) Into existing signature embedded signed timestamp for validation

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

Alexis Suter edited comment on PDFBOX-4020 at 12/6/17 4:45 PM:
---------------------------------------------------------------

Thank you for the feedback. Things I've changed:
* Removed boolean parameter in addSignedTimeStamp. Added comment.
* Removed CertSignatureInformation because it is useless for Timestamping. Will be needed for Cert-Validation, but needs refactoring. Makes point 2 obsolete
* Added getRelevantSignature in CreateEmbeddedTimestamp. (instead of using CertSignatureInformation) now gets the last signature by the byterange. Also checks if this signature is of type Sig
* cleaned ShowSignature
* replaced printstackstrace
EDIT: misunderstood the getLastSignatureDictionary-problematic
hope it is ok to append the changed method:
{code:java}
    private void getRelevantSignature(PDDocument document) throws IOException
    {
        SortedMap<Integer, PDSignature> sortedMap = new TreeMap<>();
        for (PDSignature signature : document.getSignatureDictionaries())
        {
            int sigOffset = signature.getByteRange()[1];
            sortedMap.put(sigOffset, signature);
        }
        if (sortedMap.size() > 0)
        {
            PDSignature lastSignature = sortedMap.get(sortedMap.lastKey());
            COSBase type = lastSignature.getCOSObject().getItem(COSName.TYPE);
            if (type.equals(COSName.SIG))
            {
                signature = lastSignature;
            }
        }
    }
{code}



was (Author: easerider):
Thank you for the feedback. Things I've changed:
* Removed boolean parameter in addSignedTimeStamp. Added comment.
* Removed CertSignatureInformation because it is useless for Timestamping. Will be needed for Cert-Validation, but needs refactoring. Makes point 2 obsolete
* Added getRelevantSignature in CreateEmbeddedTimestamp. (instead of using CertSignatureInformation) now it is using PDDocument::getLastSignatureDictionary. Thanks for the hint.
* cleaned ShowSignature
* replaced printstackstrace

> Into existing signature embedded signed timestamp for validation
> ----------------------------------------------------------------
>
>                 Key: PDFBOX-4020
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4020
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Signing
>    Affects Versions: 2.0.8
>            Reporter: Alexis Suter
>         Attachments: SignatureValidation_Embedded_Timestamping.java.patch, SignatureValidation_Embedded_Timestamping_v0.2.java.patch, SignatureValidation_Embedded_Timestamping_v0.3.java.patch, signed_ts_ocsp.pdf
>
>
> I would like to contribute a new example for embedded Timestamping.
> The Timestamp is beeing embedded into the existing Signature (which has so be prepared big enough for it). So that the document does not get changed. 
> This Step is a preparation for the LTV and includes some reorganisation for Validation-Purposes.
> I am still working on embedding the OCSP-Data, wich will take a bit longer. For that I have excluded and commented out the Code for it, to avoid confusion.
> Possible Usage:
> {code:java}
> exec:java -X -Dexec.mainClass="org.apache.pdfbox.examples.signature.validation.CreateEmbeddedValidation" -Dexec.args="${infile} -tsa ${tsa}"
> {code}
> CreateSignature has been changed to add SignatureOptions, where we can choose the size of the signature.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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