I am a little familiar with all this WebSocket and SSL certificate.
So, I created my own WebSocket server on the Android side, and the website is the client. I was able to get it to work with regular WebSocket (ws://) , but not protected WebSocket (wss://) due to the fact that it requires an SSL certificate.
My question is, how can I get an SSL certificate? From what I read, the SSL certificate is domain based. I need this for localhost. I need this for something like this address:
wss:
How can I get an SSL certificate that will work with localhost .
Thank you for your time!
======================== EDIT =========================>
The reason why I do this: I have a Bluetooth service in my Android app that will receive data from connected Bluetooth devices, such as Weight Scale and Blood Pressure machine. I already have this part, and I want to take this data and transfer it to the website. WebSocket seemed easier, because the user will have my application open, and when he makes his weight, he will automatically fill in the field on the website with the weight from the weight scale. I hope I will explain this clearly.
To do this, I need to have a way to transfer weight or blood pressure values from Java (Android) to a website that loads in WebView. So I thought WebSocket would be the easiest way.
Please tell me if you think there is an easier way.
In addition, I have already tried a self-signed certificate and get the following error:
I/X509Util: Failed to validate the certificate chain, error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
OR
Exception=javax.net.ssl.SSLException: Error occured in delegated task:javax.net.ssl.SSLException: Not trusted server certificate
Thank!!!
ᴛʜᴇᴘᴀᴛᴇʟ Mar 16 '16 at 13:45 2016-03-16 13:45
source share