/**
*
* This also provides the serial number and name. *
*/ public X509Certificate x509Certificate = null; // dferbas public Map subjectDNMap = new HashMap(); public Map issuerDNMap = new HashMap(); /** * @see at.knowcenter.wag.egov.egiz.sig.signatureobject.MandatorySignatureInformation#getDate() */ public String getDate() { return this.date; } /** * @see at.knowcenter.wag.egov.egiz.sig.signatureobject.MandatorySignatureInformation#getIssuer() */ public String getIssuer() { return this.issuer; } /** * @see at.knowcenter.wag.egov.egiz.sig.signatureobject.MandatorySignatureInformation#getSerialNumber() */ public String getSerialNumber() { return this.x509Certificate.getSerialNumber().toString(); } /** * @see at.knowcenter.wag.egov.egiz.sig.signatureobject.MandatorySignatureInformation#getSignatureValue() */ public String getSignatureValue() { return this.signatureValue; } /** * @see at.knowcenter.wag.egov.egiz.sig.signatureobject.ConnectorSignatureInformation#getSigID() */ public String getSigID() { return this.id; } /** * @see at.knowcenter.wag.egov.egiz.sig.signatureobject.AlgorithmSignatureInformation#getSigKZ() */ public String getSigKZ() { return this.kz; } /** * @see at.knowcenter.wag.egov.egiz.sig.signatureobject.AdditionalSignatureInformation#getName() */ public String getName() { return this.x509Certificate.getSubjectDN().toString(); } /** * @see at.knowcenter.wag.egov.egiz.sig.signatureobject.AdditionalSignatureInformation#getX509Certificate() */ public X509Certificate getX509Certificate() { 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_SUBJECT)) { 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$ } // dferbas /** * Get a timestamp if available as b64 string * @see TimeStamper * @return */ public String getSigTimeStamp() { return this.sigTimeStamp; } public Map getSubjectDNMap() { if (this.subjectDNMap.size() == 0 && this.getX509Certificate() != null) { //rpiazzi workaround //the problem with atrust encoding special characters (Sonderzeichen) wrong //led to this workaround. As special characters are of the form e.g. "xx;" //Example: for "Georg Müller" atrust returns "Georg Müller" //By calling this.getX509Certificate().getSubjectDN().getName() you get "Georg Mü\;ller", //After that the down called method fillDNMap replaces the "\" with a "+" //Because of this the workaround in at.gv.egiz.pdfas.impl.signator.binary.BinarySignator_1_0_0.fillReplacesWithValues() //which replaces the wrong codes of atrust with the special chars does not work //------------------------------------------------------------------------------ //The workaround here is to call this.getX509Certificate().getSubjectDN.toString() //instead of this.getX509Certificate().getSubjectDN.getName() if (this.getX509Certificate().getSubjectDN().toString().contains(";") || this.getX509Certificate().getSubjectDN().toString().contains("#") || this.getX509Certificate().getSubjectDN().toString().contains("&")) { fillDNMap(this.getX509Certificate().getSubjectDN().toString(), this.subjectDNMap); } else { fillDNMap(this.getX509Certificate().getSubjectDN().getName(), this.subjectDNMap); } //end workaround } return this.subjectDNMap; } public String certSubjectDNPart(String key) { return (String)this.getSubjectDNMap().get(key); } public Map getIssuerDNMap() { if (this.issuerDNMap.size() == 0 && this.getX509Certificate() != null) { fillDNMap(this.getX509Certificate().getIssuerDN().getName(), this.issuerDNMap); } return this.issuerDNMap; } public String certIssuerDNPart(String key) { return (String)this.getIssuerDNMap().get(key); } private void fillDNMap(String dn, Map dnMap) { // split at "," but not at "\," String[] arr = dn.split("\\s*(? , entry[1] = entry[1].replaceAll("\\\\+", "+"); // \+ -> + entry[1] = entry[1].replaceAll("\\\\\"", "\""); // \" -> " entry[1] = entry[1].replaceAll("\\\\\\\\", "\\"); // \\ -> \ entry[1] = entry[1].replaceAll("\\\\<,", "<"); // \< -> < entry[1] = entry[1].replaceAll("\\\\>", ">"); // \> -> > entry[1] = entry[1].replaceAll("\\\\;", ";"); // \; -> ; entry[1] = entry[1].replaceAll("\\\\#", "#"); // \# -> # dnMap.put(entry[0], entry[1]); } } }