/** * Find the first provider from the supplier which provides the given service type and algorithm name. The simple * name of the service type class is used to identify the service. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type as a class name (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProvider(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }
/** * Find a provider service which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider service, or {@code null} if none is found */ public static Provider.Service findProviderService(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProviderService(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }
foundBits = setBit(foundBits, 1); parseEmptyType(reader); providerSupplier = providerSupplier == null ? INSTALLED_PROVIDERS : ProviderUtil.aggregate(providerSupplier, INSTALLED_PROVIDERS); break; ELYTRON_PROVIDER_SUPPLIER : new ProviderServiceLoaderSupplier(ModuleLoader.getClassLoaderFromModule(reader, moduleName)); providerSupplier = providerSupplier == null ? serviceLoaderSupplier : ProviderUtil.aggregate(providerSupplier, serviceLoaderSupplier); break;
foundBits = setBit(foundBits, 1); parseEmptyType(reader); providerSupplier = providerSupplier == null ? INSTALLED_PROVIDERS : ProviderUtil.aggregate(providerSupplier, INSTALLED_PROVIDERS); break; ELYTRON_PROVIDER_SUPPLIER : new ProviderServiceLoaderSupplier(ModuleLoader.getClassLoaderFromModule(reader, moduleName)); providerSupplier = providerSupplier == null ? serviceLoaderSupplier : ProviderUtil.aggregate(providerSupplier, serviceLoaderSupplier); break;
public KeyStore get() throws ConfigXMLParseException { Provider provider = findProvider(providers, providerName, KeyStore.class, type); if (provider == null) { throw xmlLog.xmlUnableToIdentifyProvider(location, providerName, "KeyStore", type); } try { return KeyStore.getInstance(type, provider); } catch (GeneralSecurityException e) { throw xmlLog.xmlFailedToCreateKeyStore(location, e); } } }
/** * Find the first provider from the supplier which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, String serviceType, String algorithm) { final Provider.Service service = findProviderService(providerSupplier, providerName, serviceType, algorithm); return service == null ? null : service.getProvider(); }
foundBits = setBit(foundBits, 1); parseEmptyType(reader); providerSupplier = providerSupplier == null ? INSTALLED_PROVIDERS : ProviderUtil.aggregate(providerSupplier, INSTALLED_PROVIDERS); break; ELYTRON_PROVIDER_SUPPLIER : new ProviderServiceLoaderSupplier(ModuleLoader.getClassLoaderFromModule(reader, moduleName)); providerSupplier = providerSupplier == null ? serviceLoaderSupplier : ProviderUtil.aggregate(providerSupplier, serviceLoaderSupplier); break;
X509ExtendedKeyManager build() throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, ConfigXMLParseException { final String algorithm = this.algorithm != null ? this.algorithm : KeyManagerFactory.getDefaultAlgorithm(); Provider provider = findProvider(providers, providerName, KeyManagerFactory.class, algorithm); if (provider == null) { throw xmlLog.xmlUnableToIdentifyProvider(xmlLocation, providerName, "KeyManagerFactory", algorithm); } KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(algorithm, provider); keyManagerFactory.init(keyStoreSupplier != null ? keyStoreSupplier.get() : null, null); for (KeyManager keyManager : keyManagerFactory.getKeyManagers()) { if (keyManager instanceof X509ExtendedKeyManager) { return (X509ExtendedKeyManager) keyManager; } } throw ElytronMessages.log.noDefaultKeyManager(); } }
/** * Find the first provider from the supplier which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, String serviceType, String algorithm) { final Provider.Service service = findProviderService(providerSupplier, providerName, serviceType, algorithm); return service == null ? null : service.getProvider(); }
foundBits = setBit(foundBits, 1); parseEmptyType(reader); providerSupplier = providerSupplier == null ? INSTALLED_PROVIDERS : ProviderUtil.aggregate(providerSupplier, INSTALLED_PROVIDERS); break; ELYTRON_PROVIDER_SUPPLIER : new ProviderServiceLoaderSupplier(ModuleLoader.getClassLoaderFromModule(reader, moduleName)); providerSupplier = providerSupplier == null ? serviceLoaderSupplier : ProviderUtil.aggregate(providerSupplier, serviceLoaderSupplier); break;
X509TrustManager build() throws NoSuchAlgorithmException, KeyStoreException, ConfigXMLParseException { final String algorithm = this.algorithm != null ? this.algorithm : TrustManagerFactory.getDefaultAlgorithm(); Provider provider = findProvider(providers, providerName, TrustManagerFactory.class, algorithm); if (provider == null) { throw xmlLog.xmlUnableToIdentifyProvider(xmlLocation, providerName, "TrustManagerFactory", algorithm); } final TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(algorithm, provider); if (crl) { return new X509CRLExtendedTrustManager(trustStore, trustManagerFactory, crlStream, maxCertPath, null); } else { trustManagerFactory.init(trustStore); } for (TrustManager trustManager : trustManagerFactory.getTrustManagers()) { if (trustManager instanceof X509TrustManager) { return (X509TrustManager) trustManager; } } throw ElytronMessages.log.noDefaultTrustManager(); } }
/** * Find a provider service which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider service, or {@code null} if none is found */ public static Provider.Service findProviderService(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProviderService(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }
Provider provider = findProvider(providers, finalProviderName, KeyManagerFactory.class, algorithmResolved); if (provider == null) { throw xmlLog.xmlUnableToIdentifyProvider(location, finalProviderName, "KeyManagerFactory", algorithmResolved);
/** * Find the first provider from the supplier which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, String serviceType, String algorithm) { final Provider.Service service = findProviderService(providerSupplier, providerName, serviceType, algorithm); return service == null ? null : service.getProvider(); }
/** * Find the first provider from the supplier which provides the given service type and algorithm name. The simple * name of the service type class is used to identify the service. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type as a class name (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProvider(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }
/** * Find a provider service which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider service, or {@code null} if none is found */ public static Provider.Service findProviderService(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProviderService(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }
/** * Find the first provider from the supplier which provides the given service type and algorithm name. The simple * name of the service type class is used to identify the service. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type as a class name (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProvider(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }
/** * Find the first provider from the supplier which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, String serviceType, String algorithm) { final Provider.Service service = findProviderService(providerSupplier, providerName, serviceType, algorithm); return service == null ? null : service.getProvider(); }
/** * Find the first provider from the supplier which provides the given service type and algorithm name. The simple * name of the service type class is used to identify the service. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type as a class name (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider, or {@code null} if none is found */ public static Provider findProvider(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProvider(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }
/** * Find a provider service which provides the given service type and algorithm name. * * If a providerName is specified the match will only be tested against providers with the name specified. * * @param providerSupplier the provider supplier (must not be {@code null}) * @param providerName the name of the provider, can be {@code null} * @param serviceType the service type (must not be {@code null}) * @param algorithm the algorithm name (must not be {@code null}) * @return the provider service, or {@code null} if none is found */ public static Provider.Service findProviderService(Supplier<Provider[]> providerSupplier, String providerName, Class<?> serviceType, String algorithm) { Assert.checkNotNullParam("serviceType", serviceType); return findProviderService(providerSupplier, providerName, serviceType.getSimpleName(), algorithm); }