Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8359073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:01:28+00:00 2026-06-09T11:01:28+00:00

I have a tomcat-hibernate-hsqldb setup and I want to use SSL to secure data

  • 0

I have a tomcat-hibernate-hsqldb setup and I want to use SSL to secure data transfer between my application and hsqldb. However, I need to pre install a certificate which can be used at any deployment. I do not want to use a new certificate for each new deployment site. For this, if I just use a self-signed certificate issues to any random Common Name and then install the same certificate in the trust store of tomcat, then I get this exception

 java.net.UnknownHostException: Certificate Common Name[random name] does not match host name[192.168.100.10] 

I need to disable hostname verification in this setup, but all the info I found on web points to the mechanism of disabling it for HttpsURLConnection.
I believe hsqldb has a custom code to do it, in the file

org.hsqldb.serverHsqlSocketFactorySecure

Here is the method, which does this:

protected void verify(String host, SSLSession session) throws Exception {

    X509Certificate[] chain;
    X509Certificate   certificate;
    Principal         principal;
    PublicKey         publicKey;
    String            DN;
    String            CN;
    int               start;
    int               end;
    String            emsg;

    chain       = session.getPeerCertificateChain();
    certificate = chain[0];
    principal   = certificate.getSubjectDN();
    DN          = String.valueOf(principal);
    start       = DN.indexOf("CN=");

    if (start < 0) {
        throw new UnknownHostException(
            Error.getMessage(ErrorCode.M_SERVER_SECURE_VERIFY_1));
    }

    start += 3;
    end   = DN.indexOf(',', start);
    CN    = DN.substring(start, (end > -1) ? end
                                           : DN.length());

    if (CN.length() < 1) {
        throw new UnknownHostException(
            Error.getMessage(ErrorCode.M_SERVER_SECURE_VERIFY_2));
    }

    if (!CN.equalsIgnoreCase(host)) {

        // TLS_HOSTNAME_MISMATCH
        throw new UnknownHostException(
            Error.getMessage(
                ErrorCode.M_SERVER_SECURE_VERIFY_3, 0,
                new Object[] {
            CN, host
        }));
    }
}

Is there a way to somehow bypass this mechanism and disable hostname validation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:01:30+00:00Added an answer on June 9, 2026 at 11:01 am

    Asked the same question on hsqldb forums and got to know that there is no workaround to this. The only thing you could do is to comment out the code which is calling the verify method and then rebuild the jar. I am still puzzled why hsqldb didn’t use the HostnameVerifier (http://docs.oracle.com/javase/6/docs/api/javax/net/ssl/HostnameVerifier.html), which would have made it easier to write a custom Hostname Verifier.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an JPA/Hibernate/Spring/Tomcat web application with second level data cache enabled for performance
I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate
I have a multi module maven web application, which uses hibernate. I use the
I have an Apache Tomcat + Hibernate based application. I have a class MyModel
I have a setup with JPA (hibernate + postgresql) and MongoDB: <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-mongodb</artifactId>
We have a j2ee/spring/hibernate/tomcat web application already running on production. We are planning to
I have a web-application in java, spring framework, hibernate on tomcat, that has basically
I have an application using Tomcat/Spring 3/JPA/Hibernate but my merges do not commit to
I have a Maven-built web application that uses Hibernate. It runs successfully in Tomcat,
I have a Spring/Hibernate web application (currently working fine on Tomcat) that I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.