简体   繁体   中英

Add certificate in websphere local truststore; Programmatically

I am using websphere 7. From its Admin console certificate can be added to trust store.

Security->SSL certificate and key management->Key stores and certificates-> NodeDefaultTrustStore-> Signer certificates

I want to add it programmatically through Java code. How can I add and remove it from that store using Java?

Imran,

See if you can use the wsadmin utility to automate the agging of certificates, it's better to let websphere manage that trust store

http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Frxml_atsignercert.html

thanks, dims

here an working example to get from URL:

wsadmin.bat -conntype SOAP -port 8881 -host localhost -username localwsadmin -password Mypass123 -lang jython -c "AdminTask.retrieveSignerFromPort('-host smtp.office365.com -port 995 -keyStoreName NodeDefaultTrustStore -certificateAlias MSO365cert')"

Add from file like this:

AdminTask.addSignerCertificate('[-keyStoreName NodeDefaultTrustStore -certificateAlias
default -certificateFilePath <file path> -base64Encoded true]')

Also can be done via GUI iKeyman or Java CMD keytool.exe (C:\\IBM\\WebSphere\\AppServer\\java\\bin\\keytool.exe)

This code example can help you to do it. It takes certificate from an URL and store it in a keystore.

Edited:

Also, take a look to KeyStore class.

无法通过 Java 代码以编程方式在 Websphere 中添加信任库。

One thing you may be able to do, If it can be done via a "Web" interface (ie via an HTML/etc. page), there is a way you may be able to do it.

Take a look at Selenium HQ . I think that it might work for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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