diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:31:49 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:31:49 +0000 |
commit | 70d21ad57916010b3079f8bf332f0986c91c7539 (patch) | |
tree | d30a3a1d1985f8943498449303d1a68ce284baba /pdf-over-gui/src/main/java | |
parent | 5c775cec4b3e4d24c7ee3dd9ad862f8d169c8706 (diff) | |
download | pdf-over-70d21ad57916010b3079f8bf332f0986c91c7539.tar.gz pdf-over-70d21ad57916010b3079f8bf332f0986c91c7539.tar.bz2 pdf-over-70d21ad57916010b3079f8bf332f0986c91c7539.zip |
Remove unneeded certs, add mobile test certs
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@368 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/SimpleXMLTrustManager.java (renamed from pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ASITTrustManager.java) | 23 | ||||
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/TrustedSocketFactory.java | 2 |
2 files changed, 13 insertions, 12 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ASITTrustManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/SimpleXMLTrustManager.java index f4e6be70..d08dcfe5 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ASITTrustManager.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/SimpleXMLTrustManager.java @@ -36,12 +36,15 @@ import org.w3c.dom.NodeList; /** * */ -public class ASITTrustManager implements X509TrustManager { +public class SimpleXMLTrustManager implements X509TrustManager { /** * SLF4J Logger instance **/ private static final Logger log = LoggerFactory - .getLogger(ASITTrustManager.class); + .getLogger(SimpleXMLTrustManager.class); + + private static final String certificateList = "/certificates/certificates.xml"; //$NON-NLS-1$ + /* * The default X509TrustManager returned by SunX509. We'll delegate @@ -60,7 +63,7 @@ public class ASITTrustManager implements X509TrustManager { * * @throws Exception */ - public ASITTrustManager() throws Exception { + public SimpleXMLTrustManager() throws Exception { // create a "default" JSSE X509TrustManager. TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); //$NON-NLS-1$ @@ -83,16 +86,14 @@ public class ASITTrustManager implements X509TrustManager { * A-Trust Certificates */ - KeyStore atrustKeyStore = KeyStore.getInstance(KeyStore + KeyStore myKeyStore = KeyStore.getInstance(KeyStore .getDefaultType()); - atrustKeyStore.load(null); - - String usedCertificates = "/certificates/used_certificates.xml"; //$NON-NLS-1$ + myKeyStore.load(null); Document doc = DocumentBuilderFactory.newInstance() .newDocumentBuilder() - .parse(this.getClass().getResourceAsStream(usedCertificates)); + .parse(this.getClass().getResourceAsStream(certificateList)); Node certificates = doc.getFirstChild(); @@ -117,7 +118,7 @@ public class ASITTrustManager implements X509TrustManager { continue; } - String certResource = "/certificates/" + certificateNode.getTextContent() + ".crt"; //$NON-NLS-1$ //$NON-NLS-2$ + String certResource = "/certificates/" + certificateNode.getTextContent(); //$NON-NLS-1$ X509Certificate cert = (X509Certificate) CertificateFactory .getInstance("X509"). //$NON-NLS-1$ @@ -125,7 +126,7 @@ public class ASITTrustManager implements X509TrustManager { this.getClass().getResourceAsStream( certResource)); - atrustKeyStore.setCertificateEntry(certificateNode.getTextContent(), cert); + myKeyStore.setCertificateEntry(certificateNode.getTextContent(), cert); log.debug("Loaded certificate : " + certResource); //$NON-NLS-1$ @@ -134,7 +135,7 @@ public class ASITTrustManager implements X509TrustManager { } } - tmf.init(atrustKeyStore); + tmf.init(myKeyStore); tms = tmf.getTrustManagers(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/TrustedSocketFactory.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/TrustedSocketFactory.java index e3da8076..add31972 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/TrustedSocketFactory.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/TrustedSocketFactory.java @@ -51,7 +51,7 @@ public class TrustedSocketFactory implements ProtocolSocketFactory { private static SSLSocketFactory getFactory() throws NoSuchAlgorithmException, KeyManagementException, Exception { SSLContext sslContext = SSLContext.getInstance("TLS"); //$NON-NLS-1$ - sslContext.init(null, new TrustManager[] { new ASITTrustManager() }, + sslContext.init(null, new TrustManager[] { new SimpleXMLTrustManager() }, new java.security.SecureRandom()); return sslContext.getSocketFactory(); |