apprtc icon indicating copy to clipboard operation
apprtc copied to clipboard

Trusting certificates SSL

Open valon91 opened this issue 5 years ago • 3 comments

Trusting certificates android , can you please help with this code ,

i am new to java and i am trying to use this code

 private SSLContext trustCert() throws CertificateException, IOException, KeyStoreException,
            NoSuchAlgorithmException, KeyManagementException {
        AssetManager assetManager = getAssets();
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        Certificate ca = cf.generateCertificate(assetManager.open("COMODORSADomainValidationSecureServerCA.crt"));

     Create a KeyStore containing our trusted CAs
        String keyStoreType = KeyStore.getDefaultType();
        KeyStore keyStore = KeyStore.getInstance(keyStoreType);
        keyStore.load(null, null);
        keyStore.setCertificateEntry("ca", ca);

        // Create a TrustManager that trusts the CAs in our KeyStore
        String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
        TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmfAlgorithm);
        tmf.init(keyStore);

        // Create an SSLContext that uses our TrustManager
        SSLContext context = SSLContext.getInstance("TLS");
        context.init(null, tmf.getTrustManagers(), null);
        return context;
    }

i downloade the certificate and i imported it to drawable folder, but i dont know how to call it , can you please help me

valon91 avatar Mar 08 '19 15:03 valon91

I have been pass the https connection to apprtc, but now my error is:

Messages:
WebSocket open error: WebSocket error. WebSocket register error: WebSocket error.

Version:
branch: master time: Fri Mar 9 17:06:42 2018 +0100 gitHash: 20cdd7652d58c9cf47ef92ba0190a5505760dc05

I run on Centos 6.10 so I can't build apprtc with grunt. I just copy builed version from ubuntu and paste on VPS CentOS, It ran but still error. For SSL config for apprtc, install stunnel5 https://www.digitalocean.com/community/tutorials/how-to-set-up-an-ssl-tunnel-using-stunnel-on-ubuntu you should build a vps for get cert file Config stunnel with your website url, not ip address $ vi /etc/stunnel/stunnel.conf

client = no [apprtc] accept = 443 sslVersion = TLSv1.1 connect = yoursite.com:8080 cert = /etc/stunnel/cert.pem

Run stunnel stunnel5 /etc/stunnel/stunnel.conf

Run apprtc by Google cloud sdk nohup /root/uav-project/sdk/google-cloud-sdk/bin/dev_appserver.py --host yoursite.com --port 8080 /root/apprtc/out/app_engine/ &

checking stunnel

netstat -lntu You will see port 443 and 8080 are opening Goto https://yoursite.com

einsteinarbert avatar Mar 16 '19 18:03 einsteinarbert

I have been pass the https connection to apprtc, but now my error is:

Messages: WebSocket open error: WebSocket error. WebSocket register error: WebSocket error. Version: branch: master time: Fri Mar 9 17:06:42 2018 +0100 gitHash: 20cdd76

I run on Centos 6.10 so I can't build apprtc with grunt. I just copy builed version from ubuntu and paste on VPS CentOS, It ran but still error. For SSL config for apprtc, install stunnel5 https://www.digitalocean.com/community/tutorials/how-to-set-up-an-ssl-tunnel-using-stunnel-on-ubuntu you should build a vps for get cert file Config stunnel with your website url, not ip address $ vi /etc/stunnel/stunnel.conf

client = no [apprtc] accept = 443 sslVersion = TLSv1.1 connect = yoursite.com:8080 cert = /etc/stunnel/cert.pem

Run stunnel stunnel5 /etc/stunnel/stunnel.conf

Run apprtc by Google cloud sdk nohup /root/uav-project/sdk/google-cloud-sdk/bin/dev_appserver.py --host yoursite.com --port 8080 /root/apprtc/out/app_engine/ &

checking stunnel

netstat -lntu You will see port 443 and 8080 are opening Goto https://yoursite.com

same problem with you . how do you solve it ?

feiyue1206 avatar Jul 17 '19 13:07 feiyue1206

same problem with you . how do you solve it ? Check your turn server, using user-password authentication You can google search github keyword with my account for more info how to resolve: hieu19926 or einsteinarbert

einsteinarbert avatar Jul 21 '19 11:07 einsteinarbert