Package io.token.security
Class UnsecuredFileSystemKeyStore
- java.lang.Object
-
- io.token.security.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.
-
-
Constructor Summary
Constructors Constructor Description UnsecuredFileSystemKeyStore(java.io.File keyStoreRoot)
Creates a new key store with the default clock.UnsecuredFileSystemKeyStore(java.io.File keyStoreRoot, Clock clock)
Creates a new key store.
-
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.
-
-
-
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.
-
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 interfaceKeyStore
- Parameters:
memberId
- member IDkeyLevel
-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.
-
deleteKeys
public void deleteKeys(java.lang.String memberId)
Deletes keys for a specific member.- Specified by:
deleteKeys
in interfaceKeyStore
- Parameters:
memberId
- Id of member
-
-