gpt4 book ai didi

java - 有人知道 JDeveloper/SQL Developer 使用什么加密技术来持久化凭据吗?

转载 作者:IT老高 更新时间:2023-10-28 20:49:18 28 4
gpt4 key购买 nike

如果我需要实现类似的解决方案,我会很想了解这里使用哪种技术来保存敏感数据。这是一个示例连接配置和生成的导出片段:

Oracle SQL Developer Connections

<?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>

任何建议将不胜感激。

最佳答案

出于好奇,您实际看到的是与加密密码连接的 key 。例如,我尝试使用以下方法加密密码“SAILBOAT”:

DatabaseProviderHelper.goingOut("SAILBOAT")

在这个特定的例子中,结果是:

0527C290B40C41D71139B5E7A4446E94D7678359087249A463

The first byte is constant:

05

The next 8 bytes represent the randomly generated secret key (for the DES cipher):

27C290B40C41D711

The remaining bytes are the encrypted password:

39B5E7A4446E94D7678359087249A463

Therefore, to decrypt the password, you simply use this:

public static byte[] decryptPassword(byte[] result) throws GeneralSecurityException {
byte constant = result[0];
if (constant != 5) {
throw new IllegalArgumentException();
}

byte[] secretKey = new byte[8];
System.arraycopy(result, 1, secretKey, 0, 8);

byte[] encryptedPassword = new byte[result.length - 9];
System.arraycopy(result, 9, encryptedPassword, 0, encryptedPassword.length);

byte[] iv = new byte[8];
for (int i = 0; i < iv.length; i++) {
iv[i] = 0;
}

Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(secretKey, "DES"), new IvParameterSpec(iv));
return cipher.doFinal(encryptedPassword);
}

关于java - 有人知道 JDeveloper/SQL Developer 使用什么加密技术来持久化凭据吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1032721/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com