如何在Web应用程序中使用来自weblogic领域密钥库的证书?

时间:2012-09-12 10:12:25

标签: java cryptography weblogic

我正在做一些涉及我的Web应用程序中的证书的安全操作,我希望管理员通过标准的weblogic控制台来管理这些证书(包括密码等)。但是,我不知道如何在weblogic中运行的Web应用程序中获取weblogic中设置的证书。它甚至支持功能吗?是否可以将其与标准java加密api连接?

2 个答案:

答案 0 :(得分:1)

有三种方法可以更新weblogic中的KeyStore(管理控制台,WLST在线,WLST离线)。

管理控制台

  

环境 - >服务器 - > '您的服务器' - > KeyStores,然后更新相关的   参数

WLST离线(脚本模式)

readDomain(domainDir)
cd("/Servers/" + msName)
set("KeyStores", "CustomIdentityAndCustomTrust")
set("CustomIdentityKeyStoreFileName", identKeystoreFile)
set("CustomIdentityKeyStorePassPhraseEncrypted", identKeystoreKSPass)
set("CustomTrustKeyStoreFileName", trustKeystoreFile)
set("CustomTrustKeyStorePassPhraseEncrypted", trustKeystoreKSPass)
updateDomain()
exit()

WLST在线(脚本模式)

connect(username,password,"t3://localhost:7001")
cd("/Servers/" + msName)
set("KeyStores", "CustomIdentityAndCustomTrust")
set("CustomIdentityKeyStoreFileName", identKeystoreFile)
set("CustomIdentityKeyStorePassPhraseEncrypted", encrypt(inp_identKeystoreKSPass))
set("CustomTrustKeyStoreFileName", inp_trustKeystoreFile)
set("CustomTrustKeyStorePassPhraseEncrypted", encrypt(inp_trustKeystoreKSPass))
save()
activate()

WLST在线(嵌入式模式)

InteractiveInterpreter interpreter = new WLSTInterpreter();
StringBuffer buffer = new StringBuffer();
buffer.append("connect('weblogic','weblogic','t3://localhost:7001')\n"); 
buffer.append("cd('/Servers/' + msName)\n");
buffer.append("set('KeyStores', 'CustomIdentityAndCustomTrust')\n");
buffer.append("set('CustomIdentityKeyStoreFileName', identKeystoreFile)\n");
buffer.append("set('CustomIdentityKeyStorePassPhraseEncrypted', encrypt(inp_identKeystoreKSPass))\n");
buffer.append("set('CustomTrustKeyStoreFileName', inp_trustKeystoreFile)\n");
buffer.append("set('CustomTrustKeyStorePassPhraseEncrypted', encrypt(inp_trustKeystoreKSPass))\n");
buffer.append("save()\n");
buffer.append("activate()");
interpreter.exec(buffer.toString());

答案 1 :(得分:1)

在Weblogic中,有一个名为Mbean的{​​{1}}。您可以检查操作以找到满足您要求的操作。我认为在大多数情况下,你可以找到一个。