Class AesSecretKeyProvider

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.crypto.SecretKey generateSecretKey()
      Generates a new secret key.
      javax.crypto.SecretKey generateSecretKey​(int keySize)
      Generates a new secret key of a given size.
      static AesSecretKeyProvider getInstance()
      Returns the singleton instance of this provider.
      java.lang.String serialize​(java.security.Key key)
      Returns a serialized representation of the specified key.
      javax.crypto.SecretKey toSecretKey​(java.lang.String serialized)
      Converts the provided serialized key into a secret key.
      • Methods inherited from class java.lang.Object

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

      • AesSecretKeyProvider

        public AesSecretKeyProvider()
    • Method Detail

      • getInstance

        public static AesSecretKeyProvider getInstance()
        Returns the singleton instance of this provider.
        Returns:
        the singleton instance
      • generateSecretKey

        public javax.crypto.SecretKey generateSecretKey​(int keySize)
        Generates a new secret key of a given size.
        Parameters:
        keySize - the size of the key to generate
        Returns:
        a secret key
      • toSecretKey

        public javax.crypto.SecretKey toSecretKey​(java.lang.String serialized)
        Description copied from interface: SecretKeyProvider
        Converts the provided serialized key into a secret key.
        Specified by:
        toSecretKey in interface SecretKeyProvider
        Parameters:
        serialized - the serialized key
        Returns:
        a secret key
      • serialize

        public java.lang.String serialize​(java.security.Key key)
        Description copied from interface: SecretKeyProvider
        Returns a serialized representation of the specified key.
        Specified by:
        serialize in interface SecretKeyProvider
        Parameters:
        key - the key to serialize
        Returns:
        the serialized key