summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java14
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java24
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java32
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java186
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java140
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKStatus.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java50
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java54
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/SimpleXMLTrustManager.java24
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/TrustedSocketFactory.java28
10 files changed, 278 insertions, 278 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java
index 7686959a..6eb071c5 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/BKUHelper.java
@@ -37,18 +37,18 @@ public class BKUHelper {
/* public static HttpClient getHttpClient(boolean useProxy) {
HttpClient client = new HttpClient();
- client.getParams().setParameter("http.useragent", //
+ client.getParams().setParameter("http.useragent",
Constants.USER_AGENT_STRING);
if (useProxy) {
- String host = System.getProperty("http.proxyHost"); //
- String port = System.getProperty("http.proxyPort"); //
+ String host = System.getProperty("http.proxyHost");
+ String port = System.getProperty("http.proxyPort");
if (host != null && !host.isEmpty() &&
port != null && !port.isEmpty()) {
int p = Integer.parseInt(port);
client.getHostConfiguration().setProxy(host, p);
- String user = System.getProperty("http.proxyUser"); //
- String pass = System.getProperty("http.proxyPassword"); //
+ String user = System.getProperty("http.proxyUser");
+ String pass = System.getProperty("http.proxyPassword");
if (user != null && !user.isEmpty() && pass != null) {
client.getState().setProxyCredentials(new AuthScope(host, p),
new UsernamePasswordCredentials(user, pass));
@@ -69,11 +69,11 @@ public class BKUHelper {
@SuppressWarnings("deprecation")
public static HttpClient getHttpClient(boolean useProxy) {
HttpClient client = new HttpClient();
- client.getParams().setParameter("http.useragent", //
+ client.getParams().setParameter("http.useragent",
Constants.USER_AGENT_STRING);
- client.getParams().setParameter("http.protocol.cookie-policy", CookieSpecs.BROWSER_COMPATIBILITY); //
+ client.getParams().setParameter("http.protocol.cookie-policy", CookieSpecs.BROWSER_COMPATIBILITY);
if (useProxy) {
String host = System.getProperty("http.proxyHost");//
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java
index 561bb5ba..2fcd9938 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java
@@ -51,17 +51,17 @@ public class LocalBKUConnector implements BkuSlConnector {
/**
* HTTP Response server HEADER
*/
- public final static String BKU_RESPONSE_HEADER_SERVER = "server"; //
+ public final static String BKU_RESPONSE_HEADER_SERVER = "server";
/**
* HTTP Response user-agent HEADER
*/
- public final static String BKU_RESPONSE_HEADER_USERAGENT = "user-agent"; //
+ public final static String BKU_RESPONSE_HEADER_USERAGENT = "user-agent";
/**
* HTTP Response SignatureLayout HEADER
*/
- public final static String BKU_RESPONSE_HEADER_SIGNATURE_LAYOUT = "SignatureLayout"; //
+ public final static String BKU_RESPONSE_HEADER_SIGNATURE_LAYOUT = "SignatureLayout";
/* (non-Javadoc)
* @see at.asit.pdfover.signator.BkuSlConnector#handleSLRequest(java.lang.String)
@@ -74,12 +74,12 @@ public class LocalBKUConnector implements BkuSlConnector {
String sl_request = request.getRequest();
if (request.getSignatureData() == null) {
- method.addParameter("XMLRequest", sl_request); //
+ method.addParameter("XMLRequest", sl_request);
} else {
StringPart xmlpart = new StringPart(
- "XMLRequest", sl_request, "UTF-8"); // //
+ "XMLRequest", sl_request, "UTF-8");
- FilePart filepart = new FilePart("fileupload", //
+ FilePart filepart = new FilePart("fileupload",
new FileUploadSource(request.getSignatureData()));
Part[] parts = { xmlpart, filepart };
@@ -87,7 +87,7 @@ public class LocalBKUConnector implements BkuSlConnector {
method.setRequestEntity(new MultipartRequestEntity(parts, method
.getParams()));
}
- log.trace("SL REQUEST: " + sl_request); //
+ log.trace("SL REQUEST: " + sl_request);
int returnCode = client.executeMethod(method);
@@ -98,22 +98,22 @@ public class LocalBKUConnector implements BkuSlConnector {
String server = getResponseHeader(method, BKU_RESPONSE_HEADER_SERVER);
if (server == null)
- server = ""; //
+ server = "";
String userAgent = getResponseHeader(method, BKU_RESPONSE_HEADER_USERAGENT);
if (userAgent == null)
- userAgent = ""; //
+ userAgent = "";
String signatureLayout = getResponseHeader(method, BKU_RESPONSE_HEADER_SIGNATURE_LAYOUT);
String response = method.getResponseBodyAsString();
- log.debug("SL Response: " + response); //
+ log.debug("SL Response: " + response);
SLResponse slResponse = new SLResponse(response, server,
userAgent, signatureLayout);
return slResponse;
} catch (HttpException e) {
- log.error("LocalBKUConnector: ", e); //
+ log.error("LocalBKUConnector: ", e);
throw new SignatureException(e);
} catch (IOException e) {
- log.error("LocalBKUConnector: ", e); //
+ log.error("LocalBKUConnector: ", e);
throw new SignatureException(e);
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
index 3d3f6012..6fb36488 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
@@ -66,11 +66,11 @@ public class MobileBKUConnector implements BkuSlConnector {
String responseData = handler.postSLRequest(this.state.getURL(), request);
// Now we have received some data lets check it:
- log.trace("Response from mobile BKU: " + responseData); //
+ log.trace("Response from mobile BKU: " + responseData);
handler.handleSLRequestResponse(responseData);
} catch (Exception ex) {
- log.error("Error in PostSLRequestThread", ex); //
+ log.error("Error in PostSLRequestThread", ex);
this.state.threadException = ex;
this.state.displayError(ex);
throw new SignatureException(ex);
@@ -81,14 +81,14 @@ public class MobileBKUConnector implements BkuSlConnector {
this.state.checkCredentials();
if (this.state.status.errorMessage != null &&
- this.state.status.errorMessage.equals("cancel")) //
+ this.state.status.errorMessage.equals("cancel"))
throw new SignatureException(new IllegalStateException());
// Post credentials
try {
String responseData = handler.postCredentials();
- if (responseData.contains("undecided.aspx?sid=")) { //
+ if (responseData.contains("undecided.aspx?sid=")) {
// handle polling
this.state.showOpenAppMessageWithSMSandCancel();
@@ -102,12 +102,12 @@ public class MobileBKUConnector implements BkuSlConnector {
} else {
// Now we have received some data lets check it:
- log.trace("Response from mobile BKU: " + responseData); //
+ log.trace("Response from mobile BKU: " + responseData);
handler.handleCredentialsResponse(responseData);
}
} catch (Exception ex) {
- log.error("Error in PostCredentialsThread", ex); //
+ log.error("Error in PostCredentialsThread", ex);
this.state.threadException = new IllegalStateException();
throw new SignatureException(new IllegalStateException());
}
@@ -130,15 +130,15 @@ public class MobileBKUConnector implements BkuSlConnector {
if (aStatus.qrCodeURL != null) {
this.state.showQR();
if (this.state.status.errorMessage != null &&
- this.state.status.errorMessage.equals("cancel")) //
+ this.state.status.errorMessage.equals("cancel"))
throw new SignatureException(new IllegalStateException());
if (aStatus.qrCodeURL == null) {
try {
String response = aHandler.postSMSRequest();
- log.trace("Response from mobile BKU: " + response); //
+ log.trace("Response from mobile BKU: " + response);
handler.handleCredentialsResponse(response);
} catch (Exception ex) {
- log.error("Error in PostCredentialsThread", ex); //
+ log.error("Error in PostCredentialsThread", ex);
this.state.threadException = new IllegalStateException();
throw new SignatureException(new IllegalStateException());
}
@@ -151,10 +151,10 @@ public class MobileBKUConnector implements BkuSlConnector {
this.state.showFingerPrintInformation();
if (this.state.status.errorMessage != null &&
- this.state.status.errorMessage.equals("cancel")) //
+ this.state.status.errorMessage.equals("cancel"))
throw new SignatureException(new IllegalStateException());
} catch (Exception ex) {
- log.error("Error in PostCredentialsThread", ex); //
+ log.error("Error in PostCredentialsThread", ex);
this.state.threadException = new IllegalStateException();
//this.state.displayError(ex);
throw new SignatureException(new IllegalStateException());
@@ -166,7 +166,7 @@ public class MobileBKUConnector implements BkuSlConnector {
response = aHandler.postSMSRequest();
handler.handleCredentialsResponse(response);
} catch (Exception e) {
- log.error("Error in PostCredentialsThread", e); //
+ log.error("Error in PostCredentialsThread", e);
this.state.threadException = e;
this.state.displayError(e);
throw new SignatureException(e);
@@ -184,18 +184,18 @@ public class MobileBKUConnector implements BkuSlConnector {
if (this.state.status.errorMessage != null &&
- this.state.status.errorMessage.equals("cancel")) //
+ this.state.status.errorMessage.equals("cancel"))
throw new SignatureException(new IllegalStateException());
// Post TAN
try {
responseData = handler.postTAN();
- log.trace("Response from mobile BKU: " + responseData); //
+ log.trace("Response from mobile BKU: " + responseData);
// Now we have received some data lets check it:
handler.handleTANResponse(responseData);
} catch (Exception ex) {
- log.error("Error in PostTanThread", ex); //
+ log.error("Error in PostTanThread", ex);
this.state.threadException = ex;
this.state.displayError(ex);
throw new SignatureException(ex);
@@ -213,7 +213,7 @@ public class MobileBKUConnector implements BkuSlConnector {
if (this.state.status instanceof ATrustStatus) {
if (this.state.status.errorMessage != null &&
- this.state.status.errorMessage.equals("cancel")) { //
+ this.state.status.errorMessage.equals("cancel")) {
this.state.status.errorMessage = null;
return true;
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
index 5c0e108c..75f02dd6 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
@@ -75,7 +75,7 @@ public class ATrustHandler extends MobileBKUHandler {
private static boolean expiryNoticeDisplayed = false;
- private static final String ACTIVATION_URL = "https://www.handy-signatur.at/"; //
+ private static final String ACTIVATION_URL = "https://www.handy-signatur.at/";
private boolean useBase64 = false;
@@ -86,26 +86,26 @@ public class ATrustHandler extends MobileBKUHandler {
public void handleSLRequestResponse(String responseData) throws Exception {
ATrustStatus status = getStatus();
- if (responseData.contains("<sl:ErrorResponse")) { //
+ if (responseData.contains("<sl:ErrorResponse")) {
String errorCode = MobileBKUHelper.extractSubstring(responseData,
- "<sl:ErrorCode>", "</sl:ErrorCode>"); // //
+ "<sl:ErrorCode>", "</sl:ErrorCode>");
String errorMsg = MobileBKUHelper.extractSubstring(responseData,
- "<sl:Info>", "</sl:Info>"); // //
- throw new Exception("Error from mobile BKU: " + //
- errorCode + " - " + errorMsg); //
+ "<sl:Info>", "</sl:Info>");
+ throw new Exception("Error from mobile BKU: " +
+ errorCode + " - " + errorMsg);
}
// Extract infos:
String sessionID = MobileBKUHelper.extractSubstring(responseData,
- "identification.aspx?sid=", "\""); // //
+ "identification.aspx?sid=", "\"");
String viewState = MobileBKUHelper.extractValueFromTagWithParam(
- responseData, "", "id", "__VIEWSTATE", "value"); // // // //
+ responseData, "", "id", "__VIEWSTATE", "value");
String eventValidation = MobileBKUHelper.extractValueFromTagWithParam(
- responseData, "", "id", "__EVENTVALIDATION", "value"); // // // //
+ responseData, "", "id", "__EVENTVALIDATION", "value");
- String viewstateGenerator = MobileBKUHelper.extractValueFromTagWithParamOptional(responseData, "", "id", "__VIEWSTATEGENERATOR", "value"); // // // //
+ String viewstateGenerator = MobileBKUHelper.extractValueFromTagWithParamOptional(responseData, "", "id", "__VIEWSTATEGENERATOR", "value");
String dynamicAttrPhonenumber = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_PHONE_NUMBER);
String dynamicAttrPassword = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_SIGN_PASS);
@@ -113,9 +113,9 @@ public class ATrustHandler extends MobileBKUHandler {
String dynamicAttrTan = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_TAN);
- log.info("sessionID: " + sessionID); //
- log.info("viewState: " + viewState); //
- log.info("eventValidation: " + eventValidation); //
+ log.info("sessionID: " + sessionID);
+ log.info("viewState: " + viewState);
+ log.info("eventValidation: " + eventValidation);
status.sessionID = sessionID;
status.viewState = viewState;
@@ -137,11 +137,11 @@ public class ATrustHandler extends MobileBKUHandler {
MobileBKUHelper.registerTrustedSocketFactory();
HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
- PostMethod post = new PostMethod(status.baseURL + "/identification.aspx?sid=" + status.sessionID); //
- post.getParams().setContentCharset("utf-8"); //
- post.addParameter("__VIEWSTATE", status.viewState); //
- post.addParameter("__VIEWSTATEGENERATOR", status.viewStateGenerator); //
- post.addParameter("__EVENTVALIDATION", status.eventValidation); //
+ PostMethod post = new PostMethod(status.baseURL + "/identification.aspx?sid=" + status.sessionID);
+ post.getParams().setContentCharset("utf-8");
+ post.addParameter("__VIEWSTATE", status.viewState);
+ post.addParameter("__VIEWSTATEGENERATOR", status.viewStateGenerator);
+ post.addParameter("__EVENTVALIDATION", status.eventValidation);
post.addParameter(status.dynAttrPhoneNumber, status.phoneNumber);
post.addParameter(status.dynAttrPassword, status.mobilePassword);
post.addParameter(status.dynAttrBtnId, "Identifizieren");
@@ -164,124 +164,124 @@ public class ATrustHandler extends MobileBKUHandler {
status.errorMessage = null;
- if (responseData.contains("ExpiresInfo.aspx?sid=")) { //
+ if (responseData.contains("ExpiresInfo.aspx?sid=")) {
// Certificate expiration interstitial - skip
- String notice = Messages.getString("mobileBKU.notice") + " " + // //
- StringEscapeUtils.unescapeHtml4(MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "Label2")) // // //
- .replaceAll("\\<.*?\\>", ""); // //
+ String notice = Messages.getString("mobileBKU.notice") + " " +
+ StringEscapeUtils.unescapeHtml4(MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "Label2"))
+ .replaceAll("\\<.*?\\>", "");
log.info(notice);
if (!expiryNoticeDisplayed) {
Display.getDefault().syncExec(()-> {
- Dialog d = new Dialog(ATrustHandler.this.shell, Messages.getString("common.info"), Messages.getString("mobileBKU.certExpiresSoon"), BUTTONS.YES_NO, ICON.WARNING); // //
+ Dialog d = new Dialog(ATrustHandler.this.shell, Messages.getString("common.info"), Messages.getString("mobileBKU.certExpiresSoon"), BUTTONS.YES_NO, ICON.WARNING);
if (d.open() == SWT.YES) {
- log.debug("Trying to open " + ACTIVATION_URL); //
+ log.debug("Trying to open " + ACTIVATION_URL);
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI(ACTIVATION_URL));
return;
} catch (Exception e) {
- log.debug("Error opening URL", e); //
+ log.debug("Error opening URL", e);
}
}
- log.info("SWT Desktop is not supported on this platform"); //
+ log.info("SWT Desktop is not supported on this platform");
Program.launch(ACTIVATION_URL);
}
});
expiryNoticeDisplayed = true;
}
- String t_sessionID = MobileBKUHelper.extractSubstring(responseData, "ExpiresInfo.aspx?sid=", "\""); // //
- String t_viewState = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__VIEWSTATE", "value"); // // // //
- String t_eventValidation = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__EVENTVALIDATION", "value"); // // // //
+ String t_sessionID = MobileBKUHelper.extractSubstring(responseData, "ExpiresInfo.aspx?sid=", "\"");
+ String t_viewState = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__VIEWSTATE", "value");
+ String t_eventValidation = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__EVENTVALIDATION", "value");
// Post again to skip
MobileBKUHelper.registerTrustedSocketFactory();
HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
- PostMethod post = new PostMethod(status.baseURL + "/ExpiresInfo.aspx?sid=" + t_sessionID); //
- post.getParams().setContentCharset("utf-8"); //
- post.addParameter("__VIEWSTATE", t_viewState); //
- post.addParameter("__EVENTVALIDATION", t_eventValidation); //
- post.addParameter("Button_Next", "Weiter"); // //
+ PostMethod post = new PostMethod(status.baseURL + "/ExpiresInfo.aspx?sid=" + t_sessionID);
+ post.getParams().setContentCharset("utf-8");
+ post.addParameter("__VIEWSTATE", t_viewState);
+ post.addParameter("__EVENTVALIDATION", t_eventValidation);
+ post.addParameter("Button_Next", "Weiter");
responseData = executePost(client, post);
- log.trace("Response from mobile BKU: " + responseData); //
- } else if (responseData.contains("tanAppInfo.aspx?sid=")) { //
+ log.trace("Response from mobile BKU: " + responseData);
+ } else if (responseData.contains("tanAppInfo.aspx?sid=")) {
// App info interstitial - skip
- log.info("Skipping tan app interstitial"); //
+ log.info("Skipping tan app interstitial");
- String t_sessionID = MobileBKUHelper.extractSubstring(responseData, "tanAppInfo.aspx?sid=", "\""); // //
- String t_viewState = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__VIEWSTATE", "value"); // // // //
- String t_eventValidation = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__EVENTVALIDATION", "value"); // // // //
+ String t_sessionID = MobileBKUHelper.extractSubstring(responseData, "tanAppInfo.aspx?sid=", "\"");
+ String t_viewState = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__VIEWSTATE", "value");
+ String t_eventValidation = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__EVENTVALIDATION", "value");
// Post again to skip
MobileBKUHelper.registerTrustedSocketFactory();
HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
- PostMethod post = new PostMethod(status.baseURL + "/tanAppInfo.aspx?sid=" + t_sessionID); //
- post.getParams().setContentCharset("utf-8"); //
- post.addParameter("__VIEWSTATE", t_viewState); //
- post.addParameter("__EVENTVALIDATION", t_eventValidation); //
- post.addParameter("NextBtn", "Weiter"); // //
+ PostMethod post = new PostMethod(status.baseURL + "/tanAppInfo.aspx?sid=" + t_sessionID);
+ post.getParams().setContentCharset("utf-8");
+ post.addParameter("__VIEWSTATE", t_viewState);
+ post.addParameter("__EVENTVALIDATION", t_eventValidation);
+ post.addParameter("NextBtn", "Weiter");
responseData = executePost(client, post);
- log.trace("Response from mobile BKU: " + responseData); //
+ log.trace("Response from mobile BKU: " + responseData);
}
- if (responseData.contains("signature.aspx?sid=")) { //
+ if (responseData.contains("signature.aspx?sid=")) {
// credentials ok! TAN entry
- log.debug("Credentials accepted - TAN required"); //
- sessionID = MobileBKUHelper.extractSubstring(responseData, "signature.aspx?sid=", "\""); // //
- viewState = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__VIEWSTATE", "value"); // // // //
- eventValidation = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__EVENTVALIDATION", "value"); // // // //
- refVal = MobileBKUHelper.extractSubstring(responseData, "id='vergleichswert'><b>Vergleichswert:</b>", "</div>"); // //
- signatureDataURL = status.baseURL + "/ShowSigobj.aspx" + //
- MobileBKUHelper.extractSubstring(responseData, "ShowSigobj.aspx", "'"); // //
+ log.debug("Credentials accepted - TAN required");
+ sessionID = MobileBKUHelper.extractSubstring(responseData, "signature.aspx?sid=", "\"");
+ viewState = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__VIEWSTATE", "value");
+ eventValidation = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__EVENTVALIDATION", "value");
+ refVal = MobileBKUHelper.extractSubstring(responseData, "id='vergleichswert'><b>Vergleichswert:</b>", "</div>");
+ signatureDataURL = status.baseURL + "/ShowSigobj.aspx" +
+ MobileBKUHelper.extractSubstring(responseData, "ShowSigobj.aspx", "'");
try {
- String qrCode = MobileBKUHelper.extractValueFromTagWithParam(responseData, "img", "class", "qrcode", "src"); // // // //
- log.debug("QR Code found: " + qrCode); //
+ String qrCode = MobileBKUHelper.extractValueFromTagWithParam(responseData, "img", "class", "qrcode", "src");
+ log.debug("QR Code found: " + qrCode);
status.qrCodeURL = qrCode;
} catch (Exception e) {
- log.debug("No QR Code found"); //
+ log.debug("No QR Code found");
}
try {
- String tanTextTan = MobileBKUHelper.extractValueFromTagWithParam(responseData, "label", "id", "label_for_input_tan", "for"); // // // //
+ String tanTextTan = MobileBKUHelper.extractValueFromTagWithParam(responseData, "label", "id", "label_for_input_tan", "for");
status.tanField = tanTextTan.equals("input_tan");
status.dynAttrTan = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_TAN);
status.dynAttrSignButton = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_SIGN_BTN);
} catch (Exception e) {
- log.debug("No tan field found"); //
+ log.debug("No tan field found");
}
try {
- String tanTextTan = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "text_tan"); // // //
+ String tanTextTan = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "text_tan");
status.isAPPTan = !tanTextTan.toLowerCase().contains("sms");
status.dynAttrTan = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_TAN);
status.dynAttrSignButton = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_SIGN_BTN);
}catch (Exception e) {
- log.debug("No text_tan tag"); //
+ log.debug("No text_tan tag");
}
- } else if (responseData.contains("sl:InfoboxReadResponse")) { //
+ } else if (responseData.contains("sl:InfoboxReadResponse")) {
// credentials ok! InfoboxReadResponse
- log.debug("Credentials accepted - Response given"); //
+ log.debug("Credentials accepted - Response given");
getSigningState().setSignatureResponse(new SLResponse(responseData, getStatus().server, null, null));
return;
- } else if (responseData.contains("undecided.aspx?sid=")) { //
+ } else if (responseData.contains("undecided.aspx?sid=")) {
// skip intermediate page
- log.debug("Page Undecided"); //
+ log.debug("Page Undecided");
getSigningState().setSignatureResponse(new SLResponse(responseData, getStatus().server, null, null));
- status.errorMessage = "waiting..."; //
+ status.errorMessage = "waiting...";
return;
}else {
// error page
// extract error text!
try {
- String errorMessage = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "class", "ErrorClass"); // // //
+ String errorMessage = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "class", "ErrorClass");
status.errorMessage = errorMessage;
} catch (Exception e) {
- throw new SignatureException(MobileBKUHelper.extractSubstring(responseData, "<sl:ErrorCode>", "</sl:ErrorCode>") + ": " + // // //
- MobileBKUHelper.extractSubstring(responseData, "<sl:Info>", "</sl:Info>")); // //
+ throw new SignatureException(MobileBKUHelper.extractSubstring(responseData, "<sl:ErrorCode>", "</sl:ErrorCode>") + ": " +
+ MobileBKUHelper.extractSubstring(responseData, "<sl:Info>", "</sl:Info>"));
}
// force UI again!
@@ -313,14 +313,14 @@ public class ATrustHandler extends MobileBKUHandler {
HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
PostMethod post = new PostMethod(status.baseURL
- + "/signature.aspx?sid=" + status.sessionID); //
- post.getParams().setContentCharset("utf-8"); //
- post.addParameter("__VIEWSTATE", status.viewState); //
+ + "/signature.aspx?sid=" + status.sessionID);
+ post.getParams().setContentCharset("utf-8");
+ post.addParameter("__VIEWSTATE", status.viewState);
post.addParameter(
- "__EVENTVALIDATION", status.eventValidation); //
+ "__EVENTVALIDATION", status.eventValidation);
post.addParameter(status.dynAttrTan, status.tan);
post.addParameter(status.dynAttrSignButton, "Signieren");
- post.addParameter("Button1", "Identifizieren"); // //
+ post.addParameter("Button1", "Identifizieren");
return executePost(client, post);
}
@@ -331,8 +331,8 @@ public class ATrustHandler extends MobileBKUHandler {
@Override
public void handleTANResponse(String responseData) {
getStatus().errorMessage = null;
- if (responseData.contains("sl:CreateXMLSignatureResponse xmlns:sl") || //
- responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) { //
+ if (responseData.contains("sl:CreateXMLSignatureResponse xmlns:sl") ||
+ responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) {
// success !!
getSigningState().setSignatureResponse(
@@ -340,19 +340,19 @@ public class ATrustHandler extends MobileBKUHandler {
} else {
try {
String tries = MobileBKUHelper.extractSubstring(
- responseData, "Sie haben noch", "Versuch"); // //
+ responseData, "Sie haben noch", "Versuch");
getStatus().tanTries = Integer.parseInt(tries.trim());
getStatus().errorMessage = "mobileBKU.wrong_tan";
} catch (Exception e) {
getStatus().tanTries = (getStatus().tanTries - 1);
- log.debug("Error parsing TAN response", e); //
+ log.debug("Error parsing TAN response", e);
}
if (getStatus().tanTries <= 0) {
getStatus().errorMessage = null;
Display.getDefault().syncExec(() -> {
- Dialog dialog = new Dialog(ATrustHandler.this.shell, Messages.getString("common.warning"), //
- Messages.getString("mobileBKU.tan_tries_exceeded"), //
+ Dialog dialog = new Dialog(ATrustHandler.this.shell, Messages.getString("common.warning"),
+ Messages.getString("mobileBKU.tan_tries_exceeded"),
BUTTONS.OK_CANCEL, ICON.QUESTION);
// TODO: THIS IS A COLOSSAL HACK
@@ -381,7 +381,7 @@ public class ATrustHandler extends MobileBKUHandler {
GetMethod get = new GetMethod(status.baseURL
+ "/sendsms.aspx?sid=" + status.sessionID);
- get.getParams().setContentCharset("utf-8"); //
+ get.getParams().setContentCharset("utf-8");
return executeGet(client, get);
}
@@ -401,17 +401,17 @@ public class ATrustHandler extends MobileBKUHandler {
GetMethod get = new GetMethod(status.baseURL + "/" + status.qrCodeURL);
try {
- log.debug("Getting " + get.getURI()); //
+ log.debug("Getting " + get.getURI());
int returnCode = client.executeMethod(get);
if (returnCode != HttpStatus.SC_OK) {
- log.error("Error getting QR code"); //
+ log.error("Error getting QR code");
return null;
}
return get.getResponseBodyAsStream();
} catch (Exception e) {
- log.error("Error getting QR code", e); //
+ log.error("Error getting QR code", e);
return null;
}
}
@@ -430,7 +430,7 @@ public class ATrustHandler extends MobileBKUHandler {
//TODO check
//String baseURL = "https://www.a-trust.at/mobile/https-security-layer-request";
GetMethod get = new GetMethod(status.baseURL
- + "/signature.aspx?sid=" + status.sessionID); //
+ + "/signature.aspx?sid=" + status.sessionID);
return executeGet(client, get);
}
@@ -442,8 +442,8 @@ public class ATrustHandler extends MobileBKUHandler {
public Boolean handleWaitforAppResponse(String responseData) {
getStatus().errorMessage = null;
- if (!responseData.toLowerCase().contains("Bitte starten Sie Ihre Handy-Signatur App!".toLowerCase())/* || //
- responseData.toLowerCase().contains("TAN (Handy-Signatur App)".toLowerCase())*/) { //
+ if (!responseData.toLowerCase().contains("Bitte starten Sie Ihre Handy-Signatur App!".toLowerCase())/* ||
+ responseData.toLowerCase().contains("TAN (Handy-Signatur App)".toLowerCase())*/) {
return true;
}
@@ -457,8 +457,8 @@ public class ATrustHandler extends MobileBKUHandler {
*/
public boolean handleQRResponse(String responseData) {
getStatus().errorMessage = null;
- if (responseData.contains("sl:CreateXMLSignatureResponse xmlns:sl") || //
- responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) { //
+ if (responseData.contains("sl:CreateXMLSignatureResponse xmlns:sl") ||
+ responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) {
// success !!
getSigningState().setSignatureResponse(
@@ -493,7 +493,7 @@ public class ATrustHandler extends MobileBKUHandler {
String isReady = null;
Status serverStatus = null;
int waits = 0;
- final String ERROR = "Error: Server is not responding"; //
+ final String ERROR = "Error: Server is not responding";
HttpClient client;
try {
do {
@@ -511,7 +511,7 @@ public class ATrustHandler extends MobileBKUHandler {
int returnValue = client.executeMethod(get);
InputStream in = new BufferedInputStream(get.getResponseBodyAsStream());
- isReady = IOUtils.toString(in, "utf-8"); //
+ isReady = IOUtils.toString(in, "utf-8");
serverStatus = new Status(isReady);
if (serverStatus.isFin()) {
@@ -528,11 +528,11 @@ public class ATrustHandler extends MobileBKUHandler {
}
//else error
status.errorMessage = "Server reponded ERROR during polling";
- log.error("Server reponded ERROR during polling"); //
+ log.error("Server reponded ERROR during polling");
throw new ATrustConnectionException();
} catch (Exception e) {
- log.error("handle polling failed" + e.getMessage()); //
+ log.error("handle polling failed" + e.getMessage());
throw new ATrustConnectionException();
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java
index e1e838fc..ac47a3b7 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java
@@ -68,23 +68,23 @@ public class IAIKHandler extends MobileBKUHandler {
// Extract infos:
String credentialURL = MobileBKUHelper.extractValueFromTagWithParam(responseData,
- "form", "name", "userCredLogon", "action"); // // // //
+ "form", "name", "userCredLogon", "action");
URL baseURL = new URL(status.baseURL);
credentialURL = MobileBKUHelper.getQualifiedURL(credentialURL, baseURL);
String viewState = MobileBKUHelper.extractValueFromTagWithParam(
- responseData, "input", "name", "javax.faces.ViewState", "value"); // // // //
+ responseData, "input", "name", "javax.faces.ViewState", "value");
String sessionID = null;
- int si = credentialURL.indexOf("jsessionid="); //
+ int si = credentialURL.indexOf("jsessionid=");
if (si != -1)
sessionID = credentialURL.substring(si + 11);
else
sessionID = status.sessionID;
- log.info("credentialURL: " + credentialURL); //
- log.info("sessionID: " + sessionID); //
- log.info("viewState: " + viewState); //
+ log.info("credentialURL: " + credentialURL);
+ log.info("sessionID: " + sessionID);
+ log.info("viewState: " + viewState);
status.baseURL = credentialURL;
if (sessionID != null)
@@ -103,17 +103,17 @@ public class IAIKHandler extends MobileBKUHandler {
HttpClient client = MobileBKUHelper.getHttpClient(status);
PostMethod post = new PostMethod(status.ensureSessionID(status.baseURL));
- post.getParams().setContentCharset("utf-8"); //
+ post.getParams().setContentCharset("utf-8");
post.addParameter("javax.faces.ViewState", status.viewState);
post.addParameter("userCredLogon:phoneNr", status.phoneNumber);
post.addParameter("userCredLogon:pwd", status.mobilePassword);
- post.addParameter("userCredLogon:logonButton", "userCredLogon:logonButton"); // //
- post.addParameter("javax.faces.partial.ajax", "true"); // //
- post.addParameter("javax.faces.source", "userCredLogon:logonButton"); // //
- post.addParameter("javax.faces.partial.execute", "@all"); // //
- post.addParameter("javax.faces.partial.render", "userCredLogon:userCredentialLogonPanel"); // //
- post.addParameter("userCredLogon", "userCredLogon"); // //
- post.addParameter("userCredLogon:j_idt33_input", "de"); // //
+ post.addParameter("userCredLogon:logonButton", "userCredLogon:logonButton");
+ post.addParameter("javax.faces.partial.ajax", "true");
+ post.addParameter("javax.faces.source", "userCredLogon:logonButton");
+ post.addParameter("javax.faces.partial.execute", "@all");
+ post.addParameter("javax.faces.partial.render", "userCredLogon:userCredentialLogonPanel");
+ post.addParameter("userCredLogon", "userCredLogon");
+ post.addParameter("userCredLogon:j_idt33_input", "de");
return executePost(client, post);
}
@@ -130,14 +130,14 @@ public class IAIKHandler extends MobileBKUHandler {
status.errorMessage = null;
- if (!responseData.contains("redirection_url")) { //
+ if (!responseData.contains("redirection_url")) {
// Assume that an error occurred
String errorMessage;
try {
- errorMessage = MobileBKUHelper.extractSubstring(responseData, ":errorMessage\">", "</span>"); // //
+ errorMessage = MobileBKUHelper.extractSubstring(responseData, ":errorMessage\">", "</span>");
} catch (Exception e) {
- errorMessage = Messages.getString("error.Unexpected"); //
+ errorMessage = Messages.getString("error.Unexpected");
}
status.errorMessage = errorMessage;
@@ -149,7 +149,7 @@ public class IAIKHandler extends MobileBKUHandler {
HttpClient client = MobileBKUHelper.getHttpClient(status);
String redirectURL = MobileBKUHelper.extractSubstring(responseData,
- "\"redirection_url\":\"", "\""); // //
+ "\"redirection_url\":\"", "\"");
URL baseURL = new URL(status.baseURL);
redirectURL = MobileBKUHelper.getQualifiedURL(redirectURL, baseURL);
@@ -157,7 +157,7 @@ public class IAIKHandler extends MobileBKUHandler {
responseData = getRedirect(client, redirectURL);
- if (responseData.contains("sl:InfoboxReadResponse")) { //
+ if (responseData.contains("sl:InfoboxReadResponse")) {
// credentials ok! InfoboxReadResponse
getSigningState().setSignatureResponse(
new SLResponse(responseData, status.server, null, null));
@@ -167,23 +167,23 @@ public class IAIKHandler extends MobileBKUHandler {
if (responseData.contains("tanCodeLogon"))
{
refVal = MobileBKUHelper.extractContentFromTagWithParam(responseData,
- "span", "id", "tanCodeLogon:refValue"); // // //
+ "span", "id", "tanCodeLogon:refValue");
}
else
{
refVal = MobileBKUHelper.extractContentFromTagWithParam(responseData,
- "span", "id", "j_idt5:refValue"); // // //
+ "span", "id", "j_idt5:refValue");
}
- if (responseData.contains("/error")) { //
+ if (responseData.contains("/error")) {
// Error response - try again
String errorMessage = MobileBKUHelper.extractContentFromTagWithParam(
- responseData, "div", "id", "errorPanel:panel_content"); // // //
- if (errorMessage.contains("<br />")) //
- errorMessage = errorMessage.substring(0, errorMessage.indexOf("<br />")); //
- errorMessage.replace("\n", " "); // //
+ responseData, "div", "id", "errorPanel:panel_content");
+ if (errorMessage.contains("<br />"))
+ errorMessage = errorMessage.substring(0, errorMessage.indexOf("<br />"));
+ errorMessage.replace("\n", " ");
status.errorMessage = errorMessage;
status.mobilePassword = null;
@@ -194,29 +194,29 @@ public class IAIKHandler extends MobileBKUHandler {
String viewState = MobileBKUHelper.extractValueFromTagWithParam(
- responseData, "input", "name", "javax.faces.ViewState", "value"); // // // //
+ responseData, "input", "name", "javax.faces.ViewState", "value");
status.viewState = viewState;
- if (!responseData.contains("tanCodeLogon.jsf")) { //
+ if (!responseData.contains("tanCodeLogon.jsf")) {
// Assume that we need to confirm reference value dialog
- log.debug("viewState: " + viewState); //
+ log.debug("viewState: " + viewState);
PostMethod post = new PostMethod(redirectURL);
- post.getParams().setContentCharset("utf-8"); //
- post.addParameter("javax.faces.partial.ajax", "true"); // //
- post.addParameter("javax.faces.source", "j_idt5:yesButton"); // //
- post.addParameter("javax.faces.partial.execute", "@all"); // //
- post.addParameter("j_idt5:yesButton", "j_idt5:yesButton"); // //
- post.addParameter("j_idt5", "j_idt5"); // //
- post.addParameter("javax.faces.ViewState", status.viewState); //
+ post.getParams().setContentCharset("utf-8");
+ post.addParameter("javax.faces.partial.ajax", "true");
+ post.addParameter("javax.faces.source", "j_idt5:yesButton");
+ post.addParameter("javax.faces.partial.execute", "@all");
+ post.addParameter("j_idt5:yesButton", "j_idt5:yesButton");
+ post.addParameter("j_idt5", "j_idt5");
+ post.addParameter("javax.faces.ViewState", status.viewState);
responseData = executePost(client, post);
- log.debug("Response: " + responseData); //
- if (responseData.contains("/error")) { //
+ log.debug("Response: " + responseData);
+ if (responseData.contains("/error")) {
// Error response - try again
- String errorMessage = Messages.getString("error.Unexpected"); //
+ String errorMessage = Messages.getString("error.Unexpected");
status.errorMessage = errorMessage;
status.mobilePassword = null;
@@ -224,7 +224,7 @@ public class IAIKHandler extends MobileBKUHandler {
}
redirectURL = MobileBKUHelper.extractSubstring(responseData,
- "redirect url=\"", "\""); // //
+ "redirect url=\"", "\"");
baseURL = new URL(status.baseURL);
redirectURL = MobileBKUHelper.getQualifiedURL(redirectURL, baseURL);
redirectURL = status.ensureSessionID(redirectURL);
@@ -232,27 +232,27 @@ public class IAIKHandler extends MobileBKUHandler {
responseData = getRedirect(client, redirectURL);
viewState = MobileBKUHelper.extractValueFromTagWithParam(
- responseData, "input", "name", "javax.faces.ViewState", "value"); // // // //
+ responseData, "input", "name", "javax.faces.ViewState", "value");
status.viewState = viewState;
}
signatureDataURL = status.baseURL;
signatureDataURL = signatureDataURL.substring(0, signatureDataURL.lastIndexOf('/') + 1);
- signatureDataURL += "viewer.jsf" + //
- MobileBKUHelper.extractSubstring(responseData, "viewer.jsf", "\""); // //
- signatureDataURL += (signatureDataURL.contains("?") ? "&" : "?") + // // //
- "pdfoversessionid=" + status.sessionID; //
+ signatureDataURL += "viewer.jsf" +
+ MobileBKUHelper.extractSubstring(responseData, "viewer.jsf", "\"");
+ signatureDataURL += (signatureDataURL.contains("?") ? "&" : "?") +
+ "pdfoversessionid=" + status.sessionID;
String tanURL = MobileBKUHelper.extractValueFromTagWithParam(responseData,
- "form", "name", "tanCodeLogon", "action"); // // // //
+ "form", "name", "tanCodeLogon", "action");
baseURL = new URL(status.baseURL);
tanURL = MobileBKUHelper.getQualifiedURL(tanURL, baseURL);
tanURL = status.ensureSessionID(tanURL);
- log.debug("reference value: " + refVal); //
- log.debug("signatureDataURL: " + signatureDataURL); //
- log.debug("tanURL: " + tanURL); //
- log.debug("viewState: " + viewState); //
+ log.debug("reference value: " + refVal);
+ log.debug("signatureDataURL: " + signatureDataURL);
+ log.debug("tanURL: " + tanURL);
+ log.debug("viewState: " + viewState);
status.refVal = refVal;
status.signatureDataURL = signatureDataURL;
@@ -270,12 +270,12 @@ public class IAIKHandler extends MobileBKUHandler {
HttpClient client = MobileBKUHelper.getHttpClient(status);
PostMethod post = new PostMethod(status.baseURL);
- post.getParams().setContentCharset("utf-8"); //
- post.addParameter("javax.faces.ViewState", status.viewState); //
- post.addParameter("tanCodeLogon", "tanCodeLogon"); // //
- post.addParameter("tanCodeLogon:signButton", ""); // //
- post.addParameter("tanCodeLogon:authCode", status.tan); //
- post.addParameter("referenceValue", status.refVal); //
+ post.getParams().setContentCharset("utf-8");
+ post.addParameter("javax.faces.ViewState", status.viewState);
+ post.addParameter("tanCodeLogon", "tanCodeLogon");
+ post.addParameter("tanCodeLogon:signButton", "");
+ post.addParameter("tanCodeLogon:authCode", status.tan);
+ post.addParameter("referenceValue", status.refVal);
return executePost(client, post);
}
@@ -287,14 +287,14 @@ public class IAIKHandler extends MobileBKUHandler {
public void handleTANResponse(String responseData) throws Exception {
final IAIKStatus status = getStatus();
status.errorMessage = null;
- if (responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) { //
+ if (responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) {
// success
getSigningState().setSignatureResponse(
new SLResponse(responseData, status.server, null, null));
} else {
try {
String errorMessage = MobileBKUHelper.extractContentFromTagWithParam(
- responseData, "p", "class", "ui-messages-error ui-messages-error-signing"); // // //
+ responseData, "p", "class", "ui-messages-error ui-messages-error-signing");
status.errorMessage = errorMessage;
log.error(errorMessage);
@@ -303,21 +303,21 @@ public class IAIKHandler extends MobileBKUHandler {
HttpClient client = MobileBKUHelper.getHttpClient(status);
PostMethod post = new PostMethod(status.baseURL);
- post.getParams().setContentCharset("utf-8"); //
- post.addParameter("javax.faces.partial.ajax", "true"); // //
- post.addParameter("javax.faces.source", "tanCodeLogon:backbutton"); // //
- post.addParameter("javax.faces.partial.execute", "@all"); // //
- post.addParameter("javax.faces.partial.render", "tanCodeLogon:tanCodeLogonPanel"); // //
- post.addParameter("tanCodeLogon:backbutton", "tanCodeLogon:backbutton"); // //
- post.addParameter("tanCodeLogon", "tanCodeLogon"); // //
- post.addParameter("javax.faces.ViewState", status.viewState); //
+ post.getParams().setContentCharset("utf-8");
+ post.addParameter("javax.faces.partial.ajax", "true");
+ post.addParameter("javax.faces.source", "tanCodeLogon:backbutton");
+ post.addParameter("javax.faces.partial.execute", "@all");
+ post.addParameter("javax.faces.partial.render", "tanCodeLogon:tanCodeLogonPanel");
+ post.addParameter("tanCodeLogon:backbutton", "tanCodeLogon:backbutton");
+ post.addParameter("tanCodeLogon", "tanCodeLogon");
+ post.addParameter("javax.faces.ViewState", status.viewState);
executePost(client, post);
} catch (Exception e) {
// Assume that wrong TAN was entered too many times
Display.getDefault().syncExec(() -> {
- Dialog dialog = new Dialog(IAIKHandler.this.shell, Messages.getString("common.warning"), //
- Messages.getString("mobileBKU.tan_tries_exceeded"), //
+ Dialog dialog = new Dialog(IAIKHandler.this.shell, Messages.getString("common.warning"),
+ Messages.getString("mobileBKU.tan_tries_exceeded"),
BUTTONS.OK_CANCEL, ICON.QUESTION);
// TODO: ALSO A COLOSSAL HACK HERE
if (dialog.open() == SWT.CANCEL) {
@@ -339,7 +339,7 @@ public class IAIKHandler extends MobileBKUHandler {
private String getRedirect(HttpClient client, String redirectURL) throws HttpException, IOException {
redirectURL = getStatus().ensureSessionID(redirectURL);
- log.debug("Sending get request to URL " + redirectURL); //
+ log.debug("Sending get request to URL " + redirectURL);
GetMethod get = new GetMethod(redirectURL);
int returnCode = client.executeMethod(get);
@@ -347,7 +347,7 @@ public class IAIKHandler extends MobileBKUHandler {
throw new HttpException(HttpStatus.getStatusText(returnCode));
}
String responseData = get.getResponseBodyAsString();
- log.debug("Response: " + responseData); //
+ log.debug("Response: " + responseData);
return responseData;
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKStatus.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKStatus.java
index 3f093ce2..cb131012 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKStatus.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKStatus.java
@@ -56,11 +56,11 @@ public class IAIKStatus extends MobileBKUStatus {
@Override
public String ensureSessionID(String url)
{
- if (url.contains("jsessionid=")) //
+ if (url.contains("jsessionid="))
return url;
if (this.sessionID != null)
- url += ";jsessionid=" + this.sessionID; //
+ url += ";jsessionid=" + this.sessionID;
return url;
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java
index 8268f6f5..696f75fe 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java
@@ -79,14 +79,14 @@ public abstract class MobileBKUHandler {
sl_request = request.getRequest();
if (useBase64Request())
{
- post.addParameter("XMLRequest", sl_request); //
+ post.addParameter("XMLRequest", sl_request);
} else {
StringPart xmlpart = new StringPart(
- "XMLRequest", sl_request, "UTF-8"); // //
+ "XMLRequest", sl_request, "UTF-8");
- FilePart filepart = new FilePart("fileupload", //
+ FilePart filepart = new FilePart("fileupload",
new FileUploadSource(request.getSignatureData()),
- "application/pdf", "UTF-8"); // //
+ "application/pdf", "UTF-8");
Part[] parts = { xmlpart, filepart };
@@ -95,9 +95,9 @@ public abstract class MobileBKUHandler {
}
} else {
sl_request = request.getRequest();
- post.addParameter("XMLRequest", sl_request); //
+ post.addParameter("XMLRequest", sl_request);
}
- log.trace("SL Request: " + sl_request); //
+ log.trace("SL Request: " + sl_request);
state.status.baseURL = MobileBKUHelper.stripQueryString(mobileBKUUrl);
@@ -176,15 +176,15 @@ public abstract class MobileBKUHandler {
ByteArrayOutputStream os = new ByteArrayOutputStream();
post.getRequestEntity().writeRequest(os);
req = os.toString();
- if (req.contains("passwort=")) //
- req = req.replaceAll("passwort=[^&]*", "passwort=******"); // //
- if (req.contains(":pwd=")) //
- req = req.replaceAll(":pwd=[^&]*", ":pwd=******"); // //
+ if (req.contains("passwort="))
+ req = req.replaceAll("passwort=[^&]*", "passwort=******");
+ if (req.contains(":pwd="))
+ req = req.replaceAll(":pwd=[^&]*", ":pwd=******");
os.close();
} else {
- req = post.getRequestEntity().getContentLength() + " bytes"; //
+ req = post.getRequestEntity().getContentLength() + " bytes";
}
- log.debug("Posting to " + post.getURI() + ": " + req); // //
+ log.debug("Posting to " + post.getURI() + ": " + req);
}
int returnCode = client.executeMethod(post);
@@ -202,12 +202,12 @@ public abstract class MobileBKUHandler {
if (returnCode == HttpStatus.SC_MOVED_TEMPORARILY ||
returnCode == HttpStatus.SC_MOVED_PERMANENTLY) {
- Header locationHeader = post.getResponseHeader("location"); //
+ Header locationHeader = post.getResponseHeader("location");
if (locationHeader != null) {
redirectLocation = locationHeader.getValue();
} else {
throw new IOException(
- "Got HTTP 302 but no location to follow!"); //
+ "Got HTTP 302 but no location to follow!");
}
} else if (returnCode == HttpStatus.SC_OK) {
if (get != null) {
@@ -225,12 +225,12 @@ public abstract class MobileBKUHandler {
server = serverHeader.getValue();
}
redirectLocation = null;
- String p = "<meta [^>]*http-equiv=\"refresh\" [^>]*content=\"([^\"]*)\""; //
+ String p = "<meta [^>]*http-equiv=\"refresh\" [^>]*content=\"([^\"]*)\"";
Pattern pat = Pattern.compile(p);
Matcher m = pat.matcher(responseData);
if (m.find()) {
String content = m.group(1);
- int start = content.indexOf("URL="); //
+ int start = content.indexOf("URL=");
if (start != -1) {
start += 9;
redirectLocation = content.substring(start, content.length() - 5);
@@ -244,7 +244,7 @@ public abstract class MobileBKUHandler {
if (redirectLocation != null) {
redirectLocation = MobileBKUHelper.getQualifiedURL(redirectLocation, new URL(post.getURI().toString()));
redirectLocation = getStatus().ensureSessionID(redirectLocation);
- log.debug("Redirected to " + redirectLocation); //
+ log.debug("Redirected to " + redirectLocation);
get = new GetMethod(redirectLocation);
get.setFollowRedirects(true);
returnCode = client.executeMethod(get);
@@ -253,7 +253,7 @@ public abstract class MobileBKUHandler {
getStatus().server = server;
if (server != null)
- log.info("Server: " + server); //
+ log.info("Server: " + server);
return responseData;
}
@@ -266,7 +266,7 @@ public abstract class MobileBKUHandler {
* @throws IOException IO error
*/
protected String executeGet(HttpClient client, GetMethod get) throws IOException {
- log.debug("Getting " + get.getURI()); //
+ log.debug("Getting " + get.getURI());
int returnCode = client.executeMethod(get);
@@ -284,12 +284,12 @@ public abstract class MobileBKUHandler {
if (returnCode == HttpStatus.SC_MOVED_TEMPORARILY ||
returnCode == HttpStatus.SC_MOVED_PERMANENTLY) {
- Header locationHeader = get.getResponseHeader("location"); //
+ Header locationHeader = get.getResponseHeader("location");
if (locationHeader != null) {
redirectLocation = locationHeader.getValue();
} else {
throw new IOException(
- "Got HTTP 302 but no location to follow!"); //
+ "Got HTTP 302 but no location to follow!");
}
} else if (returnCode == HttpStatus.SC_OK) {
if (get2 != null) {
@@ -307,12 +307,12 @@ public abstract class MobileBKUHandler {
server = serverHeader.getValue();
}
redirectLocation = null;
- String p = "<meta [^>]*http-equiv=\"refresh\" [^>]*content=\"([^\"]*)\""; //
+ String p = "<meta [^>]*http-equiv=\"refresh\" [^>]*content=\"([^\"]*)\"";
Pattern pat = Pattern.compile(p);
Matcher m = pat.matcher(responseData);
if (m.find()) {
String content = m.group(1);
- int start = content.indexOf("URL="); //
+ int start = content.indexOf("URL=");
if (start != -1) {
start += 9;
redirectLocation = content.substring(start, content.length() - 5);
@@ -326,7 +326,7 @@ public abstract class MobileBKUHandler {
if (redirectLocation != null) {
redirectLocation = MobileBKUHelper.getQualifiedURL(redirectLocation, new URL(get.getURI().toString()));
redirectLocation = getStatus().ensureSessionID(redirectLocation);
- log.debug("Redirected to " + redirectLocation); //
+ log.debug("Redirected to " + redirectLocation);
get2 = new GetMethod(redirectLocation);
get2.setFollowRedirects(true);
returnCode = client.executeMethod(get2);
@@ -335,7 +335,7 @@ public abstract class MobileBKUHandler {
getStatus().server = server;
if (server != null)
- log.info("Server: " + server); //
+ log.info("Server: " + server);
return responseData;
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java
index 6b9f0584..f2484afa 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java
@@ -52,7 +52,7 @@ public class MobileBKUHelper {
* +(countryCode)99999999999 00(countryCode)99999999999 099999999999
* 1030199999999999 (A-Trust Test bku)
*/
- private static final String NUMBER_REGEX = "^((\\+[\\d]{2})|(00[\\d]{2})|(0)|(10301))([1-9][\\d]+)$"; //
+ private static final String NUMBER_REGEX = "^((\\+[\\d]{2})|(00[\\d]{2})|(0)|(10301))([1-9][\\d]+)$";
/**
* Extracts a substring from data starting after start and ending with end
@@ -77,10 +77,10 @@ public class MobileBKUHelper {
return data.substring(startidx, endidx);
}
log.error("extracting substring: end not valid!: " + start + " ... " + end); ////
- throw new Exception("End string not available! Mobile BKU site changed?"); //
+ throw new Exception("End string not available! Mobile BKU site changed?");
}
log.error("extracting substring: start not valid!: " + start + " ... " + end); ////
- throw new Exception("Start string not available! Mobile BKU site changed?"); //
+ throw new Exception("Start string not available! Mobile BKU site changed?");
}
/**
@@ -105,16 +105,16 @@ public class MobileBKUHelper {
while ((startidx = data.indexOf(start, endidx)) != -1) {
endidx = data.indexOf('>', startidx);
if (endidx == -1) {
- log.error("extracting tag: unterminated tag! " + tag + " (" + param + "=" + value + ")"); //// // //
- throw new Exception("Tag not found! Mobile BKU site changed?"); //
+ log.error("extracting tag: unterminated tag! " + tag + " (" + param + "=" + value + ")"); ////
+ throw new Exception("Tag not found! Mobile BKU site changed?");
}
String found = data.substring(startidx, endidx + 1);
- if (found.contains(param + "='" + value + "'") || // //
- found.contains(param + "=\"" + value + "\"")) // //
+ if (found.contains(param + "='" + value + "'") ||
+ found.contains(param + "=\"" + value + "\""))
return found;
}
- log.info("extracting tag: not found!: " + tag + " (" + param + "='" + value + "')"); //// // //
- throw new Exception("Tag not found! Mobile BKU site changed?"); //
+ log.info("extracting tag: not found!: " + tag + " (" + param + "='" + value + "')"); ////
+ throw new Exception("Tag not found! Mobile BKU site changed?");
}
/**
@@ -139,14 +139,14 @@ public class MobileBKUHelper {
String found = extractTagWithParam(data, tag, param, value);
int startidx = found.indexOf(returnparam + '=');
if (startidx == -1) {
- log.error("extracting tag: param not found! " + tag + " (" + param + "=" + value + ") - " + returnparam); //// // //
- throw new Exception("Tag not found! Mobile BKU site changed?"); //
+ log.error("extracting tag: param not found! " + tag + " (" + param + "=" + value + ") - " + returnparam); ////
+ throw new Exception("Tag not found! Mobile BKU site changed?");
}
startidx += returnparam.length() + 1;
int endidx = found.indexOf(found.charAt(startidx), startidx + 1);
if (endidx == -1) {
- log.error("extracting tag: unterminated param value! " + tag + " (" + param + "=" + value + ") - " + returnparam); //// // //
- throw new Exception("Tag not found! Mobile BKU site changed?"); //
+ log.error("extracting tag: unterminated param value! " + tag + " (" + param + "=" + value + ") - " + returnparam); ////
+ throw new Exception("Tag not found! Mobile BKU site changed?");
}
return found.substring(startidx + 1, endidx);
}
@@ -187,10 +187,10 @@ public class MobileBKUHelper {
String param, String value) throws Exception {
String found = extractTagWithParam(data, tag, param, value);
int startidx = data.indexOf(found) + found.length();
- int endidx = data.indexOf("</" + tag + ">", startidx); // //
+ int endidx = data.indexOf("</" + tag + ">", startidx);
if (endidx == -1) {
- log.error("extracting tag: closing tag not found! " + tag + " (" + param + "=" + value + ")"); //// // //
- throw new Exception("Tag not found! Mobile BKU site changed?"); //
+ log.error("extracting tag: closing tag not found! " + tag + " (" + param + "=" + value + ")"); ////
+ throw new Exception("Tag not found! Mobile BKU site changed?");
}
return data.substring(startidx, endidx);
}
@@ -220,15 +220,15 @@ public class MobileBKUHelper {
String normalNumber = matcher.group(6);
- if (countryCode.equals("10301")) { //
+ if (countryCode.equals("10301")) {
// A-Trust Testnumber! Don't change
return number;
}
- countryCode = countryCode.replace("00", "+"); // //
+ countryCode = countryCode.replace("00", "+");
- if (countryCode.equals("0")) { //
- countryCode = "+43"; //
+ if (countryCode.equals("0")) {
+ countryCode = "+43";
}
return countryCode + normalNumber;
@@ -272,14 +272,14 @@ public class MobileBKUHelper {
* @return the fully qualified URL
*/
public static String getQualifiedURL(String fragment, URL base) {
- if (fragment.startsWith("http:") || fragment.startsWith("https:")) // //
+ if (fragment.startsWith("http:") || fragment.startsWith("https:"))
return fragment;
int p = base.getPort();
- String port = ((p != -1) && (p != base.getDefaultPort())) ? ":" + p : ""; // //
- if (fragment.startsWith("/")) { //
- return base.getProtocol() + "://" + base.getHost() + port + fragment; //
+ String port = ((p != -1) && (p != base.getDefaultPort())) ? ":" + p : "";
+ if (fragment.startsWith("/")) {
+ return base.getProtocol() + "://" + base.getHost() + port + fragment;
}
- return stripQueryString(base.toString()) + "/" + fragment; //
+ return stripQueryString(base.toString()) + "/" + fragment;
}
/**
@@ -287,8 +287,8 @@ public class MobileBKUHelper {
*/
@SuppressWarnings("deprecation")
public static void registerTrustedSocketFactory() {
- Protocol.registerProtocol("https", //
- new Protocol("https", new TrustedSocketFactory(), 443)); //
+ Protocol.registerProtocol("https",
+ new Protocol("https", new TrustedSocketFactory(), 443));
}
/**
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/SimpleXMLTrustManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/SimpleXMLTrustManager.java
index 08385456..f529d658 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/SimpleXMLTrustManager.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/SimpleXMLTrustManager.java
@@ -64,7 +64,7 @@ public class SimpleXMLTrustManager implements X509TrustManager {
public SimpleXMLTrustManager() throws Exception {
// create a "default" JSSE X509TrustManager.
- TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); //
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
tmf.init((KeyStore) null);
TrustManager tms[] = tmf.getTrustManagers();
@@ -94,8 +94,8 @@ public class SimpleXMLTrustManager implements X509TrustManager {
NodeList certificateList = certificates.getChildNodes();
try {
- if (!certificates.getNodeName().equals("certificates")) { //
- throw new Exception("Used certificates xml is invalid! no certificates node"); //
+ if (!certificates.getNodeName().equals("certificates")) {
+ throw new Exception("Used certificates xml is invalid! no certificates node");
}
//add trusted certificates to certStore//
@@ -104,26 +104,26 @@ public class SimpleXMLTrustManager implements X509TrustManager {
Node certificateNode = certificateList.item(i);
- if (certificateNode.getNodeName().equals("#text")) { //
+ if (certificateNode.getNodeName().equals("#text")) {
continue; // Ignore dummy text node ..
}
- if (!certificateNode.getNodeName().equals("certificate")) { //
- log.warn("Ignoring XML node: " + certificateNode.getNodeName()); //
+ if (!certificateNode.getNodeName().equals("certificate")) {
+ log.warn("Ignoring XML node: " + certificateNode.getNodeName());
continue;
}
String certResource = Constants.RES_CERT_PATH + certificateNode.getTextContent();
- X509Certificate cert = (X509Certificate) CertificateFactory.getInstance("X509"). //
+ X509Certificate cert = (X509Certificate) CertificateFactory.getInstance("X509").
generateCertificate(this.getClass().getResourceAsStream(certResource));
myKeyStore.setCertificateEntry(certificateNode.getTextContent(), cert);
- log.debug("Loaded certificate : " + certResource); //
+ log.debug("Loaded certificate : " + certResource);
} catch (Exception ex) {
- log.error("Failed to load certificate [" + "]", ex); // //
+ log.error("Failed to load certificate [" + "]", ex);
}
}
@@ -156,7 +156,7 @@ public class SimpleXMLTrustManager implements X509TrustManager {
* Find some other way to initialize, or else we have to fail the
* constructor.
*/
- throw new Exception("Couldn't initialize ASITTrustManager"); //
+ throw new Exception("Couldn't initialize ASITTrustManager");
}
/*
@@ -174,7 +174,7 @@ public class SimpleXMLTrustManager implements X509TrustManager {
try {
this.sunJSSEX509TrustManager.checkClientTrusted(arg0, arg1);
} catch (CertificateException ex2) {
- log.info("checkClientTrusted: ", ex2); //
+ log.info("checkClientTrusted: ", ex2);
throw ex2;
}
}
@@ -195,7 +195,7 @@ public class SimpleXMLTrustManager implements X509TrustManager {
try {
this.sunJSSEX509TrustManager.checkServerTrusted(arg0, arg1);
} catch (CertificateException ex2) {
- log.info("checkServerTrusted: ", ex2); //
+ log.info("checkServerTrusted: ", ex2);
throw ex2;
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/TrustedSocketFactory.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/TrustedSocketFactory.java
index ff9b48a0..6f306cdd 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/TrustedSocketFactory.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/TrustedSocketFactory.java
@@ -49,15 +49,15 @@ public class TrustedSocketFactory implements SecureProtocolSocketFactory {
.getLogger(TrustedSocketFactory.class);
private static final String ENABLED_CS[] = {
- "TLS_RSA_WITH_AES_128_CBC_SHA", //
- "SSL_RSA_WITH_RC4_128_SHA", //
- "SSL_RSA_WITH_3DES_EDE_CBC_SHA", //
- "SSL_RSA_WITH_RC4_128_MD5" //
+ "TLS_RSA_WITH_AES_128_CBC_SHA",
+ "SSL_RSA_WITH_RC4_128_SHA",
+ "SSL_RSA_WITH_3DES_EDE_CBC_SHA",
+ "SSL_RSA_WITH_RC4_128_MD5"
};
private static SSLSocketFactory getFactory() throws NoSuchAlgorithmException,
KeyManagementException, Exception {
- SSLContext sslContext = SSLContext.getInstance("TLS"); //
+ SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, new TrustManager[] { new SimpleXMLTrustManager() },
new java.security.SecureRandom());
@@ -80,14 +80,14 @@ public class TrustedSocketFactory implements SecureProtocolSocketFactory {
sslSocket.setEnabledCipherSuites(ENABLED_CS);
return sslSocket;
} catch (Exception ex) {
- log.error("TrustedSocketFactory: ", ex); //
+ log.error("TrustedSocketFactory: ", ex);
if (ex instanceof IOException) {
throw (IOException) ex;
} else if (ex instanceof UnknownHostException) {
throw (UnknownHostException) ex;
} else {
throw new IOException(
- Messages.getString("TrustedSocketFactory.FailedToCreateSecureConnection"), ex); //
+ Messages.getString("TrustedSocketFactory.FailedToCreateSecureConnection"), ex);
}
}
}
@@ -108,14 +108,14 @@ public class TrustedSocketFactory implements SecureProtocolSocketFactory {
sslSocket.setEnabledCipherSuites(ENABLED_CS);
return sslSocket;
} catch (Exception ex) {
- log.error("TrustedSocketFactory: ", ex); //
+ log.error("TrustedSocketFactory: ", ex);
if (ex instanceof IOException) {
throw (IOException) ex;
} else if (ex instanceof UnknownHostException) {
throw (UnknownHostException) ex;
} else {
throw new IOException(
- Messages.getString("TrustedSocketFactory.FailedToCreateSecureConnection"), ex); //
+ Messages.getString("TrustedSocketFactory.FailedToCreateSecureConnection"), ex);
}
}
}
@@ -134,7 +134,7 @@ public class TrustedSocketFactory implements SecureProtocolSocketFactory {
UnknownHostException, ConnectTimeoutException {
try {
if (params == null) {
- throw new IllegalArgumentException("Parameters may not be null"); //
+ throw new IllegalArgumentException("Parameters may not be null");
}
int timeout = params.getConnectionTimeout();
SSLSocket sslSocket = null;
@@ -154,14 +154,14 @@ public class TrustedSocketFactory implements SecureProtocolSocketFactory {
sslSocket.setEnabledCipherSuites(ENABLED_CS);
return sslSocket;
} catch (Exception ex) {
- log.error("TrustedSocketFactory: ", ex); //
+ log.error("TrustedSocketFactory: ", ex);
if (ex instanceof IOException) {
throw (IOException) ex;
} else if (ex instanceof UnknownHostException) {
throw (UnknownHostException) ex;
} else {
throw new IOException(
- Messages.getString("TrustedSocketFactory.FailedToCreateSecureConnection"), ex); //
+ Messages.getString("TrustedSocketFactory.FailedToCreateSecureConnection"), ex);
}
}
}
@@ -177,14 +177,14 @@ public class TrustedSocketFactory implements SecureProtocolSocketFactory {
sslSocket.setEnabledCipherSuites(ENABLED_CS);
return sslSocket;
} catch (Exception ex) {
- log.error("TrustedSocketFactory: ", ex); //
+ log.error("TrustedSocketFactory: ", ex);
if (ex instanceof IOException) {
throw (IOException) ex;
} else if (ex instanceof UnknownHostException) {
throw (UnknownHostException) ex;
} else {
throw new IOException(
- Messages.getString("TrustedSocketFactory.FailedToCreateSecureConnection"), ex); //
+ Messages.getString("TrustedSocketFactory.FailedToCreateSecureConnection"), ex);
}
}
}