有谁知道 JDeveloper/SQL Developer 使用什么加密技术来保存凭据?
我非常有兴趣了解这里使用哪种技术来保存敏感数据,因为我需要实现类似的解决方案。 以下是示例连接配置和生成的导出片段:
<?xml version = '1.0' encoding = 'UTF-8'?>
<References xmlns="http://xmlns.oracle.com/adf/jndi">
<Reference name="My Connection" className="oracle.jdeveloper.db.adapter.DatabaseProvider" xmlns="">
<Factory className="oracle.jdeveloper.db.adapter.DatabaseProviderFactory"/>
<RefAddresses>
<StringRefAddr addrType="user">
<Contents>username</Contents>
</StringRefAddr>
<StringRefAddr addrType="password">
<Contents>054D4844D8549C0DB78EE1A98FE4E085B8A484D20A81F7DCF8</Contents>
</StringRefAddr>
<SKIPPED />
</RefAddresses>
</Reference>
</References>
任何建议将非常感激。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
出于好奇,您实际上看到的是与加密密码连接的密钥。 例如,我尝试使用以下方法加密密码“SAILBOAT”:
在这个特定实例中,结果是:
第一个字节是常量:
接下来的 8 个字节表示随机生成的密钥(对于 DES 密码):
其余字节是加密密码:
因此,要解密密码,您只需使用以下命令:
For the curious, what you're actually seeing is the secret key concatenated with the encrypted password. For example, I tried encrypting the password "SAILBOAT" using:
In this particular instance, the result was:
The first byte is constant:
The next 8 bytes represent the randomly generated secret key (for the DES cipher):
The remaining bytes are the encrypted password:
Therefore, to decrypt the password, you simply use this:
请注意,上面蒂姆的密码哈希不适用于“apps_ro” - 大概是他从错误的位置剪切并粘贴的......我不会发布真实的密码,以防他不想共享它!
我遇到了类似的问题,尝试集中存储我的数据库凭据(对于非安全数据库!),然后导出 sql Developer xml 文件。 我不知道该算法是什么 - 但是,您实际上不需要知道该算法,因为您可以自己调用 Oracle java API。 如果您有 SQLDeveloper,只需获取正确的 Jar 文件:
然后将它们加载到您的 Java 应用程序中,或者像我一样使用 JRuby 之类的东西:
请注意,该算法,无论它是什么,都有一个随机因素,因此使用两次相同的密码可以产生两个不同的十六进制字符串。
Note that Tim's password hash above is not for "apps_ro" - presumably he cut and pasted from the wrong place... I won't post the real password in case it's something he doesn't want shared!
I had a similar problem, trying to store my db credentials centrally (for non-secure databases!) and then exporting sql developer xml files. I have no idea what the algorithm is - however, you don't really need to know the algorithm, as you can just call the Oracle java API yourself. If you have SQLDeveloper, just grab the right Jar files:
Then either load them in your Java app, or use something like JRuby as I do:
Note that the algorithm, whatever it is, has a random factor so the same password used twice can produce two different hex strings.
这个解决方案对我来说非常有用......
复制自:
http://www.mischiefblog.com/?p=912
This solution works great for me...
Copied from:
http://www.mischiefblog.com/?p=912
给定的解决方案太旧了,仅适用于 2.x 版本,但现在不行。 因为Oracle SQL Developer在3.x和4.x版本中改变了加密算法。
版本 3
密码以加密方式存储在以下位置的connections.xml 文件中:
版本4
密码以加密方式存储在上述connections.xml 文件中,但加密密钥使用机器-product-preferences.xml 文件中的唯一值 db.system.id 可在此处访问:
要解密最新的加密文件,您可以使用 显示密码 SQL Developer 扩展。 或者使用 SQL Developer 密码解密器 解密文件
Given solution is too old and only works with version 2.x but not now. because Oracle SQL Developer, changed the encryption algorithm in version 3.x and 4.x.
Version 3
Passwords are stored encrypted in the connections.xml file in those locations:
Version 4
Passwords are stored encrypted in the aforementioned connections.xml file but the encryption key uses a machine-unique value db.system.id in the product-preferences.xml file accessible here:
To decrypt latest encrypted file you can use Show me password extension for SQL Developer. Or decrypt file with SQL Developer password decryptor
与 kornelissietsma 给出的代码相同,但用 java 编写:
可以按如下方式执行:
The same code as kornelissietsma has given, but written on java:
Can be executed as following:
不幸的是,其他答案中描述的方法在 SQL Developer 4.x 中不起作用。 有一个适用于 3.x 和 4.x 版本的扩展,并且非常易于使用:
https://github.com/tomecode/show-me-password-sqldev-jdev
Methods described in other answers unfortunately doesn’t work in SQL Developer 4.x. There’s extension that works on both 3.x and 4.x versions and it’s very easy to use:
https://github.com/tomecode/show-me-password-sqldev-jdev
我对此不确定,但我一直认为哈希值无法解密,只能与另一个哈希值进行比较。 MD5 生成哈希值。 SQL Developer中保存的密码需要解密并发送给服务器。 因此 dbms_obfuscation_toolkit 包中的 DES3Encrypt 和 DES3Decrypt 过程是更好的选择。 但解密应该在连接到数据库之前调用,因此它可能是带有 DES 方法的 Java 加密包。
I'm not sure about this but I always thought hashes can't be decrypted, only compared to another hash. MD5 generates a hash. The saved password in SQL Developer needs to be decrypted and send to the server. So the DES3Encrypt and DES3Decrypt procedures in dbms_obfuscation_toolkit package are a better bet. But the decrypt should be called before connecting to a database, so it's probably a Java crypto package with DES methods.
如果有人感兴趣的话,这里有一个 python 片段。
这是上面 Adam Paynter 示例的翻译。
它使用 pyDes
Here's a python snippet if anyone is intersted.
It's a translation of Adam Paynter's example above.
It uses pyDes
我不知道,但如果它是 DBMS_OBFUSCATION_TOOLKIT 的使用如下:
I don't know, but I wouldn't be surprised if it was DBMS_OBFUSCATION_TOOLKIT being used something like this:
哈希值的长度为 50 个十六进制字符,即 200 位,因此它可能是带有盐的密码的哈希值,前面加上盐,例如
: 意思是串联。
不过只是猜测。 我的猜测是 40 位盐和 SHA-1 哈希值,因为 SHA-1 生成 160 位哈希值。
提供一些输入/输出测试数据来检查将很有帮助!
The length of the hash is 50 hex characters, which is 200 bits, so it may be the the hash of the password with a salt, prepended with the salt, like:
where | means concatenation.
Just speculation though. My guess would be a 40-bit salt and a SHA-1 hash, since SHA-1 produces 160-bit hashes.
Would be helpful to provide some input/output test data to check against!
仅供参考,密码“apps_ro”加密为:
FYI the password 'apps_ro' encrypts as: