B4J Question SSL Certificate

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I am trying to install a SSL certificate for my B4J app which is running Linux Ubuntu 16.04 LTS.

I am trying to use the SSL certificate from Let's Encrypt.

Here is what I have done..

B4X:
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot

sudo certbot certonly --webroot -w /opt/CloudServer/http_public -d mysitehere.com -d www.mysitehere.com

sudo certbot certonly --standalone -d mysitehere.com -d www.mysitehere.com
(replaced mysitehere.com with my actual domain name for my website where my B4J app is running.)


The above created a folder in etc/letsencrypt/live/mysitehere.com/
In that directory there is a few .pem files.

So far it seems to of worked.

I then run the command:
B4X:
sudo openssl pkcs12 -export -out keystore.pkcs12 -in /etc/letsencrypt/live/mysitehere.com/fullchain.pem -inkey /etc/letsencrypt/live/mysitehere.com/privkey.pem

From what I understand the above command should of created a pkcs12 file.

I then run the command:

B4X:
sudo keytool -importkeystore -srckeystore keystore.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks

When I ran that above command, it asked a few questions about what password to use etc.

Looking at the tutorial: https://www.b4x.com/android/forum/threads/server-ssl-connections.40130/#content

I guess this is where the following B4J code gets those values from (which is fine since I know what I typed in):
B4X:
ssl.KeyStorePassword = "123456"
ssl.KeyManagerPassword = "654321"

In the tutorial is shows:
B4X:
ssl.SetKeyStorePath(File.DirApp, "test2.keystore") 'path to keystore file

Where is that file?

I am guessing when I run the keytool command above, it created the file keystore.jks and this is the file I need to use? If so, where did it create the file ?

Is the above correct on how to create the certificate or is there something I am missing ?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top