Class KeyStoreFactory


  • public abstract class KeyStoreFactory
    extends java.lang.Object
    Helper methods to parse security related configuration.
    • Method Detail

      • cryptoFor

        public static Crypto cryptoFor​(CryptoType cryptoType)
        Returns crypto that matches the specified algorithm.
        Parameters:
        cryptoType - crypto type
        Returns:
        crypto implementation
      • createSecretKeyStore

        public static SecretKeyStore createSecretKeyStore​(java.util.List<? extends com.typesafe.config.Config> config)
        Creates secret key store configured based on the passed in config.
        Parameters:
        config - config to extract the keys from
        Returns:
        secret key store
      • createSecretKeyStoreFromKeys

        public static SecretKeyStore createSecretKeyStoreFromKeys​(java.util.List<SecretKeyPair> keys)
        Creates secret key store configured based on the passed in AuthConfig proto.
        Parameters:
        keys - a list of keys
        Returns:
        secret key store
      • createSecretKeyPair

        public static SecretKeyPair createSecretKeyPair​(com.typesafe.config.Config config)
        Parses a private key from config.
        Parameters:
        config - the config to be parsed
        Returns:
        secret key pair
      • createSecretKeyPair

        public static SecretKeyPair createSecretKeyPair​(java.lang.String publicKey,
                                                        java.lang.String privateKey,
                                                        java.lang.String algorithm,
                                                        boolean isActive)
        Creates a key pair using given params.
        Parameters:
        publicKey - public key string
        privateKey - private key string
        algorithm - key algorithm
        isActive - true if key is active
        Returns:
        a private key
      • createTrustedKeyStore

        public static TrustedKeyStore createTrustedKeyStore​(java.util.List<? extends com.typesafe.config.Config> config)
        Creates trusted key store configured based on the passed in config.
        Parameters:
        config - config to extract the keys from
        Returns:
        trusted key store