Class UnsecuredFileSystemKeyStore

  • All Implemented Interfaces:
    KeyStore

    public final class UnsecuredFileSystemKeyStore
    extends java.lang.Object
    implements KeyStore
    A key store that uses the local file system for persistent storage.
    Keys are stored in a single root directory, with a subdirectory containing each member's keys. No support is provided for security of key files.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void deleteKeys​(java.lang.String memberId)
      Deletes keys for a specific member.
      SecretKey getById​(java.lang.String memberId, java.lang.String keyId)
      Gets a key by its ID.
      SecretKey getByLevel​(java.lang.String memberId, io.token.proto.common.security.SecurityProtos.Key.Level keyLevel)
      Gets a key by its level.
      java.util.List<SecretKey> listKeys​(java.lang.String memberId)
      Get all of a member's keys.
      void put​(java.lang.String memberId, SecretKey key)
      Puts a specified key into the storage.
      • Methods inherited from class java.lang.Object

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

      • UnsecuredFileSystemKeyStore

        public UnsecuredFileSystemKeyStore​(java.io.File keyStoreRoot)
        Creates a new key store with the default clock.
        Parameters:
        keyStoreRoot - the directory containing keys, or to add keys to. Must exist.
      • UnsecuredFileSystemKeyStore

        public UnsecuredFileSystemKeyStore​(java.io.File keyStoreRoot,
                                           Clock clock)
        Creates a new key store.
        Parameters:
        keyStoreRoot - the directory containing keys, or to add keys to. Must exist.
        clock - the directory containing keys, or to add keys to. Must exist.
    • Method Detail

      • put

        public void put​(java.lang.String memberId,
                        SecretKey key)
        Description copied from interface: KeyStore
        Puts a specified key into the storage.
        Specified by:
        put in interface KeyStore
        Parameters:
        memberId - member ID
        key - key to put into the storage
      • getByLevel

        public SecretKey getByLevel​(java.lang.String memberId,
                                    io.token.proto.common.security.SecurityProtos.Key.Level keyLevel)
        Description copied from interface: KeyStore
        Gets a key by its level.
        Specified by:
        getByLevel in interface KeyStore
        Parameters:
        memberId - member ID
        keyLevel - SecurityProtos.Key.Level of the key to get
        Returns:
        secret key
      • getById

        public SecretKey getById​(java.lang.String memberId,
                                 java.lang.String keyId)
        Description copied from interface: KeyStore
        Gets a key by its ID.
        Specified by:
        getById in interface KeyStore
        Parameters:
        memberId - member ID
        keyId - key ID to get
        Returns:
        secret key
      • deleteKeys

        public void deleteKeys​(java.lang.String memberId)
        Deletes keys for a specific member.
        Specified by:
        deleteKeys in interface KeyStore
        Parameters:
        memberId - Id of member
      • listKeys

        public java.util.List<SecretKey> listKeys​(java.lang.String memberId)
        Get all of a member's keys.
        Specified by:
        listKeys in interface KeyStore
        Parameters:
        memberId - Id of member
        Returns:
        the keys