Like I’ve previously hinted, I’m coding support for Ericsson In-Game Communication.
It will mean that we will support proximity, p2p, team and lecture voice chat. We have to select the business model to use. I think it will be an interesting experiment to have instant voice chat and automatically hear the players close to you. Apparently the sound may vary with the environment but I don’t know how well it’s supported in Wurm.
I do the server side, and have no idea how it sounds yet. The guys at Ericsson has implemented it in the client though and says it works fine. They are finishing off the code now and hopefully we can launch it before I take some vacation.
Now, here comes some technical stuff for all you java and maybe c# developers. Hopefully it helps in case your application has to communicate using https with some other server.
Our server talks to their server using a REST interface over https. Their server has a self-signed certificate. Our server doesn’t trust that certificate because it can’t be verified in the trusted certificate chain, so our server refuses to communicate.
The normal solution would be to get hold of their certificate somehow and import it to the default keystore cacerts using keytool. My problem then is that I have to do that on all machines, and also not forget it on any future machines. I resent that. I want things to be automated. I am pretty scared of all things that has to do with certificates or SSL especially with java or in any sort of code. To me the whole signing/encryption certificate situation on the internet is a big disaster with lots of incompatibility, misguided paranoia and special cases. Or I am ignorant.
In any case, I found that people have figured out a way to add those self-signed certificates to the keystore automatically and programatically! Which means you can too!
The post that explained it to me is here.
Basically, take this class and change the main method to a normal method with standard arguments. Remove the code that tries to create a special keystore. Instead, make sure that the cacerts keystore is used using the password ‘changeit’ which is default. Remove the command line bufferedreader and add certs[0] to the keystore file.
Now, before making your https Url connection or the first time you connect to a new site, run the method. It will import the cert to the cacerts keystore.
But alas! Your connection may still fail because of
Caused by: javax.net.ssl.SSLHandshakeException:
java.security.cert.CertificateException: No name matching whatyou.connectto.com found
Where whatyou.connectto.com is the host you are trying to connect to. Their self-signed certificate doesn’t match the hostname I think.
However, that also can be solved. Here I found this solution:
static {
//for localhost testing only
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
new javax.net.ssl.HostnameVerifier(){
public boolean verify(String hostname,
javax.net.ssl.SSLSession sslSession) {
if (hostname.equals("whatyou.connectto.com")) {
return true;
}
return false;
}
});
}
Make sure to set it for only the connection you make to that host or all your other Https connections will fail. Good luck!