diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-10-16 12:45:01 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-10-16 12:45:01 +0200 |
commit | 63784f692a50606f34702706761edac052fdac60 (patch) | |
tree | 50f78a92c35cdfced053209a334944acdee2b983 /signature-standards | |
parent | 7b105bafe5a1f4c01224c8ae0b820a478b09447f (diff) | |
download | pdf-as-4-63784f692a50606f34702706761edac052fdac60.tar.gz pdf-as-4-63784f692a50606f34702706761edac052fdac60.tar.bz2 pdf-as-4-63784f692a50606f34702706761edac052fdac60.zip |
Introduced PDF-AS Backends, removed all pdfbox specific code to pdfbox backend
Diffstat (limited to 'signature-standards')
7 files changed, 28 insertions, 36 deletions
diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESConstants.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESConstants.java new file mode 100644 index 00000000..c27d7467 --- /dev/null +++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESConstants.java @@ -0,0 +1,6 @@ +package at.gv.egiz.pdfas.sigs.pades; + +public interface PAdESConstants { + public static final String SUBFILTER_ETSI_CADES_DETACHED = "ETSI.CAdES.detached"; + public static final String FILTER_ADOBE_PPKLITE = "Adobe.PPKLite"; +} diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSigner.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSigner.java index 07d3b66c..8a511c66 100644 --- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSigner.java +++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSigner.java @@ -24,19 +24,16 @@ package at.gv.egiz.pdfas.sigs.pades; import iaik.x509.X509Certificate; - -import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature; - import at.gv.egiz.pdfas.common.exceptions.PdfAsException; import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; import at.gv.egiz.pdfas.lib.api.sign.SignParameter; import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; +import at.gv.egiz.sl.util.ISLConnector; import at.gv.egiz.sl.util.ISignatureConnector; import at.gv.egiz.sl.util.ISignatureConnectorSLWrapper; -import at.gv.egiz.sl.util.ISLConnector; - -public class PAdESSigner implements IPlainSigner { +public class PAdESSigner implements IPlainSigner, PAdESConstants { + private ISignatureConnector plainSigner; public PAdESSigner(ISLConnector connector) { @@ -57,11 +54,11 @@ public class PAdESSigner implements IPlainSigner { } public String getPDFSubFilter() { - return PDSignature.SUBFILTER_ETSI_CADES_DETACHED.getName(); + return SUBFILTER_ETSI_CADES_DETACHED; } public String getPDFFilter() { - return PDSignature.FILTER_ADOBE_PPKLITE.getName(); + return FILTER_ADOBE_PPKLITE; } } diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java index 002475eb..220cf6e2 100644 --- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java +++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java @@ -54,7 +54,6 @@ 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; @@ -65,9 +64,8 @@ import at.gv.egiz.pdfas.lib.api.sign.SignParameter; import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; import at.gv.egiz.pdfas.lib.util.CertificateUtils; -public class PAdESSignerKeystore implements IPlainSigner { +public class PAdESSignerKeystore implements IPlainSigner, PAdESConstants { - @SuppressWarnings("unused") private static final Logger logger = LoggerFactory .getLogger(PAdESSignerKeystore.class); @@ -257,11 +255,11 @@ public class PAdESSignerKeystore implements IPlainSigner { } public String getPDFSubFilter() { - return PDSignature.SUBFILTER_ETSI_CADES_DETACHED.getName(); + return SUBFILTER_ETSI_CADES_DETACHED; } public String getPDFFilter() { - return PDSignature.FILTER_ADOBE_PPKLITE.getName(); + return FILTER_ADOBE_PPKLITE; } } diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java index d1e185ab..a4ef703e 100644 --- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java +++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java @@ -27,7 +27,6 @@ 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; @@ -40,7 +39,7 @@ 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.VerifyResultImpl; -public class PAdESVerifier implements IVerifyFilter { +public class PAdESVerifier implements IVerifyFilter, PAdESConstants { private static final Logger logger = LoggerFactory .getLogger(PAdESVerifier.class); @@ -73,8 +72,8 @@ public class PAdESVerifier implements IVerifyFilter { public List<FilterEntry> getFiters() { List<FilterEntry> result = new ArrayList<FilterEntry>(); - result.add(new FilterEntry(PDSignature.FILTER_ADOBE_PPKLITE, - PDSignature.SUBFILTER_ETSI_CADES_DETACHED)); + result.add(new FilterEntry(FILTER_ADOBE_PPKLITE, + SUBFILTER_ETSI_CADES_DETACHED)); return result; } 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<FilterEntry> getFiters() { List<FilterEntry> result = new ArrayList<FilterEntry>(); - 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; } |