Is it possible to use code similar to this:
www.b4x.com
to add certificate pinning to a wss websocket client connection and remove the need to use 'accept all certificates' when a self-signed certificate is in use at the server end?
More details:
I have a jRDC2 based server which also includes websocket messaging. The server is using a self-signed certificate wth the keystore loaded via:
I have client apps which connect to the server via https and websocket. Until now I've always set both to 'Accept all certificates', using HU2_ACCEPTALL conditional symbol for the https, and this code for the websocket connection.
Just as a learning process I thought I'd look into using certificate pinning instead of just accepting all certificates.
Using @Erel's code for the SSLContext-Kickstart SDK worked striaght out of the box for the https connection. Loading the same keystore into the client that's in the server allowed me to remove the HU2_ACCEPTALL condition.
But the websocket connection still needs the Accept All code to connect. So I'm wondering if anyone can provide me with something similar to allow me to 'pin' the keystore to the websocket client too?
Many thanks.
[B4X] Client certificates with OkHttpUtils2 SSLContext-Kickstart
This is a B4A + B4J library. This code uses JavaObject to access SSLContext-Kickstart SDK (v5.0.0): https://github.com/Hakky54/sslcontext-kickstart/tree/v5.0.0 License: Apache 2. It allows configuring OkHttpUtils2 to use an external keystore and include client certificates. 'Press Ctrl + B...

More details:
I have a jRDC2 based server which also includes websocket messaging. The server is using a self-signed certificate wth the keystore loaded via:
jRDC2 ssl keystore:
Private Sub ConfigureSSL (sslPort As Int)
Dim ssl As SslConfiguration
ssl.Initialize
ssl.SetKeyStorePath("keyStorePath", "keystoreName") 'path to keystore file
ssl.KeyStorePassword = "pw"
ssl.KeyManagerPassword = "pw"
srvr.SetSslConfiguration(ssl, sslPort)
'add filter to redirect all traffic from http to https (optional)
srvr.AddFilter("/*", "HttpsFilter", False)
End Sub
Just as a learning process I thought I'd look into using certificate pinning instead of just accepting all certificates.
Using @Erel's code for the SSLContext-Kickstart SDK worked striaght out of the box for the https connection. Loading the same keystore into the client that's in the server allowed me to remove the HU2_ACCEPTALL condition.
But the websocket connection still needs the Accept All code to connect. So I'm wondering if anyone can provide me with something similar to allow me to 'pin' the keystore to the websocket client too?
Many thanks.