Class RsaKeyStoreHelper

  • All Implemented Interfaces:
    KeyStoreHelper

    public class RsaKeyStoreHelper
    extends java.lang.Object
    implements KeyStoreHelper
    The implementation of KeyStoreHelper that can work with RSA key stores.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.security.KeyStore getKeyStore​(java.io.InputStream inputStream, java.lang.String password)
      Gets the key store.
      java.security.KeyStore getKeyStore​(java.lang.String instanceType, java.io.InputStream inputStream, java.lang.String password)
      Gets the key store.
      java.lang.String getModulusAsBase64String​(byte[] modulus)
      Gets Modulus as a Base64 encoded string.
      java.security.interfaces.RSAPrivateKey getPrivateKey​(java.security.KeyStore keyStore, java.lang.String alias, java.lang.String password)
      Gets the private key.
      java.lang.String getPublicExponentAsBase64String​(byte[] publicExponent)
      Gets Public Exponent as a Base64 encoded string.
      java.security.interfaces.RSAPublicKey getPublicKey​(java.security.KeyStore keyStore, java.lang.String alias)
      Gets the public key.
      org.springframework.security.jwt.crypto.sign.Signer getSigner​(java.lang.String instanceType, java.io.InputStream inputStream, java.lang.String alias, java.lang.String password)
      Gets the signer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_INSTANCE_TYPE

        public static final java.lang.String DEFAULT_INSTANCE_TYPE
        See Also:
        Constant Field Values
    • Constructor Detail

      • RsaKeyStoreHelper

        public RsaKeyStoreHelper()
    • Method Detail

      • getKeyStore

        public java.security.KeyStore getKeyStore​(java.lang.String instanceType,
                                                  java.io.InputStream inputStream,
                                                  java.lang.String password)
                                           throws KeyStoreProcessingException
        Description copied from interface: KeyStoreHelper
        Gets the key store.
        Specified by:
        getKeyStore in interface KeyStoreHelper
        Parameters:
        instanceType - the instance type
        inputStream - the input stream
        password - the password
        Returns:
        the key store
        Throws:
        KeyStoreProcessingException - the key store processing exception
      • getModulusAsBase64String

        public java.lang.String getModulusAsBase64String​(byte[] modulus)
        Description copied from interface: KeyStoreHelper
        Gets Modulus as a Base64 encoded string.
        Specified by:
        getModulusAsBase64String in interface KeyStoreHelper
        Parameters:
        modulus - the modulus
        Returns:
        the modulus as Base64 string
      • getPublicExponentAsBase64String

        public java.lang.String getPublicExponentAsBase64String​(byte[] publicExponent)
        Description copied from interface: KeyStoreHelper
        Gets Public Exponent as a Base64 encoded string.
        Specified by:
        getPublicExponentAsBase64String in interface KeyStoreHelper
        Parameters:
        publicExponent - the publicExponent
        Returns:
        the publicExponent as Base64 string
      • getPrivateKey

        public java.security.interfaces.RSAPrivateKey getPrivateKey​(java.security.KeyStore keyStore,
                                                                    java.lang.String alias,
                                                                    java.lang.String password)
                                                             throws KeyStoreProcessingException
        Description copied from interface: KeyStoreHelper
        Gets the private key.
        Specified by:
        getPrivateKey in interface KeyStoreHelper
        Parameters:
        keyStore - the key store
        alias - the alias
        password - the password
        Returns:
        the private key
        Throws:
        KeyStoreProcessingException - the key store processing exception
      • getSigner

        public org.springframework.security.jwt.crypto.sign.Signer getSigner​(java.lang.String instanceType,
                                                                             java.io.InputStream inputStream,
                                                                             java.lang.String alias,
                                                                             java.lang.String password)
                                                                      throws KeyStoreProcessingException
        Description copied from interface: KeyStoreHelper
        Gets the signer.
        Specified by:
        getSigner in interface KeyStoreHelper
        Parameters:
        instanceType - the instance type
        inputStream - the input stream
        alias - the alias
        password - the password
        Returns:
        the signer
        Throws:
        KeyStoreProcessingException - the key store processing exception