Server Certificate Authentication
When the SAP HANA client secures TLS connections with an SAP HANA server, the client verifies the server's certificate to ensure that it has connected to the correct server, thus preventing man-in-the-middle attacks.
To configure the SAP HANA client to authenticate the server certificate, perform the following steps:
-
Acquire the public certificate of the trusted root certificate authority.
The client needs access to the public certificate of the certificate authority (CA) that signed the server’s certificate. How this is done depends on how the server certificate was signed:
- Server certificate signed by a certificate authority
-
If the server’s certificate is signed by a certificate authority, the client needs to have the certificate authority’s public root certificate. This can be extracted from the server’s PSE file as follows:
sapgenpse export_own_cert -r -p sapsrv.pse -o server_root.crt
Alternately, if the certificate authority is a publicly recognized certificate authority, the public root certificate can be downloaded from their website.
If connecting to SAP HANA Cloud, you need to trust the “DigiCert Global Root CA” certificate authority, which can be downloaded from: https://www.digicert.com/digicert-root-certificates.htm

The “DigiCert Global Root CA” certificate authority can be found in both DER and PEM format: https://dl.cacerts.digicert.com/DigiCertGlobalRootCA.crt
(DER) and https://dl.cacerts.digicert.com/DigiCertGlobalRootCA.crt.pem
(PEM). - Self-signed server certificate
-
If the server’s certificate is self-signed, then the client needs to trust the server’s public certificate itself. This can be extracted from the server’s PSE file as follows:
sapgenpse export_own_cert -p sapsrv.pse -o server_root.crt
-
Provide the trusted root certificate to the client.
Once the trusted root certificate for the server has been obtained, it must be provided to the client driver so it can connect to SAP HANA. How it is provided depends on which Cryptographic API provider you are using:
- CommonCryptoLib
-
The trusted root certificate file needs to be converted to a PSE file to be used by the client when using the CommonCryptoLib provider:
sapgenpse gen_verify_pse -p sapcli.pse -a server_root.crt
Optionally, you can specify a PIN for the PSE file. To avoid using a PIN, click Enter twice. To set a PIN, enter the following command, which also creates a credential file to access the PSE file:sapgenpse seclogin -p ${SECUDIR} -x <PIN>This creates a ${SECUDIR}/cred_v2 file that stores the PIN to the PSE file, which the HANA client reads when connecting.By default, the driver expects the file name to be sapcli.pse and to be in the $SECUDIR directory. You can specify a PSE file with a different name or path with the sslKeyStore and sslTrustStore client configuration properties.
Set the connection property encrypt to TRUE to turn on TLS encryption or add the -e option if using SAP HANA HDBSQL.
The following on-premise example uses SAP HANA HDBSQL to connect through the Common Crypto Library provider to an SAP HANA server with server certificate authentication:
hdbsql -n myhost.com:30015 -u MyUser -p MyPassword123 -e
- OpenSSL (Linux, macOS, AIX)
-
The OpenSSL provider cannot use PSE files directly; it expects the public root certificate to be in PEM format.
To use the OpenSSL provider instead of the CommonCrypto provider, set the following client connection properties:
- Set the sslCryptoProvider client connection parameter to openssl so it uses the OpenSSL provider instead of the CommonCryptoLib provider.
- Set the sslTrustStore parameter to the file containing the server's root certificate authority that was created in Step 1 (server_root.crt in the example above), in PEM format.
- Set encrypt to TRUE to turn on encryption. For SAP HANA HDBSQL, adding the -e option is equivalent to setting encrypt to TRUE.
The following on-premise example uses SAP HANA HDBSQL to connect through the OpenSSL provider to an SAP HANA server with server certificate authentication:
hdbsql -n myhost.com:30015 -u MyUser -p MyPassword123 -e -Z sslCryptoProvider=openssl -Z sslTrustStore=server_root.crt.pem
The following example uses SAP HANA HDBSQL to connect to the SAP HANA Cloud with server certificate authentication:
hdbsql -n 12345678-abcd-12ab-34cd-1234abcd.hana.hanacloud.ondemand.com:443 -u MyUser -p MyPassword123 -e -Z sslCryptoProvider=openssl -Z sslTrustStore=DigiCertGlobalRootCA.crt.pem
- Microsoft CryptoAPI (Microsoft Windows only)
-
The sslTrustStore connection property selects the System Store Location to use (see: https://docs.microsoft.com/en-us/windows/win32/seccrypto/system-store-locations
). There are four options:- MY
- Root
- Trust
- CA
By default, the client uses the MY system store. To trust a new certificate authority, add the trusted certificate authority certificate via the Microsoft Management Console Certificates Snap-in (certmgr.msc) to the desired System Store Location.
- Java
-
The JDBC driver uses the TLS support that is included with the Java Development Kit (JDK). Use the Java keytool command to convert the server's root certificate to the Java keystore file format:
keytool -importcert -keystore server_root.jks -file server_root.crt -storepass mypassword
Set the following connection properties to connect to an SAP HANA server with server certificate authentication:
- Set trustStoreType to jks
- Set trustStore to the file containing the server’s root certificate authority (server_root.jks in the example above)
- Set trustStorePassword to the password used when creating the trust store (mypassword in the example above)
- Set encrypt to TRUE to turn on encryption
The following on-premise example uses JDBC to connect to an SAP HANA server with server certificate authentication:
java -jar ngdbc.jar -u MyUser,MyPassword123 -n myhost.com:30015 -o encrypt=true -o trustStoreType=jks -o trustStore=server_root.jks -o trustStorePassword=mypassword -c "SELECT * FROM MYTABLE"
Considerations
To connect with TLS without any server authentication, set the sslValidateCertificate client connection property (validateCertificate for JDBC) to FALSE. This is not recommended as it exposes the connection to attacks by third parties when connecting over public or unsecured networks.
Use the sslHostNameInCertificate client connection property (hostNameInCertificate for JDBC) if the name in the server’s certificate is not expected to match the hostname used by the client to connect to the server.
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('public_hostname_resolution', 'use_default_route') = 'fqdn' WITH RECONFIGURE;