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

Tilman Hausherr updated PDFBOX-5157:
------------------------------------
    Description: 
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}

  was:
To make TestCreateSignature.testCreateSignedTimeStamp()  timestamp.pdf 
(ETSI.RFC3161) conformant with LTV, I had to enhance AddValidationInformation :

 

### 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());


> allow to make timestamp only signature "LTV"
> --------------------------------------------
>
>                 Key: PDFBOX-5157
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5157
>             Project: PDFBox
>          Issue Type: Improvement
>    Affects Versions: 3.0.0 PDFBox
>            Reporter: Ralf Hauser
>            Priority: Minor
>
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to