From 1a0677846f1394054af6b1f733b8d50bf508e223 Mon Sep 17 00:00:00 2001
From: junglue <30685147+junglue@users.noreply.github.com>
Date: Mon, 25 Jun 2018 08:45:35 +0200
Subject: [PATCH 1/2] Update README.md
---
README.md | 65 +++----------------------------------------------------
1 file changed, 3 insertions(+), 62 deletions(-)
diff --git a/README.md b/README.md
index d1885b9c6..ec7c1a834 100644
--- a/README.md
+++ b/README.md
@@ -1,68 +1,9 @@
# OpenPDF is a Java PDF library, forked from iText #
+This is a fork of OpenPDF (https://github.com/LibrePDF/OpenPDF).
-OpenPDF is a Java library for creating and editing PDF files with a LGPL and MPL open source license. OpenPDF is based on a fork of iText 4. We welcome contributions from other developers. Please feel free to submit pull-requests and bugreports to this GitHub repository.
-
-[![Join the chat at https://gitter.im/LibrePDF/OpenPDF](https://badges.gitter.im/LibrePDF/OpenPDF.svg)](https://gitter.im/LibrePDF/OpenPDF) [![Build Status](https://travis-ci.org/LibrePDF/OpenPDF.svg?branch=master)](https://travis-ci.org/LibrePDF/OpenPDF) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.librepdf/openpdf/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.librepdf/openpdf) [![License (LGPL version 3.0)](https://img.shields.io/badge/license-GNU%20LGPL%20version%203.0-blue.svg?style=flat-square)](http://opensource.org/licenses/LGPL-3.0) [![License (MPL)](https://img.shields.io/badge/license-Mozilla%20Public%20License-yellow.svg?style=flat-square)](http://opensource.org/licenses/MPL-2.0)
-
-## OpenPDF version 1.0.5 released 2017-11-16 ##
-Get version 1.0.5 here - https://github.com/LibrePDF/OpenPDF/releases/tag/1.0.5
-
-### Previous Versions
-- [Version 1.0.4](https://github.com/LibrePDF/OpenPDF/releases/tag/1.0.4) _released 2017-10-11_
-- [Version 1.0.3](https://github.com/LibrePDF/OpenPDF/releases/tag/1.0.3) _released 2017-07-24_
-- [Version 1.0.2](https://github.com/LibrePDF/OpenPDF/releases/tag/1.0.2) _released 2017-06-03_
-- [Version 1.0.1](https://github.com/LibrePDF/OpenPDF/releases/tag/1.0.1) _released 2017-01-28_
-- [Version 1.0](https://github.com/LibrePDF/OpenPDF/releases/tag/1.0) _released 2016-05-03_
+## Contributing ##
+Please contribute to the original OpenPDF repository, https://github.com/LibrePDF/OpenPDF.
## License ##
-
GNU General Lesser Public License (LGPL) version 3.0 - http://www.gnu.org/licenses/lgpl.html
-
Mozilla Public License Version 2.0 - http://www.mozilla.org/MPL/2.0/
-
-
-## Use OpenPDF as Maven dependency
-Add this to your pom.xml file:
-
-
- com.github.librepdf
- openpdf
- 1.0.5
-
-
-
-## Background ##
-
-Beginning with version 5.0 of iText, the developers have moved to the AGPL to improve their ability to sell commercial licenses.
-The OpenPDF project is a fork of iText 4, with a LGPL and MPL open source license.
-
-## Changes ##
-This repo has the following changes from the old "original" 4.2.0 version:
- - compilation now also supports Java 8, but compatibility level in maven pom is set to Java 7
- - in the case of unexpected end of PDF file the IOException is thrown (not PDFNull)
- - merged patch from Steven to fix NPE in XFA Form (escapeSom method)
- - merged UnembedFontPdfSmartCopy functionality from Vicente Alencar
- - merged RTF Footer functionality from ubermichael
- - compatibility fix to support the newest (1.54) bouncy castle libraries based/inspired by flex-developments fixes
- - some NPE fixes and tweaked maven support
-
-## Contributing ##
-Release the hounds! Please send all pull requests.
-
-## Dependencies ##
-
-### Required: ###
-
- - BouncyCastle 1.58
- - Provider
- - PKIX/CMS
- - PDFRenderer
- - DOM4j
-
-### Optional: ###
-
- - JUnit 4 - for unit testing
- - JFreeChart - for testing graphical examples
- - JFreeChart
- - JCommon
- - Servlet
From 54a0109ad7ec55dd61ec6ccb741707a73598d0e5 Mon Sep 17 00:00:00 2001
From: Beat Weisskopf
Date: Fri, 8 Mar 2019 09:59:18 +0100
Subject: [PATCH 2/2] fixes upstream issue #160
---
.../src/main/java/com/lowagie/text/pdf/PdfPKCS7.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java
index 7c78be137..c6bf30d6e 100755
--- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java
+++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java
@@ -118,6 +118,7 @@
import com.lowagie.text.error_messages.MessageLocalization;
+import org.bouncycastle.asn1.BERTaggedObject;
/**
* This class does all the processing related to signing and verifying a PKCS#7
@@ -421,8 +422,11 @@ public PdfPKCS7(byte[] contentsKey, String provider) {
throw new IllegalArgumentException(
MessageLocalization
.getComposedMessage("not.a.valid.pkcs.7.object.not.signed.data"));
- ASN1Sequence content = (ASN1Sequence) ((DERTaggedObject) signedData
- .getObjectAt(1)).getObject();
+ ASN1Sequence content = (ASN1Sequence) (
+ (signedData.getObjectAt(1) instanceof BERTaggedObject) ?
+ (BERTaggedObject) signedData.getObjectAt(1) :
+ (DERTaggedObject) signedData.getObjectAt(1))
+ .getObject();
// the positions that we care are:
// 0 - version
// 1 - digestAlgorithms
@@ -460,7 +464,8 @@ public PdfPKCS7(byte[] contentsKey, String provider) {
// the signerInfos
int next = 3;
- while (content.getObjectAt(next) instanceof DERTaggedObject)
+ while (content.getObjectAt(next) instanceof DERTaggedObject ||
+ content.getObjectAt(next) instanceof BERTaggedObject)
++next;
ASN1Set signerInfos = (ASN1Set) content.getObjectAt(next);
if (signerInfos.size() != 1)