I have a requirement to connect to Oracle Database from spring application with an encryption.

In Oracle server the Native network encryption is added in Sqlnet.ora file as below

SQLNET.ENCRYPTION_TYPES_SERVER = (AES256)
SQLNET.ENCRYPTION_SERVER = accepted
SQLNET.CRYPTO_CHECKSUM_TYPES_SERVER= (SHA1)
SQLNET.CRYPTO_CHECKSUM_SERVER = accepted

The DB config properties are set as below in application

spring.jpa.database=default
<>.oracle.schema=<schema name>
spring.datasource.initialize=true
spring.datasource.url=jdbc:oracle:thin:@<URL>:1521/<Schema name>
spring.datasource.driverClassName=oracle.jdbc.OracleDriver
spring.datasource.username=<username>
spring.datasource.password=<password>

Could you please help in configuring the Native network encryption properties in application to establish an encrypted connection to database

I have set the below properties in datasource file, still there is no encrypted connection is established

Properties props = new Properties();
props.put("oracle.net.encryption_client", "REQUIRED");
      props.put("oracle.net.encryption_types_client", "( AES256 )");
      props.put("oracle.net.crypto_checksum_client", "REQUIRED");
      props.put("oracle.net.crypto_checksum_types_client", "( SHA1 )");

0 Answers