diff options
author | ferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2009-11-02 09:27:49 +0000 |
---|---|---|
committer | ferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2009-11-02 09:27:49 +0000 |
commit | 65a98c4640f7ddb9d0ab3c5061ba42dd6169c202 (patch) | |
tree | 589310b042cc3426e15c6982d88d981bdfe9dad4 /src/main | |
parent | 075463c79ab00f0a700d7260b28c470b5b56e669 (diff) | |
download | pdf-as-3-65a98c4640f7ddb9d0ab3c5061ba42dd6169c202.tar.gz pdf-as-3-65a98c4640f7ddb9d0ab3c5061ba42dd6169c202.tar.bz2 pdf-as-3-65a98c4640f7ddb9d0ab3c5061ba42dd6169c202.zip |
added algorithm
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@384 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java index 67d5497..1d7895e 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java @@ -5,8 +5,15 @@ package at.knowcenter.wag.egov.egiz.sig.connectors.bku; import java.io.Serializable;
import java.security.cert.X509Certificate;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Properties;
+import org.apache.tools.ant.taskdefs.Length;
+
+import at.gv.egiz.pdfas.algorithmSuite.AlgorithmSuiteUtil;
+import at.knowcenter.wag.egov.egiz.sig.SignatureTypes;
import at.knowcenter.wag.egov.egiz.sig.signatureobject.AdditionalSignatureInformation;
import at.knowcenter.wag.egov.egiz.sig.signatureobject.AlgorithmSignatureInformation;
import at.knowcenter.wag.egov.egiz.sig.signatureobject.ConnectorSignatureInformation;
@@ -30,6 +37,8 @@ public class SignSignatureObject implements Serializable, MandatorySignatureInfo public String id = null;
public String kz = null;
+ public String sigAlgorithm;
+
/**
* This is used to transport the response properties to the Detached signator.
*/
@@ -107,5 +116,103 @@ public class SignSignatureObject implements Serializable, MandatorySignatureInfo {
return this.x509Certificate;
}
+
+ public String getSigAlgorithm() {
+ return this.sigAlgorithm;
+ }
+
+ public String retrieveStringValue(String sigKey)
+ {
+ // mandatory
+ if (sigKey.equals(SignatureTypes.SIG_DATE))
+ {
+ return getDate();
+ }
+ if (sigKey.equals(SignatureTypes.SIG_VALUE))
+ {
+ return getSignatureValue();
+ }
+ if (sigKey.equals(SignatureTypes.SIG_ISSUER))
+ {
+ return getIssuer();
+ }
+ if (sigKey.equals(SignatureTypes.SIG_NUMBER))
+ {
+ return getSerialNumber();
+ }
+
+ // connector
+ if (sigKey.equals(SignatureTypes.SIG_ID))
+ {
+ return getSigID();
+ }
+
+ // algorithm
+ if (sigKey.equals(SignatureTypes.SIG_KZ))
+ {
+ return getSigKZ();
+ }
+
+ // additional
+ if (sigKey.equals(SignatureTypes.SIG_NAME))
+ {
+ return getName();
+ }
+
+ if (sigKey.equals(SignatureTypes.SIG_ALG)) {
+ return getSigAlgorithm();
+ }
+
+ throw new RuntimeException("The key '" + sigKey + "' is not a recognized SignatorObject member."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+// public String certSubjectDNPart(String key) {
+// String val = null;
+// if (subjectDNMap == null) {
+// if (this.getX509Certificate() != null) {
+// val = extractDNPart(key, this.getX509Certificate().getSubjectX500Principal().getName());
+// }
+// return val;
+// }
+//
+// public String certIssuerDNPart(String key) {
+// String val = null;
+// if (this.getX509Certificate() != null) {
+// val = extractDNPart(key, this.getX509Certificate().getIssuerX500Principal().getName());
+// }
+// return val;
+// }
+
+ public String certSubjectDNPart(String key) {
+ if (this.subjectDNMap.size() == 0) {
+ if (this.getX509Certificate() != null) {
+ fillDNMap(this.getX509Certificate().getSubjectX500Principal().getName(), this.subjectDNMap);
+ }
+ }
+ return this.subjectDNMap.get(key).toString();
+ }
+
+
+ public String certIssuerDNPart(String key) {
+ if (this.issuerDNMap.size() == 0) {
+ if (this.getX509Certificate() != null) {
+ fillDNMap(this.getX509Certificate().getIssuerX500Principal().getName(), this.issuerDNMap);
+ }
+ }
+ return this.issuerDNMap.get(key).toString();
+ }
+
+ private Map subjectDNMap = new HashMap();
+ private Map issuerDNMap = new HashMap();
+
+ private void fillDNMap(String dn, Map dnMap) {
+
+ String[] arr = dn.split("\\s*(,|;)\\s*");
+ for (int i = 0; i < arr.length; i++) {
+ String[] entry = arr[i].split("\\s*(=)\\s*");
+ dnMap.put(entry[0], entry[1]);
+ }
+ }
+
}
|