Class SSLUtils

java.lang.Object
io.javalin.community.ssl.util.SSLUtils

public class SSLUtils extends Object
Utility class for SSL related tasks.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.eclipse.jetty.util.ssl.SslContextFactory.Server
    createSslContextFactory(nl.altindag.ssl.SSLFactory sslFactory, SSLConfig config)
    Helper method to create a SslContextFactory from the SSLFactory.
    static Provider
    Helper method to create a working Provider for the current JVM.
    static nl.altindag.ssl.SSLFactory
    Helper method to create a SSLFactory from the given config.
    static nl.altindag.ssl.SSLFactory
    getSslFactory(SSLConfig config, boolean reloading)
    Helper method to create a SSLFactory from the given config.
    static boolean
    Checks if the current OS runs on an x86_64 architecture.
    static boolean
    Checks if the current OS is supported by Conscrypt.
    static void
    parseIdentity(SSLConfig config, nl.altindag.ssl.SSLFactory.Builder builder)
    Helper method to parse the given config and add Identity Material to the given builder.
    static void
    parseTrust(TrustConfig config, nl.altindag.ssl.SSLFactory.Builder builder)
    Helper method to parse the given config and add Trust Material to the given builder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SSLUtils

      public SSLUtils()
  • Method Details

    • createSslContextFactory

      public static org.eclipse.jetty.util.ssl.SslContextFactory.Server createSslContextFactory(nl.altindag.ssl.SSLFactory sslFactory, SSLConfig config)
      Helper method to create a SslContextFactory from the SSLFactory. This method is used to create the SSLContextFactory for the Jetty server as well as configure the resulting factory.
      Parameters:
      sslFactory - The SSLFactory to use.
      config - The SSLConfig to use.
      Returns:
      The created SslContextFactory.
    • getSslFactory

      public static nl.altindag.ssl.SSLFactory getSslFactory(SSLConfig config)
      Helper method to create a SSLFactory from the given config.
      Parameters:
      config - The config to use.
      Returns:
      The created SSLFactory.
    • getSslFactory

      public static nl.altindag.ssl.SSLFactory getSslFactory(SSLConfig config, boolean reloading)
      Helper method to create a SSLFactory from the given config.
      Parameters:
      config - The config to use.
      reloading - Whether the SSLFactory is being reloaded or is the first time.
      Returns:
      The created SSLFactory.
    • parseIdentity

      public static void parseIdentity(SSLConfig config, nl.altindag.ssl.SSLFactory.Builder builder) throws SSLConfigException
      Helper method to parse the given config and add Identity Material to the given builder.
      Parameters:
      config - The config to use.
      Throws:
      SSLConfigException - if the key configuration is invalid.
    • parseTrust

      public static void parseTrust(TrustConfig config, nl.altindag.ssl.SSLFactory.Builder builder)
      Helper method to parse the given config and add Trust Material to the given builder.
      Parameters:
      config - The config to use.
    • getSecurityProvider

      public static Provider getSecurityProvider()
      Helper method to create a working Provider for the current JVM.
    • osSupportsConscrypt

      public static boolean osSupportsConscrypt()
      Checks if the current OS is supported by Conscrypt. Currently only Windows (x86, x64), Linux (x64) and Mac OS X (x64) are supported.
      Returns:
      true if the current OS is supported by Conscrypt.
    • osIsAmd64

      public static boolean osIsAmd64()
      Checks if the current OS runs on an x86_64 architecture.
      Returns:
      true if the current OS runs on an x86_64 architecture.