Add CAS/LDAP certificate to Tomcat

Add CAS/LDAP certificate to Tomcat

When dealing with CAS or LDAP authentication in java web applications in most of the cases a SSL connection must be made from Tomcat (where the java web application is) to CAS or LDAP server. This requires a keystore with the public keys of the CAS/LDAP servers to be used from Tomcat.

This article explains how to achieve that.

  1. Acquire the public key (certificate) of the target server (LDAP or CAS)

    • If you don’t have the certificate you can extract it from the browser (the steps below are for Chrome browser):

        • Goto https://<server_address>

    • Click on the site information button. A popup containing a link to the certificate information would appear – click on the link. A new popup would appear with cert info.

    • Goto Details tab, and click on “Copy to File…” option

      • In the export wizard choose DER format, and save file as .cer

  2.  Create a keystore with the certificate

Using the keytool command (located in $JAVA_HOME/bin/):

/> keytool -import -file <cert_file>.cer -keystore <key_store>  -allias <alias>

You will be prompted for password. Use “changeit” as password, if you don’t want to configure another password in Tomcat (“changeit” is the default one tomcat would use).

<alias> is useful if you want to import several keys. You can omit it if you intend to add only one key to the store.

4. Add keystore to Tomcat

Tomcat needs to know about the keystore to actually use it. To tell tomcat where the keystore is use the system property:””

This property can be added in catalina.bat like this:


or in like this:


Nedyalko Nedyalkov

Hard working individual with clear vision about the future. Interested in business development, sales, software and much more. Part of different associations and non-governmental organisations.

More Posts - Website

Follow Me:
TwitterLinkedInGoogle Plus

Do you want more great blogs like this?

Subscribe for Dreamix Blog now!