From 3f1918c831c919d0a8fcf18c36cf40118398b995 Mon Sep 17 00:00:00 2001 From: Marc Vinyals <943473-marcvinyals@users.noreply.gitlab.com> Date: Tue, 17 Oct 2023 21:51:23 +1300 Subject: [PATCH] Update dependencies --- .gitlab-ci.yml | 2 +- build.gradle | 4 ++-- ivy.xml | 6 +++--- .../pdftk_java/com/lowagie/text/pdf/PdfPKCS7.java | 10 +++++++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3a0ef2..c3985ae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ php-pdftk: extends: .ant-job script: - ant -lib /usr/share/java - - echo -e '#!/bin/bash\njava -cp' `pwd`'/build/jar/pdftk.jar:'`pwd`'/lib/bcprov-jdk18on-1.71.jar:'`pwd`'/lib/commons-lang3-3.12.0.jar com.gitlab.pdftk_java.pdftk "$@"' > /usr/bin/pdftk + - echo -e '#!/bin/bash\njava -cp' `pwd`'/build/jar/pdftk.jar:'`pwd`'/lib/bcprov-jdk18on-1.76.jar:'`pwd`'/lib/commons-lang3-3.12.0.jar com.gitlab.pdftk_java.pdftk "$@"' > /usr/bin/pdftk - chmod +x /usr/bin/pdftk - apt-get install php-mbstring php-xml composer -yqq - git clone --depth 1 https://github.com/marcvinyals/php-pdftk diff --git a/build.gradle b/build.gradle index 085b6f9..9f90074 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'application' - id 'com.diffplug.spotless' version '6.10.0' + id 'com.diffplug.spotless' version '6.13.0' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.mikeneck.graalvm-native-image' version '1.4.1' } @@ -33,7 +33,7 @@ repositories { dependencies { implementation 'org.apache.commons:commons-lang3:3.12.0' - implementation 'org.bouncycastle:bcprov-jdk18on:1.71' + implementation 'org.bouncycastle:bcprov-jdk18on:1.76' } nativeImage { diff --git a/ivy.xml b/ivy.xml index 700b1eb..14e7c07 100644 --- a/ivy.xml +++ b/ivy.xml @@ -6,10 +6,10 @@ - + - + - + diff --git a/java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfPKCS7.java b/java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfPKCS7.java index 990d492..bd33e93 100644 --- a/java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfPKCS7.java +++ b/java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfPKCS7.java @@ -50,6 +50,10 @@ * you aren't using an obsolete version: * http://www.lowagie.com/iText/ */ + +// pdftk-java iText base version 4.2.0 +// pdftk-java modified yes (compatibility with modern bcprov) + package com.gitlab.pdftk_java.com.lowagie.text.pdf; import java.io.ByteArrayInputStream; @@ -225,7 +229,7 @@ public class PdfPKCS7 { ASN1ObjectIdentifier objId = (ASN1ObjectIdentifier)signedData.getObjectAt(0); if (!objId.getId().equals(ID_PKCS7_SIGNED_DATA)) throw new SecurityException("Not a valid PKCS#7 object - not signed data"); - ASN1Sequence content = (ASN1Sequence)((DERTaggedObject)signedData.getObjectAt(1)).getObject(); + ASN1Sequence content = (ASN1Sequence)((DERTaggedObject)signedData.getObjectAt(1)).getBaseObject(); // the positions that we care are: // 0 - version // 1 - digestAlgorithms @@ -258,7 +262,7 @@ public class PdfPKCS7 { // the possible ID_PKCS7_DATA ASN1Sequence rsaData = (ASN1Sequence)content.getObjectAt(2); if (rsaData.size() > 1) { - DEROctetString rsaDataContent = (DEROctetString)((DERTaggedObject)rsaData.getObjectAt(1)).getObject(); + DEROctetString rsaDataContent = (DEROctetString)((DERTaggedObject)rsaData.getObjectAt(1)).getBaseObject(); RSAdata = rsaDataContent.getOctets(); } @@ -294,7 +298,7 @@ public class PdfPKCS7 { next = 3; if (signerInfo.getObjectAt(next) instanceof ASN1TaggedObject) { ASN1TaggedObject tagsig = (ASN1TaggedObject)signerInfo.getObjectAt(next); - ASN1Sequence sseq = (ASN1Sequence)tagsig.getObject(); + ASN1Sequence sseq = (ASN1Sequence)tagsig.getBaseObject(); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); ASN1OutputStream dout = ASN1OutputStream.create(bOut); try { -- GitLab