Class KeyStoreHelper
java.lang.Object
com.amilesend.client.crypto.KeyStoreHelper
Helper that manages storage of symmetric keys to a key store file.
- 
Constructor SummaryConstructorsConstructorDescriptionKeyStoreHelper(@NonNull Path keyStorePath, char @NonNull [] keyStorePassword) Creates a newKeyStoreHelperinstance.
- 
Method SummaryModifier and TypeMethodDescriptiongetSecretKey(String alias, char @NonNull [] keyPassword) Gets the key with the givenaliasand associatedkeyPasswordfrom the key store.voidsaveSecretKey(String alias, @NonNull SecretKey key, char @NonNull [] keyPassword) Saves the givenkeyto the key store.
- 
Constructor Details- 
KeyStoreHelperCreates a newKeyStoreHelperinstance.- Parameters:
- keyStorePath- The path to the key store used to store the symmetric key used for encryption.
- keyStorePassword- The password to access the key store.
 
 
- 
- 
Method Details- 
saveSecretKeypublic void saveSecretKey(String alias, @NonNull SecretKey key, char @NonNull [] keyPassword) throws KeyStoreHelperException Saves the givenkeyto the key store. Notes:- The key is referenced by the aliasand is individually protected via the givenkeyPassword.
- If the key store file does not exist, this method attempts
    to create a new key store to the defined keyStorePathprior to saving the key.
 - Parameters:
- alias- the alias to store the key as
- key- the key itself
- keyPassword- the password that is specific to the key
- Throws:
- KeyStoreHelperException- if an error occurred while saving the key to the key store
 
- The key is referenced by the 
- 
getSecretKeypublic SecretKey getSecretKey(String alias, char @NonNull [] keyPassword) throws KeyStoreHelperException Gets the key with the givenaliasand associatedkeyPasswordfrom the key store. Notes:- If the key store file does not exist, then this method attempts to create a new key store to the defined
    keyStorePath. In this case,nullwill be returned as the givenaliasreferences no existing key.
- If the key does not exist for the given alias, thennullwill be returned.
 - Parameters:
- alias- the alias for the key
- keyPassword- the associated password that protects the key
- Returns:
- the key, or null
- Throws:
- KeyStoreHelperException- if an error occurred while retrieving the key
 
- If the key store file does not exist, then this method attempts to create a new key store to the defined
    
 
-