aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-legacy/src/main/java/at/knowcenter/wag/egov/egiz/sig
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-legacy/src/main/java/at/knowcenter/wag/egov/egiz/sig')
-rw-r--r--pdf-as-legacy/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java142
1 files changed, 114 insertions, 28 deletions
diff --git a/pdf-as-legacy/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java b/pdf-as-legacy/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java
index 0897608b..07ff02de 100644
--- a/pdf-as-legacy/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java
+++ b/pdf-as-legacy/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java
@@ -25,63 +25,68 @@
*/
package at.knowcenter.wag.egov.egiz.sig;
+import org.apache.commons.lang3.ArrayUtils;
-public class SignatureTypes
-{
+public class SignatureTypes {
/**
- * Defines all supported states for {@link SignatureTypes} (signature profiles). Signature types can be enabled
- * ("on"), can be set to support signature only ("sign_only"), to verification only ("verify_only") or can be
- * disabled ("off" or any other value not covered by other enum values).
+ * Defines all supported states for {@link SignatureTypes} (signature
+ * profiles). Signature types can be enabled ("on"), can be set to support
+ * signature only ("sign_only"), to verification only ("verify_only") or can
+ * be disabled ("off" or any other value not covered by other enum values).
*
* @author Datentechnik Innovation GmbH
*/
public enum State {
-
+
/**
* Enables a signature profile.
*/
- ON ("on", "yes", "true", "enabled"),
-
+ ON("on", "yes", "true", "enabled"),
+
/**
* Disables a signature profile.
*/
- OFF (),
-
+ OFF(),
+
/**
- * Restricts the signature profile so that is can only be used for verification purposes and not for signature.
+ * Restricts the signature profile so that is can only be used for
+ * verification purposes and not for signature.
*/
- VERIFY_ONLY ("verify_only", "verify-only", "verifyonly", "verify only", "verify"),
-
+ VERIFY_ONLY("verify_only", "verify-only", "verifyonly", "verify only",
+ "verify"),
+
/**
- * Allows the signature profile to be used for signature but not for verification.
+ * Allows the signature profile to be used for signature but not for
+ * verification.
*/
- SIGN_ONLY ("sign_only", "sign-only", "signonly", "sign only", "sign");
-
+ SIGN_ONLY("sign_only", "sign-only", "signonly", "sign only", "sign");
+
/**
* Sets the default state when no valid value was provided.
*/
private static final State DEFAULT = OFF;
-
+
/**
* States that allow signatures.
*/
private static final State[] CAN_SIGN = { ON, SIGN_ONLY };
-
+
/**
* States that allow verification.
*/
private static final State[] CAN_VERIFY = { ON, VERIFY_ONLY };
-
+
private String[] keyWords;
private State(String... keyWords) {
this.keyWords = keyWords;
}
-
+
/**
- * Returns a valid State from a given {@code keyWord}. If the {@code keyWord} cannot be matched to a certain
- * state, the default State {@link #OFF} is returned.
+ * Returns a valid State from a given {@code keyWord}. If the
+ * {@code keyWord} cannot be matched to a certain state, the default
+ * State {@link #OFF} is returned.
*
* @param keyWord
* A valid keyword like "on", "sign_only"...
@@ -104,13 +109,15 @@ public class SignatureTypes
return DEFAULT;
}
}
-
+
/**
- * Returns {@code true} when the current state is one of the given candidate {@code states}.
+ * Returns {@code true} when the current state is one of the given
+ * candidate {@code states}.
*
* @param states
* The candidate states.
- * @return {@code true} when the current state is one of the given candidate states, {@code false} if not.
+ * @return {@code true} when the current state is one of the given
+ * candidate states, {@code false} if not.
*/
public boolean in(State... states) {
if (states != null) {
@@ -122,23 +129,102 @@ public class SignatureTypes
}
return false;
}
-
+
/**
* Returns if the respective state allows signatures.
+ *
* @return {@code true} if signatures are allowed, {@code false} if not.
*/
public boolean canSign() {
return in(CAN_SIGN);
}
-
+
/**
* Returns if the respective state allows verification.
- * @return {@code true} if verification is allowed, {@code false} if not.
+ *
+ * @return {@code true} if verification is allowed, {@code false} if
+ * not.
*/
public boolean canVerify() {
return in(CAN_VERIFY);
}
}
+
+ /**
+ * Standard key get/set the singature name
+ */
+ public static final String SIG_NAME = "SIG_NAME";
+
+ /**
+ * Standard key get/set the signature date
+ */
+ public static final String SIG_DATE = "SIG_DATE";
+
+ /**
+ * Standard key get/set the signator issuer
+ */
+ public static final String SIG_ISSUER = "SIG_ISSUER";
+
+ /**
+ * Standard key get/set the siganture value
+ */
+ public static final String SIG_VALUE = "SIG_VALUE";
+ /**
+ * Standard key get/set the normalisation method used
+ */
+ public static final String SIG_NORM = "SIG_NORM";
+
+ /**
+ * Standard key get/set the signation id's used by BKU signated documents
+ */
+ public static final String SIG_ID = "SIG_ID";
+
+ /**
+ * The EGIZ Algorithm "Kennzeichnung".
+ */
+ public static final String SIG_KZ = "SIG_KZ";
+
+ /**
+ * Standard key get/set the reference to the signature label (image mark)
+ */
+ public static final String SIG_LABEL = "SIG_LABEL";
+
+ /**
+ * Standard key get/set the serial number of the signature
+ */
+ public static final String SIG_NUMBER = "SIG_NUMBER";
+
+ // public static final String SIG_TYPE = "SIG_TYPE";
+ /**
+ * Standard key get/set the signature meta informations
+ */
+ public static final String SIG_META = "SIG_META";
+
+ /**
+ * Standard key get/set the signature algorithm (sign + hash)
+ */
+ public static final String SIG_ALG = "SIG_ALG";
+
+ /**
+ * Standard key get/set the signature note
+ * added by rpiazzi
+ */
+ public static final String SIG_NOTE = "SIG_NOTE";
+
+
+ /**
+ * Standard key get/set the signature subject
+ * Added to be able to define static signator name within config file
+ * added by rpiazzi
+ */
+ public static final String SIG_SUBJECT = "SIG_SUBJECT";
+
+ public static String[] REQUIRED_SIG_KEYS = new String[] { SIG_DATE,
+ SIG_ISSUER, SIG_VALUE, SIG_NUMBER, SIG_ID, SIG_KZ };
+
+ public static boolean isRequredSigTypeKey(String name) {
+ return ArrayUtils.contains(REQUIRED_SIG_KEYS, name);
+ }
} \ No newline at end of file