diff options
author | Ingo Bauersachs <ingo@jitsi.org> | 2011-09-24 12:52:45 +0000 |
---|---|---|
committer | Ingo Bauersachs <ingo@jitsi.org> | 2011-09-24 12:52:45 +0000 |
commit | 230e8e5a258687779945c4c8d94411728a997483 (patch) | |
tree | f255bd44e7deb6d0c5aad458827da1b04721f768 /src/net/java/sip/communicator/impl | |
parent | 8cc88ffc07a2210b1d6deee29fdb23319c97defc (diff) | |
download | jitsi-230e8e5a258687779945c4c8d94411728a997483.zip jitsi-230e8e5a258687779945c4c8d94411728a997483.tar.gz jitsi-230e8e5a258687779945c4c8d94411728a997483.tar.bz2 |
Remove option for Windows as CA source on x64 for JRE != 1.7, allow setting of trustStore system properties, fail XMPP connections when our TrustManager cannot be set
Diffstat (limited to 'src/net/java/sip/communicator/impl')
-rw-r--r-- | src/net/java/sip/communicator/impl/certificate/CertificateServiceImpl.java | 47 | ||||
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java | 1 |
2 files changed, 34 insertions, 14 deletions
diff --git a/src/net/java/sip/communicator/impl/certificate/CertificateServiceImpl.java b/src/net/java/sip/communicator/impl/certificate/CertificateServiceImpl.java index 1b9ea8e..d0547a3 100644 --- a/src/net/java/sip/communicator/impl/certificate/CertificateServiceImpl.java +++ b/src/net/java/sip/communicator/impl/certificate/CertificateServiceImpl.java @@ -121,7 +121,7 @@ public class CertificateServiceImpl public CertificateServiceImpl()
{
setTrustStore();
- config.addPropertyChangeListener(PNAME_TRUSTSTORE, this);
+ config.addPropertyChangeListener(PNAME_TRUSTSTORE_TYPE, this);
}
public void propertyChange(PropertyChangeEvent evt)
@@ -131,24 +131,43 @@ public class CertificateServiceImpl private void setTrustStore()
{
- String trustStore = (String)config.getProperty(PNAME_TRUSTSTORE);
- if(trustStore != null)
+ String tsType = (String)config.getProperty(PNAME_TRUSTSTORE_TYPE);
+ String tsFile = (String)config.getProperty(PNAME_TRUSTSTORE_FILE);
+ String tsPassword = credService.loadPassword(PNAME_TRUSTSTORE_PASSWORD);
+
+ //TODO remove this after stable release 4 (rev3593 is r1, 3651 is r2)
+ //migrate the misnamed truststore property
+ if(tsFile != null && tsFile.equals("Windows-ROOT"))
{
- System.setProperty("javax.net.ssl.trustStoreType",
- trustStore);
- String password =
- credService.loadPassword(PNAME_TRUSTSTORE_PASSWORD);
- if(password != null)
- {
- System.setProperty("javax.net.ssl.trustStorePassword",
- password);
- }
+ tsType = tsFile;
+ tsFile = null;
+ config.setProperty(PNAME_TRUSTSTORE_TYPE, tsType);
+ config.removeProperty(PNAME_TRUSTSTORE_FILE);
}
- else
+ //TODO remove this as soon as we ship with JRE 1.7
+ //remove windows root from x64 on Java < 1.7
+ if (!(OSUtils.IS_WINDOWS32
+ || (OSUtils.IS_WINDOWS
+ && System.getProperty("java.version").startsWith("1.7"))))
{
+ tsType = null;
+ config.removeProperty(CertificateService.PNAME_TRUSTSTORE_TYPE);
+ }
+
+ if(tsType != null)
+ System.setProperty("javax.net.ssl.trustStoreType", tsType);
+ else
System.getProperties().remove("javax.net.ssl.trustStoreType");
+
+ if(tsFile != null)
+ System.setProperty("javax.net.ssl.trustStore", tsFile);
+ else
+ System.getProperties().remove("javax.net.ssl.trustStore");
+
+ if(tsPassword != null)
+ System.setProperty("javax.net.ssl.trustStorePassword", tsPassword);
+ else
System.getProperties().remove("javax.net.ssl.trustStorePassword");
- }
}
// ------------------------------------------------------------------------
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java index 1acac1f..092cb02 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -900,6 +900,7 @@ public class ProtocolProviderServiceJabberImpl catch(GeneralSecurityException e) { logger.error("Error creating custom trust manager", e); + throw new XMPPException("Error creating custom trust manager", e); } if(debugger == null) |