diff options
Diffstat (limited to 'pdf-over-gui/src')
13 files changed, 35 insertions, 103 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java index d29e99e4..92f816da 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java @@ -342,7 +342,7 @@ public class Constants { public static final String RES_CERT_LIST = RES_CERT_PATH + "certificates.xml"; //$NON-NLS-1$ /** Accepted certificate list config */ - public static final String RES_CERT_PATH_ADDED = CONFIG_DIRECTORY + "/certificates/tobeadded/"; //$NON-NLS-1$ + public static final String RES_CERT_PATH_ADDED = CONFIG_DIRECTORY + "/certificates/"; //$NON-NLS-1$ /** Accepted certificate list resource */ public static final String RES_CERT_LIST_ADDED = RES_CERT_PATH_ADDED + "certificates.xml"; //$NON-NLS-1$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java index 06150aa2..f19809a9 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java @@ -80,12 +80,6 @@ public class Main { File configDir = new File(Constants.CONFIG_DIRECTORY); if (!configDir.exists()) { - try { - FileOutputStream fis = new FileOutputStream(new File(Constants.RES_CERT_LIST_ADDED)); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } configDir.mkdir(); } @@ -102,8 +96,7 @@ public class Main { log.debug("Starting stateMachine ..."); //$NON-NLS-1$ stateMachine.start(); - //Download Certificates// - CertificateDownloadSource.getAcceptedCertificates(); + log.debug("Ended stateMachine ..."); //$NON-NLS-1$ 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 0725a431..5e65f81e 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 @@ -351,6 +351,8 @@ public class ATrustHandler extends MobileBKUHandler { * @return the QR code image as a String */ public InputStream getQRCode() { + //TODO: Update HTTPClient here + ATrustStatus status = getStatus(); MobileBKUHelper.registerTrustedSocketFactory(); 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 ec4b674b..ee2448f5 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 @@ -23,8 +23,6 @@ import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.Arrays; -import java.util.List; - import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; @@ -129,7 +127,7 @@ public class SimpleXMLTrustManager implements X509TrustManager { continue; } - String certResource = Constants.RES_CERT_PATH_ADDED + certificateNode.getTextContent(); + String certResource = Constants.RES_CERT_PATH+ certificateNode.getTextContent(); X509Certificate cert = (X509Certificate) CertificateFactory .getInstance("X509"). //$NON-NLS-1$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java index 34626f82..e2a1e0a1 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java @@ -999,8 +999,8 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.configurationContainer.setDefaultSignaturePosition( provider.getDefaultSignaturePositionPersistent()); this.configurationContainer.setUseMarker(provider.getUseMarker()); - this.configurationContainer.setDownloadURL( - provider.getDownloadURL()); + /*this.configurationContainer.setDownloadURL( + provider.getDownloadURL());*/ this.configurationContainer.setSignaturePdfACompat( provider.getSignaturePdfACompat()); this.configurationContainer.setPlaceholderTransparency( diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java index ecd31472..f05d0034 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/CertificateDownloadSource.java @@ -8,7 +8,9 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; +import java.io.InputStream; import java.net.URL; +import java.net.URLConnection; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; @@ -54,23 +56,12 @@ public class CertificateDownloadSource { public static void getAcceptedCertificates() { try { - - ConfigProviderImpl cpi = new ConfigProviderImpl(); - - String url= cpi.getDownloadURL(); - if (url.equals(null) || url.equals("")) //$NON-NLS-1$ - { - url = Constants.CERTIFICATE_DOWNLOAD_XML_URL+Constants.CERTIFICATE_XML_FILE; - - } - else - { - url+=Constants.CERTIFICATE_XML_FILE; - } + + URL url = new URL(Constants.CERTIFICATE_DOWNLOAD_XML_URL+Constants.CERTIFICATE_XML_FILE); + URLConnection connection = url.openConnection(); + InputStream is = connection.getInputStream(); log.info("===== Starting to download accepted certificate ====="); - - - BufferedInputStream bis = new BufferedInputStream(new URL(url).openStream()); + BufferedInputStream bis = new BufferedInputStream(is); FileOutputStream fis2 = new FileOutputStream(new File(Constants.RES_CERT_LIST_ADDED)); byte[] buffer = new byte[1024]; int count = 0; @@ -84,11 +75,7 @@ public class CertificateDownloadSource { } catch (IOException e) { File f = new File(Constants.RES_CERT_LIST_ADDED); e.printStackTrace();} - - - - - // downloadCertificatesFromServer(); + } @@ -129,11 +116,13 @@ public class CertificateDownloadSource { } ConfigProviderImpl cpi = new ConfigProviderImpl(); - - String certResource = cpi.getDownloadURL().toString() + certificateNode.getTextContent(); - - //String certResource = Constants.CERTIFICATE_DOWNLOAD_XML_URL + certificateNode.getTextContent(); - BufferedInputStream bis = new BufferedInputStream(new URL(certResource).openStream()); + + String certResource = Constants.CERTIFICATE_DOWNLOAD_XML_URL + certificateNode.getTextContent(); + log.info("===== Starting to download accepted certificates ====="); + URL url = new URL(certResource); + URLConnection connection = url.openConnection(); + InputStream is = connection.getInputStream(); + BufferedInputStream bis = new BufferedInputStream(is); FileOutputStream fis = new FileOutputStream(new File(Constants.RES_CERT_PATH_ADDED+certificateNode.getTextContent())); byte[] buffer = new byte[1024]; int count=0; @@ -146,7 +135,7 @@ public class CertificateDownloadSource { } catch (Exception ex) { - log.error("Failed to load certificate [" + "]", ex); //$NON-NLS-1$ //$NON-NLS-2$ + log.debug(ex.toString()); //$NON-NLS-1$ } } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java index 14de050f..c20cc8e2 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java @@ -180,11 +180,6 @@ public interface ConfigManipulator { */ public void setUseMarker(boolean useMarker); - /** - * @param downloadURL - * @param Sets the DownloadURL for Certificates - */ - public void setDefaultDownloadURL(String downloadURL); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java index a5180593..7d66a286 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java @@ -248,19 +248,6 @@ public interface ConfigProvider { public boolean getSkipFinish(); /** - * @param downloadURL - * @param Sets the DownloadURL for Certificates - */ - public void setDownloadURL(String downloadURL); - - /** - * @return downloadURL for accepted Certificates - */ - public String getDownloadURL(); - - - - /** * Gets whether to use signature markers. * * @return whether to use a signature maker diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java index 8242cd03..c7e77ee3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java @@ -114,8 +114,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, .getProperty(Constants.CFG_OUTPUT_FOLDER)); // Set Default Certificate Download URL - setDefaultDownloadURL(config - .getProperty(Constants.CFG_DOWNLOAD_URL)); + // .getProperty(Constants.CFG_DOWNLOAD_URL)); String localeString = config.getProperty(Constants.CFG_LOCALE); @@ -146,12 +145,12 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, this.configuration.setMobileBKUURL(bkuUrl); } - String downloadURL = config + /*String downloadURL = config .getProperty(Constants.CFG_DOWNLOAD_URL); if (downloadURL != null && !downloadURL.isEmpty()) { this.configuration.setDownloadURL(downloadURL); - } + }*/ String bkuType = config @@ -343,7 +342,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, props.setProperty(Constants.CFG_PROXY_PASS, proxyPass); props.setProperty(Constants.CFG_EMBLEM, getDefaultEmblemPersistent()); - props.setProperty(Constants.CFG_DOWNLOAD_URL, getDownloadURL()); props.setProperty(Constants.CFG_SIGNATURE_NOTE, getSignatureNote()); props.setProperty(Constants.CFG_MOBILE_NUMBER, getDefaultMobileNumberPersistent()); props.setProperty(Constants.CFG_OUTPUT_FOLDER, getDefaultOutputFolderPersistent()); @@ -751,23 +749,10 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return emblem; } - @Override + /*@Override public String getDownloadURL() { - String downloadURL=""; - try - { - downloadURL = this.configuration.getDownloadURL(); - if (downloadURL.isEmpty()||downloadURL == null) - {downloadURL = Constants.CERTIFICATE_DOWNLOAD_XML_URL; - } - return downloadURL; - } catch (NullPointerException npe){ - String message = npe.getMessage(); - downloadURL = Constants.CERTIFICATE_DOWNLOAD_XML_URL; - - } - return downloadURL; - } + return Constants.CERTIFICATE_DOWNLOAD_XML_URL; + }*/ /** * Sets the proxy host @@ -985,14 +970,14 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } - @Override + /*@Override public void setDefaultDownloadURL(String downloadURL) { if (downloadURL == null || downloadURL.trim().isEmpty()) { this.configuration.setDownloadURL(Constants.CERTIFICATE_DOWNLOAD_XML_URL+Constants.CERTIFICATE_XML_FILE); } else { this.configuration.setDownloadURL(downloadURL); } - }/* + } /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.ConfigOverlayManipulator#setDefaultOutputFolderOverlay(java.lang.String) @@ -1466,14 +1451,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, this.configurationOverlay.setSkipFinish(skipFinish); } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setDownloadURL(java.lang.String) - */ - @Override - public void setDownloadURL(String downloadURL) { - this.configuration.setDownloadURL(downloadURL); - - } /* * (non-Javadoc) * @@ -1494,4 +1471,5 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, public void setUseMarker(boolean useMarker) { this.configurationOverlay.setUseMarker(useMarker); } + } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java index 807ee1a6..c3142b85 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java @@ -373,11 +373,7 @@ public interface ConfigurationContainer { */ public String getDownloadURL(); - /** - * Sets the Certificate-Download URL - * @param downloadURL - */ - public void setDownloadURL(String downloadURL); + /** * Gets whether to use an existing signature marker. diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java index a06dbc0b..cc794246 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java @@ -647,13 +647,13 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setDownloadURL(java.lang.String) - */ + @Override public void setDownloadURL(String downloadURL) { this.downloadURL = downloadURL; - } + }*/ /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getDownloadURL() diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java index 78d196fc..ce35d965 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java @@ -182,12 +182,6 @@ public interface PersistentConfigProvider { public Point getMainWindowSize(); /** - * Gets the configured Download URL for certificates - * @return the configured download URL - */ - public String getDownloadURL(); - - /** * Gets whether to use an existing singature marker. * * @return whether to use an existing singature marker diff --git a/pdf-over-gui/src/main/resources/cfg/PDFASConfig.zip b/pdf-over-gui/src/main/resources/cfg/PDFASConfig.zip Binary files differindex e9cbba19..19ab9219 100644 --- a/pdf-over-gui/src/main/resources/cfg/PDFASConfig.zip +++ b/pdf-over-gui/src/main/resources/cfg/PDFASConfig.zip |