Reputation: 23352
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
Reputation: 23352
There is no way to add truststore in Websphere programmatically through Java code.
Upvotes: 0
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
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
Reputation: 889
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
thanks, dims
Upvotes: 1
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