How to Implement TLSv1.3 in Applications: Difference between revisions
(Created page with "== References == [https://github.com/google/conscrypt GitHub project] [https://source.android.google.cn/devices/architecture/modular-system/conscrypt?hl=zh-cn#conscrypt-format...") |
No edit summary |
||
Line 1: | Line 1: | ||
== References == | == References == | ||
[https://github.com/google/conscrypt GitHub project] | [https://github.com/google/conscrypt GitHub project] | ||
[https://source.android.google.cn/devices/architecture/modular-system/conscrypt?hl=zh-cn#conscrypt-format Resouces] | [https://source.android.google.cn/devices/architecture/modular-system/conscrypt?hl=zh-cn#conscrypt-format Resouces] | ||
Revision as of 09:25, 29 June 2022
References
Sample
Snippet Code:
Provider conscrypt = Conscrypt.newProvider();
// Add as provider
Security.insertProviderAt(conscrypt, 1);
SSLContext context = SSLContext.getInstance("TLSv1.3");
context.init(null/*keyManagers*/, null /*new CtsTrustManager[] {trustManager}*/, null);
SSLSocketFactory factory = context.getSocketFactory();
URL sslURL = new URL("https://www.vpslala.com/");
HttpsURLConnection con = (HttpsURLConnection) sslURL.openConnection();
con.setSSLSocketFactory(factory);
Log.d("SQLTest", "SQLTestTLS13. "+con.getResponseMessage());