Class KeyStoreParameters

java.lang.Object
org.apache.camel.support.jsse.JsseParameters
org.apache.camel.support.jsse.KeyStoreParameters
All Implemented Interfaces:
CamelContextAware, HasCamelContext

public class KeyStoreParameters extends JsseParameters
A representation of configuration options for creating and loading a KeyStore instance.
  • Field Details

    • type

      protected String type
    • password

      protected String password
    • provider

      protected String provider
    • keyStore

      protected KeyStore keyStore
    • resource

      protected String resource
  • Constructor Details

    • KeyStoreParameters

      public KeyStoreParameters()
  • Method Details

    • getType

      public String getType()
    • setType

      public void setType(String value)
      The type of the key store to create and load. See https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html
    • getPassword

      public String getPassword()
    • setPassword

      public void setPassword(String value)
      The password for reading/opening/verifying the key store.
    • getProvider

      public String getProvider()
    • setProvider

      public void setProvider(String value)
      The provider identifier for instantiating the key store.
      See Also:
    • getResource

      public String getResource()
    • setResource

      public void setResource(String value)
      The keystore to load. The keystore is by default loaded from classpath. If you must load from file system, then use file: as prefix. file:nameOfFile (to refer to the file system) classpath:nameOfFile (to refer to the classpath; default) http:uri (to load the resource using HTTP) ref:nameOfBean (to lookup an existing KeyStore instance from the registry, for example for testing and development).
    • setKeyStore

      public void setKeyStore(KeyStore keyStore)
      To use an existing KeyStore instead of loading. You must also set password so this keystore can be used.
    • createKeyStore

      public KeyStore createKeyStore() throws GeneralSecurityException, IOException
      Creates a KeyStoreParameters instance based off of the configuration state of this instance. If getType() returns null, the default key store type is loaded, otherwise the type will be of that specified.

      The created instance will always be loaded, but if the type requires an input stream and getResource() returns null, the instance will be empty. The loading of the resource, if not null, is attempted by treating the resource as a file path, a class path resource, and a URL in that order. An exception is thrown if the resource cannot be resolved to readable input stream using any of the above methods.

      Returns:
      a configured and loaded key store
      Throws:
      GeneralSecurityException - if there is an error creating an instance with the given configuration
      IOException - if there is an error resolving the configured resource to an input stream
    • toString

      public String toString()
      Overrides:
      toString in class Object