-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
44 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cn.vove7.plugin.rest.https | ||
|
||
import java.security.SecureRandom | ||
import java.security.cert.X509Certificate | ||
import javax.net.ssl.SSLContext | ||
import javax.net.ssl.SSLSocketFactory | ||
import javax.net.ssl.X509TrustManager | ||
|
||
class TrustAllCerts : X509TrustManager { | ||
override fun checkClientTrusted(p0: Array<out X509Certificate>?, p1: String?) { | ||
} | ||
|
||
override fun checkServerTrusted(p0: Array<out X509Certificate>?, p1: String?) { | ||
} | ||
|
||
override fun getAcceptedIssuers(): Array<X509Certificate> { | ||
return emptyArray() | ||
} | ||
|
||
companion object { | ||
fun createSSLSocketFactory(): SSLSocketFactory? { | ||
try { | ||
val sc: SSLContext = SSLContext.getInstance("TLS") | ||
sc.init(null, arrayOf(TrustAllCerts()), SecureRandom()) | ||
return sc.socketFactory | ||
} catch (e: Exception) { | ||
} | ||
return null | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters