List of usage examples for org.apache.commons.ssl TrustChain getTrustManagers
public Object[] getTrustManagers() throws NoSuchAlgorithmException, KeyStoreException, IOException, CertificateException
From source file:org.fedoraproject.eclipse.packager.FedoraSSL.java
/** * Set up an SSLContext, and initialize it properly. * //from w w w . ja v a2 s. c om * @throws GeneralSecurityException * @throws IOException * @return The initialized SSLConext instance. * @throws FileNotFoundException * If one of the three certificates is missing. */ public SSLContext getInitializedSSLContext() throws GeneralSecurityException, FileNotFoundException, IOException { if (!allCertsExist) { Object[] bindings = { fedoraCert.getAbsolutePath(), fedoraServerCert.getAbsolutePath(), fedoraUploadCert.getAbsolutePath() }; throw new FileNotFoundException( NLS.bind(FedoraPackagerText.FedoraSSL_certificatesMissingError, bindings)); } TrustChain tc = getTrustChain(); KeyMaterial kmat = getFedoraCertKeyMaterial(); SSLContext sc = SSLContext.getInstance("SSL"); //$NON-NLS-1$ sc.init((KeyManager[]) kmat.getKeyManagers(), (TrustManager[]) tc.getTrustManagers(), new java.security.SecureRandom()); return sc; }