From e4767bccc7324d4b61a334bf6c0558d0080045e2 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Wed, 6 Jul 2022 12:33:33 +0200 Subject: remove NON-NLS comments, cleanup whitespace --- .../asit/pdfover/gui/bku/mobile/ATrustHandler.java | 278 ++++++++++----------- .../asit/pdfover/gui/bku/mobile/ATrustStatus.java | 12 +- .../asit/pdfover/gui/bku/mobile/IAIKHandler.java | 160 ++++++------ .../at/asit/pdfover/gui/bku/mobile/IAIKStatus.java | 4 +- .../pdfover/gui/bku/mobile/MobileBKUHandler.java | 54 ++-- .../pdfover/gui/bku/mobile/MobileBKUHelper.java | 108 ++++---- .../pdfover/gui/bku/mobile/MobileBKUStatus.java | 2 +- .../gui/bku/mobile/SimpleXMLTrustManager.java | 34 +-- .../gui/bku/mobile/TrustedSocketFactory.java | 36 +-- 9 files changed, 344 insertions(+), 344 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile') 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 03003325..aa98317e 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/"; //$NON-NLS-1$ + private static final String ACTIVATION_URL = "https://www.handy-signatur.at/"; // private boolean useBase64 = false; @@ -86,36 +86,36 @@ public class ATrustHandler extends MobileBKUHandler { public void handleSLRequestResponse(String responseData) throws Exception { ATrustStatus status = getStatus(); - if (responseData.contains("", ""); //$NON-NLS-1$ //$NON-NLS-2$ + "", ""); // // String errorMsg = MobileBKUHelper.extractSubstring(responseData, - "", ""); //$NON-NLS-1$ //$NON-NLS-2$ - throw new Exception("Error from mobile BKU: " + //$NON-NLS-1$ - errorCode + " - " + errorMsg); //$NON-NLS-1$ + "", ""); // // + throw new Exception("Error from mobile BKU: " + // + errorCode + " - " + errorMsg); // } // Extract infos: String sessionID = MobileBKUHelper.extractSubstring(responseData, - "identification.aspx?sid=", "\""); //$NON-NLS-1$ //$NON-NLS-2$ + "identification.aspx?sid=", "\""); // // String viewState = MobileBKUHelper.extractValueFromTagWithParam( - responseData, "", "id", "__VIEWSTATE", "value"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + responseData, "", "id", "__VIEWSTATE", "value"); // // // // String eventValidation = MobileBKUHelper.extractValueFromTagWithParam( - responseData, "", "id", "__EVENTVALIDATION", "value"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - - String viewstateGenerator = MobileBKUHelper.extractValueFromTagWithParamOptional(responseData, "", "id", "__VIEWSTATEGENERATOR", "value"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - - String dynamicAttrPhonenumber = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_PHONE_NUMBER); - String dynamicAttrPassword = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_SIGN_PASS); - String dynamicAttrButtonId = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_BTN_IDF); - String dynamicAttrTan = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_TAN); - - - log.info("sessionID: " + sessionID); //$NON-NLS-1$ - log.info("viewState: " + viewState); //$NON-NLS-1$ - log.info("eventValidation: " + eventValidation); //$NON-NLS-1$ + responseData, "", "id", "__EVENTVALIDATION", "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); + String dynamicAttrButtonId = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_BTN_IDF); + String dynamicAttrTan = MobileBKUHelper.getDynamicNameAttribute(responseData, Constants.LABEL_TAN); + + + log.info("sessionID: " + sessionID); // + log.info("viewState: " + viewState); // + log.info("eventValidation: " + eventValidation); // status.sessionID = sessionID; status.viewState = viewState; @@ -137,14 +137,14 @@ public class ATrustHandler extends MobileBKUHandler { MobileBKUHelper.registerTrustedSocketFactory(); HttpClient client = MobileBKUHelper.getHttpClient(getStatus()); - PostMethod post = new PostMethod(status.baseURL + "/identification.aspx?sid=" + status.sessionID); //$NON-NLS-1$ - post.getParams().setContentCharset("utf-8"); //$NON-NLS-1$ - post.addParameter("__VIEWSTATE", status.viewState); //$NON-NLS-1$ - post.addParameter("__VIEWSTATEGENERATOR", status.viewStateGenerator); //$NON-NLS-1$ - post.addParameter("__EVENTVALIDATION", status.eventValidation); //$NON-NLS-1$ - post.addParameter(status.dynAttrPhoneNumber, status.phoneNumber); - post.addParameter(status.dynAttrPassword, status.mobilePassword); - post.addParameter(status.dynAttrBtnId, "Identifizieren"); //$NON-NLS-1$ + 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"); return executePost(client, post); } @@ -164,29 +164,29 @@ public class ATrustHandler extends MobileBKUHandler { status.errorMessage = null; - if (responseData.contains("ExpiresInfo.aspx?sid=")) { //$NON-NLS-1$ + if (responseData.contains("ExpiresInfo.aspx?sid=")) { // // Certificate expiration interstitial - skip - String notice = Messages.getString("mobileBKU.notice") + " " + //$NON-NLS-1$ //$NON-NLS-2$ - StringEscapeUtils.unescapeHtml4(MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "Label2")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - .replaceAll("\\<.*?\\>", ""); //$NON-NLS-1$ //$NON-NLS-2$ + String notice = Messages.getString("mobileBKU.notice") + " " + // // + StringEscapeUtils.unescapeHtml4(MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "Label2")) // // // + .replaceAll("\\<.*?\\>", ""); // // log.info(notice); if (!expiryNoticeDisplayed) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { - Dialog d = new Dialog(ATrustHandler.this.shell, Messages.getString("common.info"), Messages.getString("mobileBKU.certExpiresSoon"), BUTTONS.YES_NO, ICON.WARNING); //$NON-NLS-1$ //$NON-NLS-2$ + 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); //$NON-NLS-1$ + 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); //$NON-NLS-1$ + log.debug("Error opening URL", e); // } } - log.info("SWT Desktop is not supported on this platform"); //$NON-NLS-1$ + log.info("SWT Desktop is not supported on this platform"); // Program.launch(ACTIVATION_URL); } } @@ -194,97 +194,97 @@ public class ATrustHandler extends MobileBKUHandler { expiryNoticeDisplayed = true; } - String t_sessionID = MobileBKUHelper.extractSubstring(responseData, "ExpiresInfo.aspx?sid=", "\""); //$NON-NLS-1$ //$NON-NLS-2$ - String t_viewState = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__VIEWSTATE", "value"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - String t_eventValidation = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__EVENTVALIDATION", "value"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + 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); //$NON-NLS-1$ - post.getParams().setContentCharset("utf-8"); //$NON-NLS-1$ - post.addParameter("__VIEWSTATE", t_viewState); //$NON-NLS-1$ - post.addParameter("__EVENTVALIDATION", t_eventValidation); //$NON-NLS-1$ - post.addParameter("Button_Next", "Weiter"); //$NON-NLS-1$ //$NON-NLS-2$ + 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); //$NON-NLS-1$ - } else if (responseData.contains("tanAppInfo.aspx?sid=")) { //$NON-NLS-1$ + log.trace("Response from mobile BKU: " + responseData); // + } else if (responseData.contains("tanAppInfo.aspx?sid=")) { // // App info interstitial - skip - log.info("Skipping tan app interstitial"); //$NON-NLS-1$ + 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=", "\""); //$NON-NLS-1$ //$NON-NLS-2$ - String t_viewState = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__VIEWSTATE", "value"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - String t_eventValidation = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__EVENTVALIDATION", "value"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - // Post again to skip MobileBKUHelper.registerTrustedSocketFactory(); HttpClient client = MobileBKUHelper.getHttpClient(getStatus()); - PostMethod post = new PostMethod(status.baseURL + "/tanAppInfo.aspx?sid=" + t_sessionID); //$NON-NLS-1$ - post.getParams().setContentCharset("utf-8"); //$NON-NLS-1$ - post.addParameter("__VIEWSTATE", t_viewState); //$NON-NLS-1$ - post.addParameter("__EVENTVALIDATION", t_eventValidation); //$NON-NLS-1$ - post.addParameter("NextBtn", "Weiter"); //$NON-NLS-1$ //$NON-NLS-2$ + 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); //$NON-NLS-1$ + log.trace("Response from mobile BKU: " + responseData); // } - if (responseData.contains("signature.aspx?sid=")) { //$NON-NLS-1$ + if (responseData.contains("signature.aspx?sid=")) { // // credentials ok! TAN entry - log.debug("Credentials accepted - TAN required"); //$NON-NLS-1$ - sessionID = MobileBKUHelper.extractSubstring(responseData, "signature.aspx?sid=", "\""); //$NON-NLS-1$ //$NON-NLS-2$ - viewState = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__VIEWSTATE", "value"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - eventValidation = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__EVENTVALIDATION", "value"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - refVal = MobileBKUHelper.extractSubstring(responseData, "id='vergleichswert'>Vergleichswert:", ""); //$NON-NLS-1$ //$NON-NLS-2$ - signatureDataURL = status.baseURL + "/ShowSigobj.aspx" + //$NON-NLS-1$ - MobileBKUHelper.extractSubstring(responseData, "ShowSigobj.aspx", "'"); //$NON-NLS-1$ //$NON-NLS-2$ + 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'>Vergleichswert:", ""); // // + signatureDataURL = status.baseURL + "/ShowSigobj.aspx" + // + MobileBKUHelper.extractSubstring(responseData, "ShowSigobj.aspx", "'"); // // try { - String qrCode = MobileBKUHelper.extractValueFromTagWithParam(responseData, "img", "class", "qrcode", "src"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - log.debug("QR Code found: " + qrCode); //$NON-NLS-1$ + 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"); //$NON-NLS-1$ + log.debug("No QR Code found"); // } try { - String tanTextTan = MobileBKUHelper.extractValueFromTagWithParam(responseData, "label", "id", "label_for_input_tan", "for"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + 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"); //$NON-NLS-1$ + log.debug("No tan field found"); // } try { - String tanTextTan = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "text_tan"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + 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"); //$NON-NLS-1$ + log.debug("No text_tan tag"); // } - - } else if (responseData.contains("sl:InfoboxReadResponse")) { //$NON-NLS-1$ + + } else if (responseData.contains("sl:InfoboxReadResponse")) { // // credentials ok! InfoboxReadResponse - log.debug("Credentials accepted - Response given"); //$NON-NLS-1$ + log.debug("Credentials accepted - Response given"); // getSigningState().setSignatureResponse(new SLResponse(responseData, getStatus().server, null, null)); return; - } else if (responseData.contains("undecided.aspx?sid=")) { //$NON-NLS-1$ - // skip intermediate page - log.debug("Page Undecided"); //$NON-NLS-1$ + } else if (responseData.contains("undecided.aspx?sid=")) { // + // skip intermediate page + log.debug("Page Undecided"); // getSigningState().setSignatureResponse(new SLResponse(responseData, getStatus().server, null, null)); - status.errorMessage = "waiting..."; //$NON-NLS-1$ - return; + status.errorMessage = "waiting..."; // + return; }else { // error page // extract error text! try { - String errorMessage = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "class", "ErrorClass"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String errorMessage = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "class", "ErrorClass"); // // // status.errorMessage = errorMessage; } catch (Exception e) { - throw new SignatureException(MobileBKUHelper.extractSubstring(responseData, "", "") + ": " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - MobileBKUHelper.extractSubstring(responseData, "", "")); //$NON-NLS-1$ //$NON-NLS-2$ + throw new SignatureException(MobileBKUHelper.extractSubstring(responseData, "", "") + ": " + // // // + MobileBKUHelper.extractSubstring(responseData, "", "")); // // } // force UI again! @@ -311,20 +311,20 @@ public class ATrustHandler extends MobileBKUHandler { @Override public String postTAN() throws IOException { ATrustStatus status = getStatus(); - + MobileBKUHelper.registerTrustedSocketFactory(); HttpClient client = MobileBKUHelper.getHttpClient(getStatus()); - + PostMethod post = new PostMethod(status.baseURL - + "/signature.aspx?sid=" + status.sessionID); //$NON-NLS-1$ - post.getParams().setContentCharset("utf-8"); //$NON-NLS-1$ - post.addParameter("__VIEWSTATE", status.viewState); //$NON-NLS-1$ + + "/signature.aspx?sid=" + status.sessionID); // + post.getParams().setContentCharset("utf-8"); // + post.addParameter("__VIEWSTATE", status.viewState); // post.addParameter( - "__EVENTVALIDATION", status.eventValidation); //$NON-NLS-1$ - post.addParameter(status.dynAttrTan, status.tan); - post.addParameter(status.dynAttrSignButton, "Signieren"); //$NON-NLS-1$ - post.addParameter("Button1", "Identifizieren"); //$NON-NLS-1$ //$NON-NLS-2$ - + "__EVENTVALIDATION", status.eventValidation); // + post.addParameter(status.dynAttrTan, status.tan); + post.addParameter(status.dynAttrSignButton, "Signieren"); + post.addParameter("Button1", "Identifizieren"); // // + return executePost(client, post); } @@ -334,21 +334,21 @@ public class ATrustHandler extends MobileBKUHandler { @Override public void handleTANResponse(String responseData) { getStatus().errorMessage = null; - if (responseData.contains("sl:CreateXMLSignatureResponse xmlns:sl") || //$NON-NLS-1$ - responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) { //$NON-NLS-1$ + if (responseData.contains("sl:CreateXMLSignatureResponse xmlns:sl") || // + responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) { // // success !! - + getSigningState().setSignatureResponse( new SLResponse(responseData, getStatus().server, null, null)); } else { try { String tries = MobileBKUHelper.extractSubstring( - responseData, "Sie haben noch", "Versuch"); //$NON-NLS-1$ //$NON-NLS-2$ + 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); //$NON-NLS-1$ + log.debug("Error parsing TAN response", e); // } if (getStatus().tanTries <= 0) { @@ -356,10 +356,10 @@ public class ATrustHandler extends MobileBKUHandler { Display.getDefault().syncExec(new Runnable() { @Override public void run() { - Dialog dialog = new Dialog(ATrustHandler.this.shell, Messages.getString("common.warning"), //$NON-NLS-1$ - Messages.getString("mobileBKU.tan_tries_exceeded"), //$NON-NLS-1$ + 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 if (dialog.open() == SWT.CANCEL) { // Go back to BKU Selection @@ -387,7 +387,7 @@ public class ATrustHandler extends MobileBKUHandler { GetMethod get = new GetMethod(status.baseURL + "/sendsms.aspx?sid=" + status.sessionID); - get.getParams().setContentCharset("utf-8"); //$NON-NLS-1$ + get.getParams().setContentCharset("utf-8"); // return executeGet(client, get); } @@ -398,7 +398,7 @@ public class ATrustHandler extends MobileBKUHandler { */ public InputStream getQRCode() { //TODO: Update HTTPClient here - + ATrustStatus status = getStatus(); MobileBKUHelper.registerTrustedSocketFactory(); @@ -407,17 +407,17 @@ public class ATrustHandler extends MobileBKUHandler { GetMethod get = new GetMethod(status.baseURL + "/" + status.qrCodeURL); try { - log.debug("Getting " + get.getURI()); //$NON-NLS-1$ + log.debug("Getting " + get.getURI()); // int returnCode = client.executeMethod(get); if (returnCode != HttpStatus.SC_OK) { - log.error("Error getting QR code"); //$NON-NLS-1$ + log.error("Error getting QR code"); // return null; } return get.getResponseBodyAsStream(); } catch (Exception e) { - log.error("Error getting QR code", e); //$NON-NLS-1$ + log.error("Error getting QR code", e); // return null; } } @@ -436,24 +436,24 @@ 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); //$NON-NLS-1$ + + "/signature.aspx?sid=" + status.sessionID); // return executeGet(client, get); } - + /** * @param responseData * @return a boolean */ public Boolean handleWaitforAppResponse(String responseData) { - + getStatus().errorMessage = null; - if (!responseData.toLowerCase().contains("Bitte starten Sie Ihre Handy-Signatur App!".toLowerCase())/* || //$NON-NLS-1$ - responseData.toLowerCase().contains("TAN (Handy-Signatur App)".toLowerCase())*/) { //$NON-NLS-1$ + if (!responseData.toLowerCase().contains("Bitte starten Sie Ihre Handy-Signatur App!".toLowerCase())/* || // + responseData.toLowerCase().contains("TAN (Handy-Signatur App)".toLowerCase())*/) { // return true; } - return false; + return false; } /** @@ -463,8 +463,8 @@ public class ATrustHandler extends MobileBKUHandler { */ public boolean handleQRResponse(String responseData) { getStatus().errorMessage = null; - if (responseData.contains("sl:CreateXMLSignatureResponse xmlns:sl") || //$NON-NLS-1$ - responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) { //$NON-NLS-1$ + if (responseData.contains("sl:CreateXMLSignatureResponse xmlns:sl") || // + responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) { // // success !! getSigningState().setSignatureResponse( @@ -489,17 +489,17 @@ public class ATrustHandler extends MobileBKUHandler { /* * (non-Javadoc) - * + * */ @Override public boolean handlePolling() throws ATrustConnectionException { - + ATrustStatus status = getStatus(); URLConnection urlconnection = null; String isReady = null; Status serverStatus = null; int waits = 0; - final String ERROR = "Error: Server is not responding"; //$NON-NLS-1$ + final String ERROR = "Error: Server is not responding"; // HttpClient client; try { do { @@ -517,7 +517,7 @@ public class ATrustHandler extends MobileBKUHandler { int returnValue = client.executeMethod(get); InputStream in = new BufferedInputStream(get.getResponseBodyAsStream()); - isReady = IOUtils.toString(in, "utf-8"); //$NON-NLS-1$ + isReady = IOUtils.toString(in, "utf-8"); // serverStatus = new Status(isReady); if (serverStatus.isFin()) { @@ -530,36 +530,36 @@ public class ATrustHandler extends MobileBKUHandler { } while (serverStatus.isWait()); if (serverStatus.isFin()) { - return true; + return true; } //else error status.errorMessage = "Server reponded ERROR during polling"; - log.error("Server reponded ERROR during polling"); //$NON-NLS-1$ + log.error("Server reponded ERROR during polling"); // throw new ATrustConnectionException(); } catch (Exception e) { - log.error("handle polling failed" + e.getMessage()); //$NON-NLS-1$ + log.error("handle polling failed" + e.getMessage()); // throw new ATrustConnectionException(); } } - + private class Status { - private final boolean fin; - private final boolean error; - private final boolean wait; - + private final boolean fin; + private final boolean error; + private final boolean wait; + public Status(String status) { JsonElement jelement = new JsonParser().parse(status.toLowerCase()); JsonObject jobject = jelement.getAsJsonObject(); - this.fin = jobject.get("fin").getAsBoolean(); //$NON-NLS-1$ - this.error = jobject.get("error").getAsBoolean(); //$NON-NLS-1$ - this.wait = jobject.get("wait").getAsBoolean(); //$NON-NLS-1$ + this.fin = jobject.get("fin").getAsBoolean(); + this.error = jobject.get("error").getAsBoolean(); + this.wait = jobject.get("wait").getAsBoolean(); } - + public Status(boolean error) { - this.error = error; - this.fin = false; - this.wait = false; + this.error = error; + this.fin = false; + this.wait = false; } public boolean isFin() { @@ -573,12 +573,12 @@ public class ATrustHandler extends MobileBKUHandler { public boolean isWait() { return wait; } - - - - + + + + } - + } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java index cbd26f8c..20f645a2 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java @@ -41,12 +41,12 @@ public class ATrustStatus extends MobileBKUStatus { public String qrCodeURL = null; public boolean tanField = false; public boolean isAPPTan = false; - public String viewStateGenerator; - public String dynAttrPhoneNumber; - public String dynAttrPassword; - public String dynAttrBtnId; - public String dynAttrTan; - public String dynAttrSignButton; + public String viewStateGenerator; + public String dynAttrPhoneNumber; + public String dynAttrPassword; + public String dynAttrBtnId; + public String dynAttrTan; + public String dynAttrSignButton; public boolean isSMSTan = false; /** 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 cbf0ee03..77572f26 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 @@ -38,7 +38,7 @@ import at.asit.pdfover.gui.workflow.states.MobileBKUState; import at.asit.pdfover.signator.SLResponse; /** - * + * */ public class IAIKHandler extends MobileBKUHandler { /** @@ -68,23 +68,23 @@ public class IAIKHandler extends MobileBKUHandler { // Extract infos: String credentialURL = MobileBKUHelper.extractValueFromTagWithParam(responseData, - "form", "name", "userCredLogon", "action"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + "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"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + responseData, "input", "name", "javax.faces.ViewState", "value"); // // // // String sessionID = null; - int si = credentialURL.indexOf("jsessionid="); //$NON-NLS-1$ + int si = credentialURL.indexOf("jsessionid="); // if (si != -1) sessionID = credentialURL.substring(si + 11); else sessionID = status.sessionID; - log.info("credentialURL: " + credentialURL); //$NON-NLS-1$ - log.info("sessionID: " + sessionID); //$NON-NLS-1$ - log.info("viewState: " + viewState); //$NON-NLS-1$ + 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"); //$NON-NLS-1$ + 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"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("javax.faces.partial.ajax", "true"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("javax.faces.source", "userCredLogon:logonButton"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("javax.faces.partial.execute", "@all"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("javax.faces.partial.render", "userCredLogon:userCredentialLogonPanel"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("userCredLogon", "userCredLogon"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("userCredLogon:j_idt33_input", "de"); //$NON-NLS-1$ //$NON-NLS-2$ + 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")) { //$NON-NLS-1$ + if (!responseData.contains("redirection_url")) { // // Assume that an error occurred String errorMessage; try { - errorMessage = MobileBKUHelper.extractSubstring(responseData, ":errorMessage\">", ""); //$NON-NLS-1$ //$NON-NLS-2$ + errorMessage = MobileBKUHelper.extractSubstring(responseData, ":errorMessage\">", ""); // // } catch (Exception e) { - errorMessage = Messages.getString("error.Unexpected"); //$NON-NLS-1$ + 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\":\"", "\""); //$NON-NLS-1$ //$NON-NLS-2$ + "\"redirection_url\":\"", "\""); // // URL baseURL = new URL(status.baseURL); redirectURL = MobileBKUHelper.getQualifiedURL(redirectURL, baseURL); @@ -157,66 +157,66 @@ public class IAIKHandler extends MobileBKUHandler { responseData = getRedirect(client, redirectURL); - if (responseData.contains("sl:InfoboxReadResponse")) { //$NON-NLS-1$ + if (responseData.contains("sl:InfoboxReadResponse")) { // // credentials ok! InfoboxReadResponse getSigningState().setSignatureResponse( new SLResponse(responseData, status.server, null, null)); return; } - + if (responseData.contains("tanCodeLogon")) { refVal = MobileBKUHelper.extractContentFromTagWithParam(responseData, - "span", "id", "tanCodeLogon:refValue"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + "span", "id", "tanCodeLogon:refValue"); // // // } else { refVal = MobileBKUHelper.extractContentFromTagWithParam(responseData, - "span", "id", "j_idt5:refValue"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + "span", "id", "j_idt5:refValue"); // // // } - - if (responseData.contains("/error")) { //$NON-NLS-1$ + + if (responseData.contains("/error")) { // // Error response - try again String errorMessage = MobileBKUHelper.extractContentFromTagWithParam( - responseData, "div", "id", "errorPanel:panel_content"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - if (errorMessage.contains("
")) //$NON-NLS-1$ - errorMessage = errorMessage.substring(0, errorMessage.indexOf("
")); //$NON-NLS-1$ - errorMessage.replace("\n", " "); //$NON-NLS-1$ //$NON-NLS-2$ + responseData, "div", "id", "errorPanel:panel_content"); // // // + if (errorMessage.contains("
")) // + errorMessage = errorMessage.substring(0, errorMessage.indexOf("
")); // + errorMessage.replace("\n", " "); // // status.errorMessage = errorMessage; status.mobilePassword = null; return; } - - - + + + String viewState = MobileBKUHelper.extractValueFromTagWithParam( - responseData, "input", "name", "javax.faces.ViewState", "value"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + responseData, "input", "name", "javax.faces.ViewState", "value"); // // // // status.viewState = viewState; - if (!responseData.contains("tanCodeLogon.jsf")) { //$NON-NLS-1$ + if (!responseData.contains("tanCodeLogon.jsf")) { // // Assume that we need to confirm reference value dialog - log.debug("viewState: " + viewState); //$NON-NLS-1$ - - + log.debug("viewState: " + viewState); // + + PostMethod post = new PostMethod(redirectURL); - post.getParams().setContentCharset("utf-8"); //$NON-NLS-1$ - post.addParameter("javax.faces.partial.ajax", "true"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("javax.faces.source", "j_idt5:yesButton"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("javax.faces.partial.execute", "@all"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("j_idt5:yesButton", "j_idt5:yesButton"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("j_idt5", "j_idt5"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("javax.faces.ViewState", status.viewState); //$NON-NLS-1$ + 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); //$NON-NLS-1$ - if (responseData.contains("/error")) { //$NON-NLS-1$ + log.debug("Response: " + responseData); // + if (responseData.contains("/error")) { // // Error response - try again - String errorMessage = Messages.getString("error.Unexpected"); //$NON-NLS-1$ + 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=\"", "\""); //$NON-NLS-1$ //$NON-NLS-2$ + "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"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + responseData, "input", "name", "javax.faces.ViewState", "value"); // // // // status.viewState = viewState; } signatureDataURL = status.baseURL; signatureDataURL = signatureDataURL.substring(0, signatureDataURL.lastIndexOf('/') + 1); - signatureDataURL += "viewer.jsf" + //$NON-NLS-1$ - MobileBKUHelper.extractSubstring(responseData, "viewer.jsf", "\""); //$NON-NLS-1$ //$NON-NLS-2$ - signatureDataURL += (signatureDataURL.contains("?") ? "&" : "?") + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "pdfoversessionid=" + status.sessionID; //$NON-NLS-1$ + signatureDataURL += "viewer.jsf" + // + MobileBKUHelper.extractSubstring(responseData, "viewer.jsf", "\""); // // + signatureDataURL += (signatureDataURL.contains("?") ? "&" : "?") + // // // + "pdfoversessionid=" + status.sessionID; // String tanURL = MobileBKUHelper.extractValueFromTagWithParam(responseData, - "form", "name", "tanCodeLogon", "action"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + "form", "name", "tanCodeLogon", "action"); // // // // baseURL = new URL(status.baseURL); tanURL = MobileBKUHelper.getQualifiedURL(tanURL, baseURL); tanURL = status.ensureSessionID(tanURL); - log.debug("reference value: " + refVal); //$NON-NLS-1$ - log.debug("signatureDataURL: " + signatureDataURL); //$NON-NLS-1$ - log.debug("tanURL: " + tanURL); //$NON-NLS-1$ - log.debug("viewState: " + viewState); //$NON-NLS-1$ + 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"); //$NON-NLS-1$ - post.addParameter("javax.faces.ViewState", status.viewState); //$NON-NLS-1$ - post.addParameter("tanCodeLogon", "tanCodeLogon"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("tanCodeLogon:signButton", ""); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("tanCodeLogon:authCode", status.tan); //$NON-NLS-1$ - post.addParameter("referenceValue", status.refVal); //$NON-NLS-1$ + 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")) { //$NON-NLS-1$ + 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"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + responseData, "p", "class", "ui-messages-error ui-messages-error-signing"); // // // status.errorMessage = errorMessage; log.error(errorMessage); @@ -303,14 +303,14 @@ public class IAIKHandler extends MobileBKUHandler { HttpClient client = MobileBKUHelper.getHttpClient(status); PostMethod post = new PostMethod(status.baseURL); - post.getParams().setContentCharset("utf-8"); //$NON-NLS-1$ - post.addParameter("javax.faces.partial.ajax", "true"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("javax.faces.source", "tanCodeLogon:backbutton"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("javax.faces.partial.execute", "@all"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("javax.faces.partial.render", "tanCodeLogon:tanCodeLogonPanel"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("tanCodeLogon:backbutton", "tanCodeLogon:backbutton"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("tanCodeLogon", "tanCodeLogon"); //$NON-NLS-1$ //$NON-NLS-2$ - post.addParameter("javax.faces.ViewState", status.viewState); //$NON-NLS-1$ + 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) { @@ -318,8 +318,8 @@ public class IAIKHandler extends MobileBKUHandler { Display.getDefault().syncExec(new Runnable() { @Override public void run() { - Dialog dialog = new Dialog(IAIKHandler.this.shell, Messages.getString("common.warning"), //$NON-NLS-1$ - Messages.getString("mobileBKU.tan_tries_exceeded"), //$NON-NLS-1$ + 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) { @@ -342,7 +342,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); //$NON-NLS-1$ + log.debug("Sending get request to URL " + redirectURL); // GetMethod get = new GetMethod(redirectURL); int returnCode = client.executeMethod(get); @@ -350,7 +350,7 @@ public class IAIKHandler extends MobileBKUHandler { throw new HttpException(HttpStatus.getStatusText(returnCode)); } String responseData = get.getResponseBodyAsString(); - log.debug("Response: " + responseData); //$NON-NLS-1$ + log.debug("Response: " + responseData); // return responseData; } @@ -361,10 +361,10 @@ public class IAIKHandler extends MobileBKUHandler { public boolean useBase64Request() { return false; } - + @Override public boolean handlePolling() { //nothing todo - return true; + return true; } } 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 808df7d4..3f093ce2 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=")) //$NON-NLS-1$ + if (url.contains("jsessionid=")) // return url; if (this.sessionID != null) - url += ";jsessionid=" + this.sessionID; //$NON-NLS-1$ + 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 200ca54e..8268f6f5 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); //$NON-NLS-1$ + post.addParameter("XMLRequest", sl_request); // } else { StringPart xmlpart = new StringPart( - "XMLRequest", sl_request, "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$ + "XMLRequest", sl_request, "UTF-8"); // // - FilePart filepart = new FilePart("fileupload", //$NON-NLS-1$ + FilePart filepart = new FilePart("fileupload", // new FileUploadSource(request.getSignatureData()), - "application/pdf", "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$ + "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); //$NON-NLS-1$ + post.addParameter("XMLRequest", sl_request); // } - log.trace("SL Request: " + sl_request); //$NON-NLS-1$ + log.trace("SL Request: " + sl_request); // state.status.baseURL = MobileBKUHelper.stripQueryString(mobileBKUUrl); @@ -176,21 +176,21 @@ public abstract class MobileBKUHandler { ByteArrayOutputStream os = new ByteArrayOutputStream(); post.getRequestEntity().writeRequest(os); req = os.toString(); - if (req.contains("passwort=")) //$NON-NLS-1$ - req = req.replaceAll("passwort=[^&]*", "passwort=******"); //$NON-NLS-1$ //$NON-NLS-2$ - if (req.contains(":pwd=")) //$NON-NLS-1$ - req = req.replaceAll(":pwd=[^&]*", ":pwd=******"); //$NON-NLS-1$ //$NON-NLS-2$ + 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"; //$NON-NLS-1$ + req = post.getRequestEntity().getContentLength() + " bytes"; // } - log.debug("Posting to " + post.getURI() + ": " + req); //$NON-NLS-1$ //$NON-NLS-2$ + log.debug("Posting to " + post.getURI() + ": " + req); // // } int returnCode = client.executeMethod(post); String redirectLocation = null; GetMethod get = null; - + String responseData = null; @@ -202,12 +202,12 @@ public abstract class MobileBKUHandler { if (returnCode == HttpStatus.SC_MOVED_TEMPORARILY || returnCode == HttpStatus.SC_MOVED_PERMANENTLY) { - Header locationHeader = post.getResponseHeader("location"); //$NON-NLS-1$ + Header locationHeader = post.getResponseHeader("location"); // if (locationHeader != null) { redirectLocation = locationHeader.getValue(); } else { throw new IOException( - "Got HTTP 302 but no location to follow!"); //$NON-NLS-1$ + "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 = "]*http-equiv=\"refresh\" [^>]*content=\"([^\"]*)\""; //$NON-NLS-1$ + String p = "]*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="); //$NON-NLS-1$ + 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); //$NON-NLS-1$ + 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); //$NON-NLS-1$ + 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()); //$NON-NLS-1$ + 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"); //$NON-NLS-1$ + Header locationHeader = get.getResponseHeader("location"); // if (locationHeader != null) { redirectLocation = locationHeader.getValue(); } else { throw new IOException( - "Got HTTP 302 but no location to follow!"); //$NON-NLS-1$ + "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 = "]*http-equiv=\"refresh\" [^>]*content=\"([^\"]*)\""; //$NON-NLS-1$ + String p = "]*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="); //$NON-NLS-1$ + 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); //$NON-NLS-1$ + log.debug("Redirected to " + redirectLocation); // get2 = new GetMethod(redirectLocation); get2.setFollowRedirects(true); returnCode = client.executeMethod(get2); @@ -335,11 +335,11 @@ public abstract class MobileBKUHandler { getStatus().server = server; if (server != null) - log.info("Server: " + server); //$NON-NLS-1$ + log.info("Server: " + server); // return responseData; } - + /** * @param 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 9466fecb..6b9f0584 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 @@ -36,7 +36,7 @@ import at.asit.pdfover.gui.exceptions.PasswordTooLongException; import at.asit.pdfover.gui.exceptions.PasswordTooShortException; /** - * + * */ public class MobileBKUHelper { /** @@ -48,15 +48,15 @@ public class MobileBKUHelper { /** * Regular expression for mobile phone numbers: this allows the entry of * mobile numbers in the following formats: - * + * * +(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]+)$"; //$NON-NLS-1$ + 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 - * + * * @param data * the whole data string * @param start @@ -76,16 +76,16 @@ public class MobileBKUHelper { if (endidx > startidx) { return data.substring(startidx, endidx); } - log.error("extracting substring: end not valid!: " + start + " ... " + end); //$NON-NLS-1$//$NON-NLS-2$ - throw new Exception("End string not available! Mobile BKU site changed?"); //$NON-NLS-1$ + log.error("extracting substring: end not valid!: " + start + " ... " + end); //// + throw new Exception("End string not available! Mobile BKU site changed?"); // } - log.error("extracting substring: start not valid!: " + start + " ... " + end); //$NON-NLS-1$//$NON-NLS-2$ - throw new Exception("Start string not available! Mobile BKU site changed?"); //$NON-NLS-1$ + log.error("extracting substring: start not valid!: " + start + " ... " + end); //// + throw new Exception("Start string not available! Mobile BKU site changed?"); // } /** * Extracts an XML tag from data with the given param="value" - * + * * @param data * the whole data string * @param tag @@ -101,25 +101,25 @@ public class MobileBKUHelper { public static String extractTagWithParam(String data, String tag, String param, String value) throws Exception { String start = '<' + tag; - int startidx, endidx = 0; + int startidx, endidx = 0; while ((startidx = data.indexOf(start, endidx)) != -1) { endidx = data.indexOf('>', startidx); if (endidx == -1) { - log.error("extracting tag: unterminated tag! " + tag + " (" + param + "=" + value + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - throw new Exception("Tag not found! Mobile BKU site changed?"); //$NON-NLS-1$ + 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 + "'") || //$NON-NLS-1$ //$NON-NLS-2$ - found.contains(param + "=\"" + value + "\"")) //$NON-NLS-1$ //$NON-NLS-2$ + if (found.contains(param + "='" + value + "'") || // // + found.contains(param + "=\"" + value + "\"")) // // return found; } - log.info("extracting tag: not found!: " + tag + " (" + param + "='" + value + "')"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - throw new Exception("Tag not found! Mobile BKU site changed?"); //$NON-NLS-1$ + log.info("extracting tag: not found!: " + tag + " (" + param + "='" + value + "')"); //// // // + throw new Exception("Tag not found! Mobile BKU site changed?"); // } /** * Extracts a parameter value from an XML tag from data with the given param="value" - * + * * @param data * the whole data string * @param tag @@ -139,25 +139,25 @@ 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); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - throw new Exception("Tag not found! Mobile BKU site changed?"); //$NON-NLS-1$ + 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); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - throw new Exception("Tag not found! Mobile BKU site changed?"); //$NON-NLS-1$ + 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); } - + /** - * This method is the same as the non optional method but instead of throwing the exception it returns null - * @return the string or null + * This method is the same as the non optional method but instead of throwing the exception it returns null + * @return the string or null */ public static String extractValueFromTagWithParamOptional(String data, String tag, String param, String value, String returnparam) { - String str; + String str; try { str = extractValueFromTagWithParam(data, tag, param, value, returnparam); } catch (Exception e) { @@ -165,12 +165,12 @@ public class MobileBKUHelper { str = null; } return str; - + } /** * Extracts the content from an XML tag from data with the given param="value" - * + * * @param data * the whole data string * @param tag @@ -187,17 +187,17 @@ 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("", startidx); //$NON-NLS-1$ //$NON-NLS-2$ + int endidx = data.indexOf("", startidx); // // if (endidx == -1) { - log.error("extracting tag: closing tag not found! " + tag + " (" + param + "=" + value + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - throw new Exception("Tag not found! Mobile BKU site changed?"); //$NON-NLS-1$ + 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); } /** * Validates the Mobile phone number - * + * * @param number * @return the normalized Phone number */ @@ -220,15 +220,15 @@ public class MobileBKUHelper { String normalNumber = matcher.group(6); - if (countryCode.equals("10301")) { //$NON-NLS-1$ + if (countryCode.equals("10301")) { // // A-Trust Testnumber! Don't change return number; } - countryCode = countryCode.replace("00", "+"); //$NON-NLS-1$ //$NON-NLS-2$ + countryCode = countryCode.replace("00", "+"); // // - if (countryCode.equals("0")) { //$NON-NLS-1$ - countryCode = "+43"; //$NON-NLS-1$ + if (countryCode.equals("0")) { // + countryCode = "+43"; // } return countryCode + normalNumber; @@ -236,7 +236,7 @@ public class MobileBKUHelper { /** * Validate given Password for Mobile BKU - * + * * @param password * @throws InvalidPasswordException */ @@ -252,7 +252,7 @@ public class MobileBKUHelper { /** * Removes file extension from URL - * + * * @param url * the url string * @return the stripped url @@ -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:")) //$NON-NLS-1$ //$NON-NLS-2$ + if (fragment.startsWith("http:") || fragment.startsWith("https:")) // // return fragment; int p = base.getPort(); - String port = ((p != -1) && (p != base.getDefaultPort())) ? ":" + p : ""; //$NON-NLS-1$ //$NON-NLS-2$ - if (fragment.startsWith("/")) { //$NON-NLS-1$ - return base.getProtocol() + "://" + base.getHost() + port + fragment; //$NON-NLS-1$ + String port = ((p != -1) && (p != base.getDefaultPort())) ? ":" + p : ""; // // + if (fragment.startsWith("/")) { // + return base.getProtocol() + "://" + base.getHost() + port + fragment; // } - return stripQueryString(base.toString()) + "/" + fragment; //$NON-NLS-1$ + return stripQueryString(base.toString()) + "/" + fragment; // } /** @@ -287,8 +287,8 @@ public class MobileBKUHelper { */ @SuppressWarnings("deprecation") public static void registerTrustedSocketFactory() { - Protocol.registerProtocol("https", //$NON-NLS-1$ - new Protocol("https", new TrustedSocketFactory(), 443)); //$NON-NLS-1$ + Protocol.registerProtocol("https", // + new Protocol("https", new TrustedSocketFactory(), 443)); // } /** @@ -299,21 +299,21 @@ public class MobileBKUHelper { public static HttpClient getHttpClient(MobileBKUStatus status) { return BKUHelper.getHttpClient(true); } - + /*** - * - * @param htmlString describes the html data in String representation - * @param attributeName is the attribute which should be selected + * + * @param htmlString describes the html data in String representation + * @param attributeName is the attribute which should be selected * @return returns the attribute name or null otherswise */ public static String getDynamicNameAttribute(String htmlString, String attributeName) { - + Document doc = Jsoup.parse(htmlString); Elements inputs = doc.select("div input#" + attributeName); - - if (inputs.size() == 0 ) return null; - - String name = inputs.get(0).attr("name"); - return name; + + if (inputs.size() == 0 ) return null; + + String name = inputs.get(0).attr("name"); + return name; } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUStatus.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUStatus.java index 7db04b68..d5058e43 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUStatus.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUStatus.java @@ -18,7 +18,7 @@ package at.asit.pdfover.gui.bku.mobile; import org.apache.commons.httpclient.Cookie; /** - * + * */ public abstract class MobileBKUStatus { public String sessionID; 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 e715184a..08385456 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 @@ -35,7 +35,7 @@ import org.w3c.dom.NodeList; import at.asit.pdfover.commons.Constants; /** - * + * */ public class SimpleXMLTrustManager implements X509TrustManager { /** @@ -58,13 +58,13 @@ public class SimpleXMLTrustManager implements X509TrustManager { /** * Constructs the TrustManager - * + * * @throws Exception */ public SimpleXMLTrustManager() throws Exception { // create a "default" JSSE X509TrustManager. - TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); //$NON-NLS-1$ + 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")) { //$NON-NLS-1$ - throw new Exception("Used certificates xml is invalid! no certificates node"); //$NON-NLS-1$ + 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")) { //$NON-NLS-1$ + if (certificateNode.getNodeName().equals("#text")) { // continue; // Ignore dummy text node .. } - if (!certificateNode.getNodeName().equals("certificate")) { //$NON-NLS-1$ - log.warn("Ignoring XML node: " + certificateNode.getNodeName()); //$NON-NLS-1$ + 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"). //$NON-NLS-1$ + X509Certificate cert = (X509Certificate) CertificateFactory.getInstance("X509"). // generateCertificate(this.getClass().getResourceAsStream(certResource)); myKeyStore.setCertificateEntry(certificateNode.getTextContent(), cert); - log.debug("Loaded certificate : " + certResource); //$NON-NLS-1$ + log.debug("Loaded certificate : " + certResource); // } catch (Exception ex) { - log.error("Failed to load certificate [" + "]", ex); //$NON-NLS-1$ //$NON-NLS-2$ + log.error("Failed to load certificate [" + "]", ex); // // } } @@ -156,12 +156,12 @@ 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"); //$NON-NLS-1$ + throw new Exception("Couldn't initialize ASITTrustManager"); // } /* * (non-Javadoc) - * + * * @see * javax.net.ssl.X509TrustManager#checkClientTrusted(java.security.cert. * X509Certificate[], java.lang.String) @@ -174,7 +174,7 @@ public class SimpleXMLTrustManager implements X509TrustManager { try { this.sunJSSEX509TrustManager.checkClientTrusted(arg0, arg1); } catch (CertificateException ex2) { - log.info("checkClientTrusted: ", ex2); //$NON-NLS-1$ + log.info("checkClientTrusted: ", ex2); // throw ex2; } } @@ -182,7 +182,7 @@ public class SimpleXMLTrustManager implements X509TrustManager { /* * (non-Javadoc) - * + * * @see * javax.net.ssl.X509TrustManager#checkServerTrusted(java.security.cert. * X509Certificate[], java.lang.String) @@ -195,7 +195,7 @@ public class SimpleXMLTrustManager implements X509TrustManager { try { this.sunJSSEX509TrustManager.checkServerTrusted(arg0, arg1); } catch (CertificateException ex2) { - log.info("checkServerTrusted: ", ex2); //$NON-NLS-1$ + log.info("checkServerTrusted: ", ex2); // throw ex2; } } @@ -203,7 +203,7 @@ public class SimpleXMLTrustManager implements X509TrustManager { /* * (non-Javadoc) - * + * * @see javax.net.ssl.X509TrustManager#getAcceptedIssuers() */ @Override 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 7b465b25..ff9b48a0 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 @@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.commons.Messages; /** - * + * */ public class TrustedSocketFactory implements SecureProtocolSocketFactory { /** @@ -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", //$NON-NLS-1$ - "SSL_RSA_WITH_RC4_128_SHA", //$NON-NLS-1$ - "SSL_RSA_WITH_3DES_EDE_CBC_SHA", //$NON-NLS-1$ - "SSL_RSA_WITH_RC4_128_MD5" //$NON-NLS-1$ + "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"); //$NON-NLS-1$ + SSLContext sslContext = SSLContext.getInstance("TLS"); // sslContext.init(null, new TrustManager[] { new SimpleXMLTrustManager() }, new java.security.SecureRandom()); @@ -66,7 +66,7 @@ public class TrustedSocketFactory implements SecureProtocolSocketFactory { /* * (non-Javadoc) - * + * * @see * org.apache.commons.httpclient.protocol.ProtocolSocketFactory#createSocket * (java.lang.String, int) @@ -80,21 +80,21 @@ public class TrustedSocketFactory implements SecureProtocolSocketFactory { sslSocket.setEnabledCipherSuites(ENABLED_CS); return sslSocket; } catch (Exception ex) { - log.error("TrustedSocketFactory: ", ex); //$NON-NLS-1$ + 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); //$NON-NLS-1$ + Messages.getString("TrustedSocketFactory.FailedToCreateSecureConnection"), ex); // } } } /* * (non-Javadoc) - * + * * @see * org.apache.commons.httpclient.protocol.ProtocolSocketFactory#createSocket * (java.lang.String, int, java.net.InetAddress, int) @@ -108,21 +108,21 @@ public class TrustedSocketFactory implements SecureProtocolSocketFactory { sslSocket.setEnabledCipherSuites(ENABLED_CS); return sslSocket; } catch (Exception ex) { - log.error("TrustedSocketFactory: ", ex); //$NON-NLS-1$ + 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); //$NON-NLS-1$ + Messages.getString("TrustedSocketFactory.FailedToCreateSecureConnection"), ex); // } } } /* * (non-Javadoc) - * + * * @see * org.apache.commons.httpclient.protocol.ProtocolSocketFactory#createSocket * (java.lang.String, int, java.net.InetAddress, int, @@ -134,7 +134,7 @@ public class TrustedSocketFactory implements SecureProtocolSocketFactory { UnknownHostException, ConnectTimeoutException { try { if (params == null) { - throw new IllegalArgumentException("Parameters may not be null"); //$NON-NLS-1$ + 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); //$NON-NLS-1$ + 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); //$NON-NLS-1$ + 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); //$NON-NLS-1$ + 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); //$NON-NLS-1$ + Messages.getString("TrustedSocketFactory.FailedToCreateSecureConnection"), ex); // } } } -- cgit v1.2.3