public class CryptoSingleton
extends java.lang.Object
Constructor and Description |
---|
CryptoSingleton() |
Modifier and Type | Method and Description |
---|---|
static Crypto |
getCrypto()
Returns the current Crypto instance
|
static void |
resetCrypto()
Resets the Crypto instance (when the user logs out)
|
static void |
setup(java.security.KeyPair keyPair)
Creates a new Crypto instance used in tests
|
static void |
setupCryptoForUser(User user)
Creates a new Crypto instance when user logs in, which fetches all the required key information
|
static void |
setupCryptoForUser(User user,
DatabaseConnection databaseConnection)
Creates a new Crypto instance when user logs in, which fetches all the required key information
|
static void |
updateUserKeys(User oldUser,
User updatedUser)
Regenerates the user's keys, stores the new information and creates a new Crypto instance
with the new keys.
|
static void |
updateUserKeys(User oldUser,
User updatedUser,
DatabaseConnection databaseConnection)
Regenerates the user's keys, stores the new information and creates a new Crypto instance
with the new keys.
|
private static Crypto crypto
public static Crypto getCrypto()
public static void setupCryptoForUser(User user) throws DatabaseException, DatabaseConnectionException
user
- DatabaseException
DatabaseConnectionException
public static void setupCryptoForUser(User user, DatabaseConnection databaseConnection) throws DatabaseException
user
- databaseConnection
- DatabaseException
public static void resetCrypto()
public static void setup(java.security.KeyPair keyPair)
public static void updateUserKeys(User oldUser, User updatedUser) throws DatabaseException, DatabaseConnectionException
oldUser
- updatedUser
- DatabaseException
DatabaseConnectionException
public static void updateUserKeys(User oldUser, User updatedUser, DatabaseConnection databaseConnection) throws DatabaseException
oldUser
- updatedUser
- databaseConnection
- DatabaseException