At paysafecard we have a lot to deal with certificates. For our test systems we use one SSL certificate for different sub-domains, e.g. one certificate for “https://test.yunacard.com” used for “https://testa.yunacard.com” and “https://testb.yunacard.com”.
But when you do this, you get a javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching xxx found when trying to connect e.g. with new java.net.URL(url).openStream();
The work around for this problem is, to include the following in your Java class (found here):
public class ClassBla { static { javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() { public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) { return true; } }); } .. }
There is a way to import a certificate issued to a different domain for another certain (sub-)domain with the java keytool as well.