/** * Creates trust managers using the receiver's trust store configuration. * * @param context context for status messages * @return an array of trust managers or {@code null} if no trust store configuration was provided * @throws NoSuchProviderException if a provider specified for one of the trust manager components * is not known to the platform * @throws NoSuchAlgorithmException if an algorithm specified for one of the trust manager * components is not known to the relevant provider * @throws KeyStoreException if an error occurs in reading a key store containing trust anchors */ private TrustManager[] createTrustManagers(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyStoreException { if (getTrustStore() == null) return null; KeyStore trustStore = getTrustStore().createKeyStore(); context.addInfo( "trust store of type '" + trustStore.getType() + "' provider '" + trustStore.getProvider() + "': " + getTrustStore().getLocation()); TrustManagerFactory tmf = getTrustManagerFactory().createTrustManagerFactory(); context.addInfo( "trust manager algorithm '" + tmf.getAlgorithm() + "' provider '" + tmf.getProvider() + "'"); tmf.init(trustStore); return tmf.getTrustManagers(); }