I need to generate a keystore.bks file to use for android development. I cannot figure out how to export a bks keystore without using a GUI tool. I have server space on Google Compute Engine which I am connecting to through SSH. There is no GUI option that I know of.
I set up HTTPS on Tomcat doing the following:
Run $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA You will have to answer a few questions. Most are intuitive. But: Specify same passwords for both: key store and key. After completion you will have new key store with new key. As the next step you must edit $CATALINA_BASE/conf/server.xml file: Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystorePass="your_password_from_step_3" />
I did that stuff; now I need to export my keystore as keystore.bks and I cannot find a way to do it -- at least not something I can understand. I am extremely new to Linux and really need it to be spelled out; 1. download using this command "blah blah blah" 2. run this command "blah blah blah". Sorry for being inept, but I am very much struggling to accomplish something I think is probably relatively straightforward.
These are the instructions I was given:
- Go to http://portecle.sourceforge.net/ and download Portecle
- Open your JKS keystore via Portecle
- Export your certificate
- Create new BKS keystore
- Import your certificate and save BKS keystore as "keystore.bks"
- In android app replace keystore.bks file by your just created BKS keystore
- In app.properties modify "server.ssl.keystore_password" as you need
Unfortunately I cannot execute portecle in my Linux install because it does not have a GUI. I tried to load the installer to the server and run java -jar portecle.jar and it failed:
Dec 19, 2015 2:33:37 AM java.util.prefs.FileSystemPreferences$1 run INFO: Created user preferences directory. Exception in thread "AWT-EventQueue-0" java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204) at java.awt.Window.(Window.java:536) at java.awt.Frame.(Frame.java:420) at java.awt.Frame.(Frame.java:385) at javax.swing.JFrame.(JFrame.java:189) at net.sf.portecle.FPortecle.(FPortecle.java:342) at net.sf.portecle.FPortecle$CreateAndShowGui.run(FPortecle.java:6537) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)