You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2020/07/21 15:52:26 UTC
svn commit: r1880110 -
/pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java
Author: tilman
Date: Tue Jul 21 15:52:25 2020
New Revision: 1880110
URL: http://svn.apache.org/viewvc?rev=1880110&view=rev
Log:
PDFBOX-3017: first certificate isn't always the correct one; fix javadoc; use correct source file
Modified:
pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java
Modified: pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java?rev=1880110&r1=1880109&r2=1880110&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java (original)
+++ pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java Tue Jul 21 15:52:25 2020
@@ -138,6 +138,7 @@ public class TestCreateSignature
* @throws CMSException
* @throws OperatorCreationException
* @throws TSPException
+ * @throws CertificateVerificationException
*/
@Test
public void testDetachedSHA256()
@@ -184,6 +185,7 @@ public class TestCreateSignature
* @throws CMSException
* @throws OperatorCreationException
* @throws TSPException
+ * @throws CertificateVerificationException
*/
@Test
public void testDetachedSHA256WithTSA()
@@ -247,6 +249,7 @@ public class TestCreateSignature
* @throws OperatorCreationException
* @throws GeneralSecurityException
* @throws TSPException
+ * @throws CertificateVerificationException
*/
@Test
public void testCreateVisibleSignature()
@@ -258,7 +261,7 @@ public class TestCreateSignature
keystore.load(new FileInputStream(KEYSTORE_PATH), PASSWORD.toCharArray());
// sign PDF
- String inPath = IN_DIR + "sign_me.pdf";
+ String inPath = IN_DIR + "sign_me_visible.pdf";
File destFile;
try (FileInputStream fis = new FileInputStream(JPEG_PATH))
{
@@ -286,6 +289,7 @@ public class TestCreateSignature
* @throws OperatorCreationException
* @throws GeneralSecurityException
* @throws TSPException
+ * @throws CertificateVerificationException
*/
@Test
public void testPDFBox3978() throws IOException, NoSuchAlgorithmException, KeyStoreException,
@@ -422,7 +426,8 @@ public class TestCreateSignature
Store<X509CertificateHolder> tsCertStore = timeStampToken.getCertificates();
// get the certificate from the timeStampToken
- Collection<X509CertificateHolder> tsCertStoreMatches = tsCertStore.getMatches(null);
+ @SuppressWarnings("unchecked") // TimeStampToken.getSID() is untyped
+ Collection<X509CertificateHolder> tsCertStoreMatches = tsCertStore.getMatches(timeStampToken.getSID());
X509CertificateHolder certHolderFromTimeStamp = tsCertStoreMatches.iterator().next();
X509Certificate certFromTimeStamp = new JcaX509CertificateConverter().getCertificate(certHolderFromTimeStamp);