Muhammad Imran Tariq
Muhammad Imran Tariq

Reputation: 23352

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?

Upvotes: 2

Views: 7980

Answers (5)

Muhammad Imran Tariq
Muhammad Imran Tariq

Reputation: 23352

There is no way to add truststore in Websphere programmatically through Java code.

Upvotes: 0

Tilo
Tilo

Reputation: 1220

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)

Upvotes: 1

Sir Geek
Sir Geek

Reputation: 51

One thing you may be able to do, If it can be done via a "Web" interface (i.e. 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.

Upvotes: 0

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

Upvotes: 1

jddsantaella
jddsantaella

Reputation: 3687

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.

Upvotes: 0

Related Questions