Class OpenSSL4JProvider

All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public final class OpenSSL4JProvider extends Provider
JCA provider directing all calls to the system native OpenSSL library.
See Also:
  • Field Details

    • PROVIDER_NAME

      public static final String PROVIDER_NAME
      The provider name as passed to JCA.
      See Also:
    • openSslMessageDigestAlgorithms

      private static Set<String> openSslMessageDigestAlgorithms
    • SSL_TO_JAVA_NAMES

      private static final String[] SSL_TO_JAVA_NAMES
      Name pairs mapping from SSL to Java. First one is SSL name, second one is Java name.
  • Constructor Details

    • OpenSSL4JProvider

      public OpenSSL4JProvider()
      Constructor for the JCA Provider for OpenSSL JNI.
      Throws:
      IllegalStateException - if the native object file can't be loaded and the class can't be used.
  • Method Details

    • getLibraryVersion

      private static double getLibraryVersion()
    • getNames

      private static Map<String,String> getNames(Set<String> availableOpenSslAlgorithmNames)
      Gets the names and the aliases of all message digest algorithms.
      Returns:
      a map mapping from algorithm name / alias to algorithm class.
    • createAliases

      private static Map<String,String> createAliases(Map<String,String> map)
      Creates some aliases for an input map.
      Parameters:
      map - a map with keys being algorithm names of the form "MessageDigest.MD5" and the keys being java class names.
      Returns:
      a map mapping from algorithm name / alias to algorithm class.
    • getOpenSSLHashnames

      private static Map<String,String> getOpenSSLHashnames(Set<String> availableOpenSslAlgos)
      Fills a map with the names of all algorithms in OpenSSL-JNA.
      Returns:
      mapping from algorithm name to class name.