From 63784f692a50606f34702706761edac052fdac60 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Thu, 16 Oct 2014 12:45:01 +0200 Subject: Introduced PDF-AS Backends, removed all pdfbox specific code to pdfbox backend --- .../sigs/pkcs7detached/PKCS7DetachedConstants.java | 6 ++++++ .../pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java | 7 +++---- .../pdfas/sigs/pkcs7detached/PKCS7DetachedVerifier.java | 17 ++--------------- 3 files changed, 11 insertions(+), 19 deletions(-) create mode 100644 signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedConstants.java (limited to 'signature-standards/sigs-pkcs7detached/src/main/java/at/gv') diff --git a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedConstants.java b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedConstants.java new file mode 100644 index 00000000..f9c9b8fd --- /dev/null +++ b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedConstants.java @@ -0,0 +1,6 @@ +package at.gv.egiz.pdfas.sigs.pkcs7detached; + +public interface PKCS7DetachedConstants { + public static final String SUBFILTER_ADBE_PKCS7_DETACHED = "adbe.pkcs7.detached"; + public static final String FILTER_ADOBE_PPKLITE = "Adobe.PPKLite"; +} diff --git a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java index 5dbf6bac..61d4a5ec 100644 --- a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java +++ b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java @@ -43,7 +43,6 @@ import java.security.PrivateKey; import java.security.cert.Certificate; import java.util.Date; -import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,7 +56,7 @@ import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; * Creates a PKCS7 detached PDF signature * */ -public class PKCS7DetachedSigner implements IPlainSigner { +public class PKCS7DetachedSigner implements IPlainSigner, PKCS7DetachedConstants { private static final Logger logger = LoggerFactory .getLogger(PKCS7DetachedSigner.class); @@ -119,11 +118,11 @@ public class PKCS7DetachedSigner implements IPlainSigner { } public String getPDFSubFilter() { - return PDSignature.SUBFILTER_ADBE_PKCS7_DETACHED.getName(); + return SUBFILTER_ADBE_PKCS7_DETACHED; } public String getPDFFilter() { - return PDSignature.FILTER_ADOBE_PPKLITE.getName(); + return FILTER_ADOBE_PPKLITE; } } diff --git a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedVerifier.java b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedVerifier.java index fb7fa5ab..be919046 100644 --- a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedVerifier.java +++ b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedVerifier.java @@ -23,35 +23,23 @@ ******************************************************************************/ package at.gv.egiz.pdfas.sigs.pkcs7detached; -import iaik.asn1.ObjectID; -import iaik.asn1.structures.AlgorithmID; -import iaik.cms.ContentInfo; -import iaik.cms.SignedData; -import iaik.cms.SignerInfo; -import iaik.x509.X509Certificate; - -import java.io.ByteArrayInputStream; -import java.security.SignatureException; import java.util.ArrayList; import java.util.Date; import java.util.List; -import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; -import at.gv.egiz.pdfas.common.exceptions.PdfAsSignatureException; import at.gv.egiz.pdfas.common.utils.PDFUtils; import at.gv.egiz.pdfas.lib.api.Configuration; import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; import at.gv.egiz.pdfas.lib.impl.verify.FilterEntry; import at.gv.egiz.pdfas.lib.impl.verify.IVerifier; import at.gv.egiz.pdfas.lib.impl.verify.IVerifyFilter; -import at.gv.egiz.pdfas.lib.impl.verify.SignatureCheckImpl; import at.gv.egiz.pdfas.lib.impl.verify.VerifyResultImpl; -public class PKCS7DetachedVerifier implements IVerifyFilter { +public class PKCS7DetachedVerifier implements IVerifyFilter, PKCS7DetachedConstants { private static final Logger logger = LoggerFactory.getLogger(PKCS7DetachedVerifier.class); @@ -78,8 +66,7 @@ public class PKCS7DetachedVerifier implements IVerifyFilter { public List getFiters() { List result = new ArrayList(); - result.add(new FilterEntry(PDSignature.FILTER_ADOBE_PPKLITE, PDSignature.SUBFILTER_ADBE_PKCS7_DETACHED)); - //result.add(new FilterEntry(PDSignature.FILTER_ADOBE_PPKLITE, PDSignature.SUBFILTER_ETSI_CADES_DETACHED)); + result.add(new FilterEntry(FILTER_ADOBE_PPKLITE, SUBFILTER_ADBE_PKCS7_DETACHED)); return result; } -- cgit v1.2.3