by pass invalid/self signed certificate in java/glassfish – linux

The following would be handy if one wants to by pass the self signed certificate in java – for app server glassfish.
1. Go to browser and paste the url on it. Let’s assume we are using https://www.sometestcert.com/thispage.asmx
2. On the page double click the lock image [ on firefox you can get it on the right bottom corner ]. Make sure you have https not http to get that lock thing

3. Assuming you are on firefox, goto security -> view certificate -> details-> and Click Export and save it as certificate.pem – choosing x.509 certificate with chain is a good one.
4. then add the key to the glassfish’s keystore.. – say on local machine the default location for key store would be
/usr/local/glassfish/domains/domain1/config.
5. Once you go to the appropriate directory, being on terminalcd , type the following.
keytool -import -alias “sometestcert.com” -keystore cacerts.jks -file /location/to/certificate.pem
6. This time it might ask you a password, if you have specific password for the cacerts then insert it, if not the default would be changeit
7. type yes when asked if you trust the site – of course :)

enjoy certicating..