Package eirb.pub.app.vault
Class CipherVault
java.lang.Object
eirb.pub.app.vault.CipherVault
-
Constructor Summary
ConstructorsConstructorDescriptionCipherVault(byte[] bytes) Initialize a CipherVault based on its byte representation -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic CipherVaultemptyCipherVault(Key vaultKey, InitializationVector iv) Get an empty cipher Vault that represent an empty PlainVault encryptedbyte[]getBytes()Get the byte representation of the CipherVault.voidlock()Clear the memory of the CipherVault.voidvoidsetFrom(CipherVault cipherVault) unlock(Key k, InitializationVector iv) Get the PlainVault by decrypting the cipherVault All modifications made on the PlainVault are linked to the CipherVault object So when you get the byte representation of the CipherVault, it will represent the PlainVault encrypted with AES CBC
-
Constructor Details
-
CipherVault
public CipherVault(byte[] bytes) Initialize a CipherVault based on its byte representation- Parameters:
bytes- cipher representation of the vault
-
-
Method Details
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener) throws NullPlainVaultSyncException - Throws:
NullPlainVaultSyncException
-
removePropertyChangeListener
-
unlock
public PlainVault unlock(Key k, InitializationVector iv) throws CipherException, CipherVaultException Get the PlainVault by decrypting the cipherVault All modifications made on the PlainVault are linked to the CipherVault object So when you get the byte representation of the CipherVault, it will represent the PlainVault encrypted with AES CBCWhen a CipherVault is unlocked, the vault key and the initialization vector is stored in the object in plain. To clean the memory use the lock method
- Parameters:
k- Key to decrypt the Vaultiv- Initialization vector used for CBC- Returns:
- PlainVault representation of the CipherVault
- Throws:
CipherException- If the decryption failedCipherVaultException- If the decryption succeeded but the decrypted byte do not represent a correct PlainVault
-
lock
Clear the memory of the CipherVault. If it was unlocked before, will remove the key, iv and PlainVault from the memory.All PlainVault objects retrieved by unlock method will no longer work/be linked to the CipherVault
- Throws:
VaultException- If the plainVault failed to be converted into byte for encryptionCipherException- If an error occurred during the encryption
-
getBytes
Get the byte representation of the CipherVault. If modification where made on the PlainVault, the vault will be encrypted again.- Returns:
- byte representation
- Throws:
VaultException- If the plainVault failed to be converted into byte for encryptionCipherException- If an error occurred during the encryption process
-
emptyCipherVault
public static CipherVault emptyCipherVault(Key vaultKey, InitializationVector iv) throws VaultException, CipherException Get an empty cipher Vault that represent an empty PlainVault encrypted- Parameters:
vaultKey- key used for encryptioniv- Initialization vector used for CBC- Returns:
- CipherVault representing an empty PlainVault
- Throws:
VaultException- If the plainVault failed to be converted into byte for encryptionCipherException- If an error occurred during the encryption process
-
setFrom
- Throws:
CipherExceptionVaultException
-