You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2021/04/13 17:20:00 UTC

[jira] [Resolved] (PDFBOX-5157) allow to make timestamp only signature "LTV"

     [ https://issues.apache.org/jira/browse/PDFBOX-5157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr resolved PDFBOX-5157.
-------------------------------------
      Assignee: Tilman Hausherr
    Resolution: Fixed

> allow to make timestamp only signature "LTV"
> --------------------------------------------
>
>                 Key: PDFBOX-5157
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5157
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Signing
>    Affects Versions: 2.0.23, 3.0.0 PDFBox
>            Reporter: Ralf Hauser
>            Assignee: Tilman Hausherr
>            Priority: Minor
>             Fix For: 2.0.24, 3.0.0 PDFBox
>
>         Attachments: timestamped_PDFBOX-5157.pdf
>
>
> To make TestCreateSignature.testCreateSignedTimeStamp()  timestamp.pdf (ETSI.RFC3161) conformant with LTV, I had to enhance AddValidationInformation :
>  
> {noformat}
> ### Eclipse Workspace Patch 1.0
> #P pdfbox
> Index: examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java
> ===================================================================
> --- examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java (revision 1885032)
> +++ examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java (working copy)
> @@ -30,6 +30,7 @@
>  import java.security.cert.X509CRL;
>  import java.security.cert.X509Certificate;
>  import java.util.Calendar;
> +import java.util.Date;
>  import java.util.HashSet;
>  import java.util.Set;
>  
> @@ -355,9 +356,15 @@
>  // This certificate has been OCSP-checked before
>  return;
>  }
> - OcspHelper ocspHelper = new OcspHelper(
> + Date time = null;
> + if (null == signDate) {
> + time = new Date(); //should rather take timestampTime
> + } else {
> + time = signDate.getTime();
> + }
> + OcspHelper ocspHelper = new OcspHelper(
>  certInfo.getCertificate(),
> - signDate.getTime(),
> + time,
>  certInfo.getIssuerCertificate(),
>  new HashSet<>(certInformationHelper.getCertificateSet()),
>  certInfo.getOcspUrl());
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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