Java 在 Oracle JDBC 客户端中指定密码哈希而不是清除密码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20071741/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 22:53:12  来源:igfitidea点击:

Specify password hash instead of clear password in Oracle JDBC client

javaoraclesecurityjdbc

提问by Cagin Uludamar

I'm using Oracle JDBC driver in my Java app to reach Oracle DB. Creating the connection using code:

我在 Java 应用程序中使用 Oracle JDBC 驱动程序访问 Oracle DB。使用代码创建连接:

DriverManager.getConnection(
"jdbc:oracle:thin:@myserver:port:mySID", 
"myuser", 
"mypassword");

requires the real password. Is there a way to specify the password hash instead such as:

需要真实密码。有没有办法指定密码哈希,例如:

DriverManager.getConnection(
"jdbc:oracle:thin:@myserver:port:mySID", 
"myuser", 
"mypasswordHash");

采纳答案by halfbit

According to Does the Oracle JDBC client encrypt password when you make a connection?there is no need to use a hash when connecting. If you just want nobody to be able to read the password in plain text then have a look at Encrypt Password in Configuration Files?.

根据建立连接时 Oracle JDBC 客户端是否加密密码?连接时不需要使用哈希。如果您只是希望没有人能够以纯文本形式读取密码,那么请查看配置文件中的加密密码?.

Oracles approach closest to obfuscation seems to be wallets with "auto login": For a Java example see http://sysapp.wordpress.com/2010/08/31/how-to-oracle-wallet-with-jdbc-thin-driver-datasource-tomcat/. But this seems to require specific Oracle Admin actions: see How to Create a Complete Wallet(maybe your DBA knows more about it). For other options to connect without a password in the clear see JDBC Client-Side Security Features.

最接近混淆的 Oracle 方法似乎是具有“自动登录”功能的钱包:有关 Java 示例,请参见http://sysapp.wordpress.com/2010/08/31/how-to-oracle-wallet-with-jdbc-thin-驱动程序数据源 tomcat/。但这似乎需要特定的 Oracle Admin 操作:请参阅如何创建完整的钱包(也许您的 DBA 对此了解更多)。有关无需密码即可连接的其他选项,请参阅JDBC Client-Side Security Features