FGCPCredentials currentCreds = checkNotNull(creds.get(), "fgcpcredential supplier returned null");
PrivateKey privateKey = checkNotNull(currentCreds.privateKey, "fgcpcredential's privateKey is null");
Collection<X509Certificate> certs = checkNotNull(currentCreds.certificates, "fgcpcredential's certificates returned null");
try {
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
KeyStore keyStore = KeyStore.getInstance("pkcs12");
keyStore.load(null, null);
keyStore.setKeyEntry("dummy alias", privateKey, null, (Certificate[]) certs.toArray(new Certificate[0]));
kmf.init(keyStore, null);
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(kmf.getKeyManagers(), trustManager, new SecureRandom());
return sc;
} catch (GeneralSecurityException e) {
throw propagate(e);
} catch (IOException e) {
throw propagate(e);