简体   繁体   English

JDBC,Tomcat,context.xml和Oracle本机加密

[英]JDBC, Tomcat, context.xml and Oracle native encryption

I can add specific connection properties (for connection pooling, etc.) with JDBC/thin connections from Java to Oracle by using 我可以使用以下方法从Java到Oracle添加具有JDBC /瘦连接的特定连接属性(用于连接池等)

props.put("connectionPoolName", "ConnPool");
props.put("description", "UCP JNDI Connection Pool");
props.put("factory", "oracle.ucp.jdbc.PoolDataSourceImpl");
props.put("inactiveConnectionTimeout", "5");
props.put("user", "scott");
[...]

I can also use a context.xml for these settings, like: 我还可以将context.xml用于这些设置,例如:

description="UCP JNDI Connection Pool" 
connectionFactoryClassName="oracle.jdbc.pool.OracleDataSource" 
factory="oracle.ucp.jdbc.PoolDataSourceImpl" 
inactiveConnectionTimeout="5"
user="scott"

So I tried setting Oracle 12 native encryption parameters in context.xml in countless ways, for example: 因此,我尝试以无数种方式在context.xml中设置Oracle 12本机加密参数,例如:

connectionProperties="oracle.net.encryption_client=(REQUIRED);oracle.net.encryption_types_client=(AES256);oracle.net.crypto_checksum_client=(REQUIRED);oracle.net.crypto_checksum_types_client=(SHA1)"

or 要么

connectionProperties="oracle.net.encryption_client=REQUIRED"
connectionProperties="oracle.net.encryption_types_client=AES256"
connectionProperties="oracle.net.crypto_checksum_client=REQUIRED"
connectionProperties="oracle.net.crypto_checksum_types_client=SHA1"
(Which obviously doesn't work)

or 要么

SQLNET.ENCRYPTION_CLIENT="REQUIRED"
SQLNET.CRYPTO_CHECKSUM_CLIENT="REQUIRED"
SQLNET.ENCRYPTION_TYPES_CLIENT="AES256"
etc.

...and nothing works. ...没有任何效果。 Does anybody know if you can set the client encryption parameters in context.xml? 有人知道您是否可以在context.xml中设置客户端加密参数吗? And if yes: how to do so? 如果是,该怎么做?

The server is configured correctly and the encryption works when using option 1 or sqlplus client, but nothing gets encrypted by using context.xml, but also no errors are logged or anything, it just transfers unencrypted data. 使用选项1或sqlplus客户端时,服务器配置正确且加密有效,但是使用context.xml不会加密任何内容, 不会记录任何错误或其他任何内容,它只是传输未加密的数据。

I assume I miss something trivial, or just don't know the correct parameters for context.xml. 我假设我错过了一些琐碎的事情,或者只是不知道context.xml的正确参数。

Try using the , as the separator as shown here. 尝试使用,作为分隔符,如下所示。 Check OracleConnection for the correct name of the connection property. 检查OracleConnection以获取连接属性的正确名称。

 connectionProperties="{javax.net.ssl.trustStore=/home/myuser/cloud/truststore.jks, 
   javax.net.ssl.trustStoreType=JKS, javax.net.ssl.trustStorePassword=welcome1, 
   javax.net.ssl.keyStore=/home/myuser/cloud/keystore.jks, javax.net.ssl.keyStoreType=JKS, 
   javax.net.ssl.keyStorePassword=welcome1, 
   oracle.net.ssl_version=1.2, oracle.net.ssl_server_dn_match=true}" 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM