Skip to content
Snippets Groups Projects
Commit 9067ed15 authored by John Carlson's avatar John Carlson
Browse files

Fix the trust manager

parent 8d825179
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,10 +3,7 @@ package com.commit451.gitlab.api
import java.security.KeyStore
import java.security.KeyStoreException
import java.security.NoSuchAlgorithmException
import java.util.Arrays
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
import java.util.*
import javax.net.ssl.TrustManagerFactory
import javax.net.ssl.X509TrustManager
 
Loading
Loading
@@ -32,7 +29,7 @@ object X509TrustManagerProvider {
}
 
}
return x509TrustManager
return x509TrustManager!!
}
 
/**
Loading
Loading
@@ -44,7 +41,8 @@ object X509TrustManagerProvider {
@Throws(NoSuchAlgorithmException::class, KeyStoreException::class)
private fun init() {
val trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
trustManagerFactory.init(null as KeyStore)
val nullKeystore : KeyStore? = null
trustManagerFactory.init(nullKeystore)
val trustManagers = trustManagerFactory.trustManagers
if (trustManagers.size != 1 || trustManagers[0] !is X509TrustManager) {
throw IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers))
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment