public class PublicKeyMapper extends AbstractDatabaseMapper implements IPublicKeySource
OFS and DataAccess. All create, read, update, and delete
operations are handled by the mapper.| Constructor and Description |
|---|
PublicKeyMapper(KeyRing keyRing,
DataAccess dataAccess,
OFS ofs)
Create a PublicKey mapper for the
OFS and data access. |
| Modifier and Type | Method and Description |
|---|---|
void |
create(UUID userId,
IndexedECPublicKey publicKey)
Creates a data access entry for the given user ID and public key.
|
void |
delete(UUID userId,
Integer index,
KeyType type,
Boolean active)
Deletes public key records from the data access.
|
com.google.common.collect.ListMultimap<UUID,IndexedECPublicKey> |
get(UUID userId,
Integer index,
KeyType type,
Boolean active)
Gets a map of user IDs and public keys from the data access and the key ring if applicable.
|
com.google.common.collect.ListMultimap<UUID,IndexedECPublicKey> |
getAll()
Gets a map of all user IDs and public keys from the data access and the key ring if applicable.
|
IndexedECPublicKey |
getByIndex(UUID userId,
KeyType type,
int index)
This gets the public key that match the user ID, type and inde.
|
IndexedECPublicKey |
getLatestActive(UUID userId,
KeyType type)
This gets the latest active public key that match the user ID and type.
|
void |
update(UUID userId,
IndexedECPublicKey publicKey)
Updates a data access entry for the given user ID and public key.
|
getDataAccessgetKeyRing, getOfs, setKeyRingpublic PublicKeyMapper(KeyRing keyRing, DataAccess dataAccess, OFS ofs) throws NoSuchAlgorithmException
OFS and data access.keyRing - the key ringdataAccess - the data access for storing/retrieving the public keysofs - the OFS for storing/retrieving the data accessNoSuchAlgorithmException - thrown if an error occurs initializing the encryption enginepublic void create(UUID userId, IndexedECPublicKey publicKey) throws SQLException
userId - the user ID of the public keypublicKey - the public key to storeSQLException - thrown if an error occurs while storing the public keypublic void delete(UUID userId, Integer index, KeyType type, Boolean active) throws SQLException
userId - the user ID's public keys to deleteindex - the key index to deletetype - the key type to deleteactive - the active state to deleteSQLException - thrown if an error occurs while deleting the public keypublic com.google.common.collect.ListMultimap<UUID,IndexedECPublicKey> get(UUID userId, Integer index, KeyType type, Boolean active) throws SQLException, InvalidKeySpecException
userId - the user ID to filterindex - the key index to filtertype - the key type to filteractive - the active state to filterSQLException - thrown if an error occurs accessing the data accessInvalidKeySpecException - thrown if an error occurs decoding a stored keypublic com.google.common.collect.ListMultimap<UUID,IndexedECPublicKey> getAll() throws SQLException, InvalidKeySpecException
SQLException - thrown if an error occurs accessing the data accessInvalidKeySpecException - thrown if an error occurs decoding a stored keypublic IndexedECPublicKey getByIndex(UUID userId, KeyType type, int index) throws Exception
IPublicKeySourcegetByIndex in interface IPublicKeySourceuserId - the user id of the key ownertype - the KeyType of the keyindex - the index of the keyIndexedECPublicKey for the user of the specified KeyType and indexException - left open ended to allow the implementer to be less restrictivepublic IndexedECPublicKey getLatestActive(UUID userId, KeyType type) throws Exception
IPublicKeySourceNOTE: if there is not an active key null will be returned.
getLatestActive in interface IPublicKeySourceuserId - the user's IDtype - the KeyType of public keyKeyTypeException - left open ended to allow the implementer to be less restrictivepublic void update(UUID userId, IndexedECPublicKey publicKey) throws SQLException
userId - the user ID of the public keypublicKey - the public key to storeSQLException - thrown if an error occurs while updating the public keyCopyright © 2021. All rights reserved.