B4J Question [solved] Configure ServerApp SSL with LetsEncrypt-Certifikate?

DonManfred

Expert
Licensed User
Longtime User
Hello, i have a few questions regarding this

Asume i have a working LetsEncrypt-Certificate running on my Webserver. On the same machine i´m running multiple B4J Server apps. It is a Windows VPS.

What do i need to do to create a keystore with this Certificate to use it in my b4j server apps?

Asking another way: What kind of key must be in the keystore?
or: Is the keystore compareable to a.PFX-File?
Can i convert/export my LetsEncrypt-Certificate to a Keystore which i then can use in my Serverapps?
 
Solution
I think i managed it out. I created a .PFX from my Certificate and tried to use it in a Serverapp.

I found this
and used this command to export my LetsEncryptCert to a PFX-File.

B4X:
openssl pkcs12 -inkey bob_key.pem -in bob_cert.cert -export -out bob_pfx.pfx

I then configured the B4JServerapp to use SSL and pointed the KeyStorePath to my PFX-File.

B4X:
Private Sub ConfigureSSL(SslPort As Int)'ignore
    'example of SSL connector configuration
    Dim ssl As SslConfiguration
    ssl.Initialize
    ssl.SetKeyStorePath("C:\tools\lego-data\certificates", "www.online-racing-club.com.pfx") 'path to keystore file
    ssl.KeyStorePassword =...

DonManfred

Expert
Licensed User
Longtime User
I think i managed it out. I created a .PFX from my Certificate and tried to use it in a Serverapp.

I found this
and used this command to export my LetsEncryptCert to a PFX-File.

B4X:
openssl pkcs12 -inkey bob_key.pem -in bob_cert.cert -export -out bob_pfx.pfx

I then configured the B4JServerapp to use SSL and pointed the KeyStorePath to my PFX-File.

B4X:
Private Sub ConfigureSSL(SslPort As Int)'ignore
    'example of SSL connector configuration
    Dim ssl As SslConfiguration
    ssl.Initialize
    ssl.SetKeyStorePath("C:\tools\lego-data\certificates", "www.online-racing-club.com.pfx") 'path to keystore file
    ssl.KeyStorePassword = "mypassword"
    ssl.KeyManagerPassword = "mypassword"
    srvr.SetSslConfiguration(ssl, SslPort)
    'add filter to redirect all traffic from http to https (optional)
    srvr.AddFilter("/*", "HttpsFilter", True)
End Sub

It just works.
 
Last edited:
Upvote 1
Solution
Cookies are required to use this site. You must accept them to continue using the site. Learn more…