Class HibernateKeyStoreDao

  • All Implemented Interfaces:
    KeyStore

    @ParametersAreNonnullByDefault
    @ReturnValuesAreNonnullByDefault
    @Transactional
    public class HibernateKeyStoreDao
    extends Object
    implements KeyStore
    Hibernate implementation of the KeyStore interface
    • Constructor Detail

      • HibernateKeyStoreDao

        public HibernateKeyStoreDao​(org.hibernate.SessionFactory sessionFactory)
    • Method Detail

      • getPrivateKey

        @Transactional(readOnly=true)
        public PrivateKey getPrivateKey​(String alias)
        Specified by:
        getPrivateKey in interface KeyStore
        Parameters:
        alias - Key alias
        Returns:
        private key for this alias or null if no such key exists
      • getPublicKey

        @Transactional(readOnly=true)
        public PublicKey getPublicKey​(String alias)
        Specified by:
        getPublicKey in interface KeyStore
        Parameters:
        alias - Key alias
        Returns:
        public key for this alias or null if no such key exists
      • getKeyPair

        @Transactional(readOnly=true)
        public @Nullable KeyPair getKeyPair​(String alias)
        Description copied from interface: KeyStore
        Returns a key pair for a specified alias. If there isn't a public/private key pair for the alias null will be returned. This is also true if there is only a public key stored for the alias.
        Specified by:
        getKeyPair in interface KeyStore
        Parameters:
        alias - Key alias
        Returns:
        Key pair for this alias or null if a pair of keys exists
      • storeKeyPair

        public void storeKeyPair​(String alias,
                                 KeyPair keyPair)
        Description copied from interface: KeyStore
        Stores a key pair against a key alias. Whether a key store supports updating existing keys forms is left to the key store implementation.
        Specified by:
        storeKeyPair in interface KeyStore
        Parameters:
        alias - Key alias
        keyPair - Key pair to store
      • storePublicKey

        public void storePublicKey​(String alias,
                                   @Nullable PublicKey publicKey)
        Description copied from interface: KeyStore
        Stores a public key against a key alias.
        Specified by:
        storePublicKey in interface KeyStore
        Parameters:
        alias - Key alias
        publicKey - Key pair to store