Class Utils
java.lang.Object
uk.ac.manchester.spinnaker.alloc.security.Utils
public abstract class Utils extends Object
Support utility methods for working with SSL stuff.
-
Method Summary
Modifier and Type Method Description static void
installInjectableTrustStoreAsDefault(Supplier<X509TrustManager> injector)
Set up the default SSL context so that we can inject our trust store for verifying servers.static KeyStore
loadTrustStore(SpallocProperties.OpenIDProperties props)
Loads a trust store.static X509TrustManager
trustManager(KeyStore truststore)
Load a trust store into a trust manager.
-
Method Details
-
trustManager
Load a trust store into a trust manager.- Parameters:
truststore
- The trust store to load, ornull
to use the default.- Returns:
- The configured trust manager.
- Throws:
GeneralSecurityException
- If things go wrong.- See Also:
- Stack Overflow
-
installInjectableTrustStoreAsDefault
public static void installInjectableTrustStoreAsDefault(Supplier<X509TrustManager> injector) throws GeneralSecurityExceptionSet up the default SSL context so that we can inject our trust store for verifying servers.- Parameters:
injector
- How to get the value to inject.- Throws:
GeneralSecurityException
- If the SSL context can't be built.- See Also:
- Stack Overflow
-
loadTrustStore
public static KeyStore loadTrustStore(SpallocProperties.OpenIDProperties props) throws GeneralSecurityException, IOExceptionLoads a trust store.- Parameters:
props
- Where is the trust store and how should we load it?- Returns:
- The trust store. Note that this is not installed into anything.
- Throws:
GeneralSecurityException
- If the trust store contains bad info.IOException
- If the trust store can't be read at all.
-