SecurityFactory<X509TrustManager> getX509TrustManagerFactory() { return trustManagerFactory == null ? SSLUtils.getDefaultX509TrustManagerSecurityFactory() : trustManagerFactory; }
/** * Create a configured SSL context from an outside SSL context. * * @param original the original SSL context * @param sslConfigurator the SSL configurator * @return the configured SSL context */ public static SSLContext createConfiguredSslContext(SSLContext original, final SSLConfigurator sslConfigurator) { return createConfiguredSslContext(original, sslConfigurator, true); }
/** * Create an {@code SNIMatcher} which matches SNI host names that are equal to the given (ASCII) string. * * @param string the host name string (must not be {@code null}) * @return the SNI matcher (not {@code null}) * @see IDN */ public static SNIMatcher createHostNameStringSNIMatcher(String string) { Assert.checkNotNullParam("string", string); return createHostNameStringPredicateSNIMatcher(string::equals); }
/** * Create an SSL context factory which locates the best context by searching the preferred providers in order using * the rules established in the given protocol selector. If there are no matches, a factory is returned which * * @param protocolSelector the protocol selector * @param providerSupplier the provider supplier * @return the SSL context factory */ public static SecurityFactory<SSLContext> createSslContextFactory(ProtocolSelector protocolSelector, Supplier<Provider[]> providerSupplier) { return createSslContextFactory(protocolSelector, providerSupplier, null); }
final SecurityFactory<SSLContext> sslContextFactory = SSLUtils.createSslContextFactory(protocolSelector, providerSupplier, providerName);
/** * Construct a new instance. * * @param delegate the delegate SASL server factory * @param trustManager the trust manager to use or {@code null} if the default trust manager should be used */ public TrustManagerSaslServerFactory(final SaslServerFactory delegate, final X509TrustManager trustManager) { super(delegate); if (trustManager == null) { this.trustManagerFactory = SSLUtils.getDefaultX509TrustManagerSecurityFactory(); } else { this.trustManagerFactory = new FixedSecurityFactory<>(trustManager); } }
/** * Create an {@code SNIMatcher} which matches SNI host name strings which end with the given suffix. * * @param suffix the suffix to match (must not be {@code null} or empty) * @return the SNI matcher (not {@code null}) */ public static SNIMatcher createHostNameSuffixSNIMatcher(String suffix) { Assert.checkNotNullParam("suffix", suffix); Assert.checkNotEmptyParam("suffix", suffix); final String finalSuffix = suffix.startsWith(".") ? suffix : "." + suffix; return createHostNameStringPredicateSNIMatcher(n -> n.endsWith(finalSuffix)); }
/** * Create an SSL context factory which locates the best context by searching the preferred providers in order using * the rules established in the given protocol selector. If there are no matches, a factory is returned which * * @param protocolSelector the protocol selector * @param providerSupplier the provider supplier * @return the SSL context factory */ public static SecurityFactory<SSLContext> createSslContextFactory(ProtocolSelector protocolSelector, Supplier<Provider[]> providerSupplier) { return createSslContextFactory(protocolSelector, providerSupplier, null); }
/** * Create a configured SSL context factory from an outside SSL context. The returned factory will create new instances * for every call, so it might be necessary to wrap with a {@link OneTimeSecurityFactory} instance. * * @param originalFactory the original SSL context factory * @param sslConfigurator the SSL configurator * @return the configured SSL context */ public static SecurityFactory<SSLContext> createConfiguredSslContextFactory(SecurityFactory<SSLContext> originalFactory, final SSLConfigurator sslConfigurator) { return () -> createConfiguredSslContext(originalFactory.create(), sslConfigurator); }
SecurityFactory<X509TrustManager> getX509TrustManagerFactory() { return trustManagerFactory == null ? SSLUtils.getDefaultX509TrustManagerSecurityFactory() : trustManagerFactory; }
/** * Create an {@code SNIMatcher} which matches SNI host names that are equal to the given (ASCII) string. * * @param string the host name string (must not be {@code null}) * @return the SNI matcher (not {@code null}) * @see IDN */ public static SNIMatcher createHostNameStringSNIMatcher(String string) { Assert.checkNotNullParam("string", string); return createHostNameStringPredicateSNIMatcher(string::equals); }
/** * Create an SSL context factory which locates the best context by searching the preferred providers in order using * the rules established in the given protocol selector. If there are no matches, a factory is returned which * * @param protocolSelector the protocol selector * @param providerSupplier the provider supplier * @return the SSL context factory */ public static SecurityFactory<SSLContext> createSslContextFactory(ProtocolSelector protocolSelector, Supplier<Provider[]> providerSupplier) { return createSslContextFactory(protocolSelector, providerSupplier, null); }
/** * Create a configured SSL context from an outside SSL context. * * @param original the original SSL context * @param sslConfigurator the SSL configurator * @return the configured SSL context */ public static SSLContext createConfiguredSslContext(SSLContext original, final SSLConfigurator sslConfigurator) { return createConfiguredSslContext(original, sslConfigurator, true); }
SecurityFactory<X509TrustManager> getX509TrustManagerFactory() { return trustManagerFactory == null ? SSLUtils.getDefaultX509TrustManagerSecurityFactory() : trustManagerFactory; }
/** * Create an {@code SNIMatcher} which matches SNI host names that are equal to the given (ASCII) string. * * @param string the host name string (must not be {@code null}) * @return the SNI matcher (not {@code null}) * @see IDN */ public static SNIMatcher createHostNameStringSNIMatcher(String string) { Assert.checkNotNullParam("string", string); return createHostNameStringPredicateSNIMatcher(string::equals); }
/** * Create an SSL context factory which locates the best context by searching the preferred providers in order using * the rules established in the given protocol selector. If there are no matches, a factory is returned which * * @param protocolSelector the protocol selector * @param providerSupplier the provider supplier * @return the SSL context factory */ public static SecurityFactory<SSLContext> createSslContextFactory(ProtocolSelector protocolSelector, Supplier<Provider[]> providerSupplier) { return createSslContextFactory(protocolSelector, providerSupplier, null); }
/** * Create a configured SSL context from an outside SSL context. * * @param original the original SSL context * @param sslConfigurator the SSL configurator * @return the configured SSL context */ public static SSLContext createConfiguredSslContext(SSLContext original, final SSLConfigurator sslConfigurator) { return createConfiguredSslContext(original, sslConfigurator, true); }
SecurityFactory<X509TrustManager> getX509TrustManagerFactory() { return trustManagerFactory == null ? SSLUtils.getDefaultX509TrustManagerSecurityFactory() : trustManagerFactory; }
/** * Create an {@code SNIMatcher} which matches SNI host names that are equal to the given (ASCII) string. * * @param string the host name string (must not be {@code null}) * @return the SNI matcher (not {@code null}) * @see IDN */ public static SNIMatcher createHostNameStringSNIMatcher(String string) { Assert.checkNotNullParam("string", string); return createHostNameStringPredicateSNIMatcher(string::equals); }
final SecurityFactory<SSLContext> sslContextFactory = SSLUtils.createSslContextFactory(protocolSelector, providerSupplier, providerName);