aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas/api/commons
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas/api/commons')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java77
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/commons/SignatureInformation.java97
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java29
3 files changed, 203 insertions, 0 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java b/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java
new file mode 100644
index 0000000..e8ebc16
--- /dev/null
+++ b/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java
@@ -0,0 +1,77 @@
+/**
+ *
+ */
+package at.gv.egiz.pdfas.api.commons;
+
+/**
+ * Contains commonly used constants.
+ *
+ * @author wprinz
+ */
+public final class Constants
+{
+
+ /**
+ * Hidden default constructor.
+ */
+ private Constants()
+ {
+ // empty
+ }
+
+ /**
+ * A binary signature.
+ */
+ public static String SIGNATURE_TYPE_BINARY = "binary";
+
+ /**
+ * A textual signature.
+ */
+ public static String SIGNATURE_TYPE_TEXTUAL = "textual";
+
+ /**
+ * A "detached" textual signature.
+ *
+ * <p>
+ * The document text is signed, but instead of returning the pdf with the signature block,
+ * the sign result XML of the connector is returned.
+ * </p>
+ */
+ public static String SIGNATURE_TYPE_DETACHEDTEXTUAL = "detachedtextual";
+
+ /**
+ * The signature device moa.
+ */
+ public static String SIGNATURE_DEVICE_MOA = "moa";
+
+ /**
+ * The signature device bku.
+ */
+ public static String SIGNATURE_DEVICE_BKU = "bku";
+
+ /**
+ * Only binary signatures are verified.
+ */
+ public static String VERIFY_MODE_BINARY_ONLY = "binaryOnly";
+
+ /**
+ * Binary and textual signatures are verified with time optimization.
+ *
+ * <p>
+ * This mode of operation tries to minimize the numbers of text extractions,
+ * which are very time intensive, at the cost of some rare cases, in which some
+ * signatures may not be found.
+ * </p>
+ */
+ public static String VERIFY_MODE_SEMI_CONSERVATIVE = "semiConservative";
+
+ /**
+ * Binary and textual signatures are verified.
+ */
+ public static String VERIFY_MODE_FULL_CONSERVATIVE = "fullConservative";
+
+ /**
+ * All signatures are verified.
+ */
+ public static int VERIFY_ALL = -1;
+}
diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureInformation.java b/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureInformation.java
new file mode 100644
index 0000000..d8c2a34
--- /dev/null
+++ b/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureInformation.java
@@ -0,0 +1,97 @@
+/**
+ * <copyright> Copyright (c) 2006 by Know-Center, Graz, Austria </copyright>
+ *
+ * This software is the confidential and proprietary information of Know-Center,
+ * Graz, Austria. You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement you entered
+ * into with Know-Center.
+ *
+ * KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
+ * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+ * NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
+ * LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
+ * DERIVATIVES.
+ *
+ * $Id: SignatureHolder.java,v 1.3 2006/10/11 07:57:58 wprinz Exp $
+ */
+package at.gv.egiz.pdfas.api.commons;
+
+import java.security.cert.X509Certificate;
+import java.util.Date;
+
+import at.gv.egiz.pdfas.api.io.DataSource;
+
+/**
+ * Holds the information of one found signature block, which is the signed data
+ * and the corresponding signature information.
+ *
+ * @author wprinz
+ */
+public interface SignatureInformation
+{
+ /**
+ * Returns the type of this signature (binary/textual).
+ *
+ * <p>
+ * May be {@link Constants#SIGNATURE_TYPE_BINARY} or
+ * {@link Constants#SIGNATURE_TYPE_TEXTUAL}.
+ * </p>
+ *
+ * @return Returns the type of this signature (binary/textual).
+ */
+ public String getSignatureType();
+
+ /**
+ * Returns the DataSource providing the data that was signed.
+ *
+ * <p>
+ * Note that this is the signed data as sent to the verification device by
+ * PDF-AS. The verification device (e.g. MOA) may perform several other
+ * transformations on the data before feeding it to the signature hash
+ * function. To get the actual hashed data use the ReturnHashInputData mechanism (which is very slow).
+ * </p>
+ *
+ * @return Returns the DataSource providing the data that was signed.
+ *
+ * @see at.gv.egiz.pdfas.api.verify.VerifyParameters#setReturnHashInputData(boolean)
+ * @see at.gv.egiz.pdfas.api.verify.VerifyResult#getHashInputData()
+ *
+ */
+ public DataSource getSignedData();
+
+ /**
+ * Returns the certificate of the signer.
+ *
+ * <p>
+ * Information like subject name, issuer name or serial number can be
+ * retrieved form this certificate.
+ * </p>
+ *
+ * @return Returns the certificate of the signer.
+ */
+ public X509Certificate getSignerCertificate();
+
+ /**
+ * Returns the signing time, which is the time when the signature was created.
+ *
+ * @return Returns the signing time, which is the time when the signature was
+ * created.
+ */
+ public Date getSigningTime();
+
+ /**
+ * Returns additional, internal information about the found signature.
+ *
+ * <p>
+ * Note that this provides a way for developers to gather core information
+ * about the signature. What information is returned strongly depends on the
+ * core implementation.
+ * </p>
+ *
+ * @return Returns additional, internal information about the signature. Null
+ * means that no additional information is available.
+ */
+ public Object getInternalSignatureInformation();
+
+} \ No newline at end of file
diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java b/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java
new file mode 100644
index 0000000..52bd27f
--- /dev/null
+++ b/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java
@@ -0,0 +1,29 @@
+/**
+ *
+ */
+package at.gv.egiz.pdfas.api.commons;
+
+/**
+ * Definition of a signature profile.
+ *
+ * @author wprinz
+ */
+public interface SignatureProfile
+{
+ // TODO: the full profile information will be implemented in future
+
+ /**
+ * Returns the profile id.
+ *
+ * @return Returns the profile id.
+ */
+ public String getProfileId();
+
+ /**
+ * Returns the MOA KeyIdentifier.
+ *
+ * @return Returns the MOA KeyIdentifier.
+ */
+ public String getMOAKeyIdentifier();
+
+}