diff options
author | knowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-05-15 16:12:24 +0000 |
---|---|---|
committer | knowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-05-15 16:12:24 +0000 |
commit | 0405e1d3b7910c4f13d874b86ec5a9c47c1aa4e1 (patch) | |
tree | 1bec0c9c05f8add74bffc64ba58a96e695343266 | |
parent | 540760a2f5bed64003ef73c942686ad438ee19e2 (diff) | |
download | pdf-as-3-0405e1d3b7910c4f13d874b86ec5a9c47c1aa4e1.tar.gz pdf-as-3-0405e1d3b7910c4f13d874b86ec5a9c47c1aa4e1.tar.bz2 pdf-as-3-0405e1d3b7910c4f13d874b86ec5a9c47c1aa4e1.zip |
replaced "String.replace" with "replaceAll" for 1.4 compatibility
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@76 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedMultipartBKUConnector.java | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedMultipartBKUConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedMultipartBKUConnector.java index 6c30655..a3b2700 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedMultipartBKUConnector.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedMultipartBKUConnector.java @@ -4,9 +4,7 @@ package at.knowcenter.wag.egov.egiz.sig.connectors.bku;
import java.io.ByteArrayInputStream;
-import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
@@ -44,7 +42,7 @@ public class DetachedMultipartBKUConnector * The SIG_ID prefix.
*/
public static final String SIG_ID_PREFIX = "etsi-bku-detached@"; //$NON-NLS-1$
-
+
/**
* The log.
*/
@@ -96,12 +94,12 @@ public class DetachedMultipartBKUConnector String mime_type = data.getMimeType();
if (log.isDebugEnabled())
{
- log.debug("signn keybox identifier = " + sign_keybox_identifier); //$NON-NLS-1$
+ log.debug("sign keybox identifier = " + sign_keybox_identifier); //$NON-NLS-1$
log.debug("mime type = " + mime_type); //$NON-NLS-1$
}
- String sign_request_xml = sign_request_template.replace(TemplateReplaces.KEYBOX_IDENTIFIER_REPLACE, sign_keybox_identifier);
- sign_request_xml = sign_request_xml.replace(TemplateReplaces.MIME_TYPE_REPLACE, mime_type);
+ String sign_request_xml = sign_request_template.replaceFirst(TemplateReplaces.KEYBOX_IDENTIFIER_REPLACE, sign_keybox_identifier);
+ sign_request_xml = sign_request_xml.replaceFirst(TemplateReplaces.MIME_TYPE_REPLACE, mime_type);
log.debug("prepareSignRequestDetached finished."); //$NON-NLS-1$
return sign_request_xml;
@@ -124,17 +122,20 @@ public class DetachedMultipartBKUConnector String response_string = response_properties.getProperty(BKUPostConnection.RESPONSE_STRING_KEY);
// TODO debug
-// try
-// {
-// FileOutputStream fos = new FileOutputStream("C:\\wprinz\\Filer\\egiz2\\sign_response.utf8.xml"); //$NON-NLS-1$
-// OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); //$NON-NLS-1$
-// osw.write(response_string);
-// osw.close();
-// }
-// catch (Exception e)
-// {
-// log.error(e);
-// }
+ // try
+ // {
+ // FileOutputStream fos = new
+ // FileOutputStream("C:\\wprinz\\Filer\\egiz2\\sign_response.utf8.xml");
+ // //$NON-NLS-1$
+ // OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
+ // //$NON-NLS-1$
+ // osw.write(response_string);
+ // osw.close();
+ // }
+ // catch (Exception e)
+ // {
+ // log.error(e);
+ // }
checkResponseForError(response_string);
@@ -200,8 +201,7 @@ public class DetachedMultipartBKUConnector * @see CodingHelper
* @see X509Cert
*/
- private SignSignatureObject parseCreateXMLResponse(
- String xmlResponse) throws SignatureException
+ private SignSignatureObject parseCreateXMLResponse(String xmlResponse) throws SignatureException
{
Pattern sig_val_p_s = Pattern.compile("<[\\w]*:?SignatureValue>"); //$NON-NLS-1$
Pattern sig_val_p_e = Pattern.compile("</[\\w]*:?SignatureValue>"); //$NON-NLS-1$
@@ -435,7 +435,7 @@ public class DetachedMultipartBKUConnector String final_ids = SIG_ID_PREFIX + ids;
return final_ids;
}
-
+
public static String[] parseSigIds(String sig_ids)
{
if (sig_ids == null || sig_ids.length() == 0)
@@ -474,7 +474,7 @@ public class DetachedMultipartBKUConnector real_ids[3] = "0-" + base + "-" + ids[3];
real_ids[4] = "0-" + base + "-" + ids[4];
real_ids[5] = etsi_string;
-
+
if (log.isDebugEnabled())
{
for (int id_idx = 0; id_idx < real_ids.length; id_idx++)
@@ -494,7 +494,8 @@ public class DetachedMultipartBKUConnector * is done by doPostRequestMultipart.
* </p>
*
- * @see BKUPostConnection#doPostRequestMultipart(String, String, SignatureData)
+ * @see BKUPostConnection#doPostRequestMultipart(String, String,
+ * SignatureData)
*
* @param url
* The URL to send the request to.
@@ -542,7 +543,7 @@ public class DetachedMultipartBKUConnector Properties response_properties = sendRequest(url, sign_request_xml, data);
SignSignatureObject sso = analyzeSignResponse(response_properties);
-
+
// TODO this could be made more generic
sso.response_properties = response_properties;
@@ -569,16 +570,18 @@ public class DetachedMultipartBKUConnector log.debug("verify_request_xml = " + verify_request_xml); //$NON-NLS-1$
// TODO debug
-// try
-// {
-// FileOutputStream fos = new FileOutputStream("C:\\wprinz\\Filer\\egiz2\\verify_request.utf8.xml"); //$NON-NLS-1$
-// fos.write(verify_request_xml.getBytes("UTF-8")); //$NON-NLS-1$
-// fos.close();
-// }
-// catch (Exception e)
-// {
-// log.error(e);
-// }
+ // try
+ // {
+ // FileOutputStream fos = new
+ // FileOutputStream("C:\\wprinz\\Filer\\egiz2\\verify_request.utf8.xml");
+ // //$NON-NLS-1$
+ // fos.write(verify_request_xml.getBytes("UTF-8")); //$NON-NLS-1$
+ // fos.close();
+ // }
+ // catch (Exception e)
+ // {
+ // log.error(e);
+ // }
String url = this.environment.getVerifyURL();
Properties response_properties = sendRequest(url, verify_request_xml, data);
@@ -660,7 +663,7 @@ public class DetachedMultipartBKUConnector }
// cert alg replace
- String verify_xml = verify_template.replace(TemplateReplaces.CERT_ALG_REPLACE, cert_alg);
+ String verify_xml = verify_template.replaceFirst(TemplateReplaces.CERT_ALG_REPLACE, cert_alg);
// data digest replace
{
@@ -668,7 +671,7 @@ public class DetachedMultipartBKUConnector byte[] data_value_hash = CodingHelper.buildDigest(data_value);
String object_data_hash = CodingHelper.encodeBase64(data_value_hash);
- verify_xml = verify_xml.replace(TemplateReplaces.DIGEST_VALUE_SIGNED_DATA_REPLACE, object_data_hash);
+ verify_xml = verify_xml.replaceFirst(TemplateReplaces.DIGEST_VALUE_SIGNED_DATA_REPLACE, object_data_hash);
}
// SIG id replaces
@@ -676,7 +679,7 @@ public class DetachedMultipartBKUConnector verify_xml = verify_xml.replaceAll(TemplateReplaces.ETSI_DATA_REF_REPLACE, ids[3]);
verify_xml = verify_xml.replaceAll(TemplateReplaces.SIG_DATA_OBJ_URI_REPLACE, ids[2]);
- verify_xml = verify_xml.replace(TemplateReplaces.SIGNATURE_VALUE_REPLACE, so.getSignatureValue());
+ verify_xml = verify_xml.replaceFirst(TemplateReplaces.SIGNATURE_VALUE_REPLACE, so.getSignatureValue());
// X.509 Certificate replace
byte[] der = cert.getEncoded();
@@ -894,7 +897,6 @@ public class DetachedMultipartBKUConnector return sig_res;
}
-
/**
* Holds environment configuration information like templates.
*
|