Package eirb.pub.app.vault
Class VaultFile
java.lang.Object
eirb.pub.app.vault.VaultFile
- Direct Known Subclasses:
ServerVaultFile
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic VaultFileemptyVaultFile(String name, String password) Create a new VaultFile object with a name, lock with a passwordGet an InputStream object that represent the vaultFile and can be used to be saved in a file for examplegetName()Get the name of the vault FileRetrieve vault (plain) with a password Will get the vault key from the ciphers key with a key generated with a password and unlock the cipher vault with the previously obtained Vault Key and ivvoidlock()Lock the vault, that means that the previous PlainVault generated by getVault will not work anymore.voidvoidsaveToFile(Path filePath) Save VaultFile in the file systemvoidupdate important elements of cypherVault
-
Constructor Details
-
VaultFile
-
VaultFile
Create a VaultFile object based on a file- Parameters:
filePath- location of the file- Throws:
VaultFileIOException- when a IO operation failed during file parsingVaultFileFormatException- if the provided file do not respect the requirements
-
-
Method Details
-
addPropertyChangeListener
-
removePropertyChangeListener
-
emptyVaultFile
public static VaultFile emptyVaultFile(String name, String password) throws VaultFileGenerationException Create a new VaultFile object with a name, lock with a password- Parameters:
name- name of the new Vaultpassword- for the vault- Returns:
- VaultFile
- Throws:
NullPointerException- if no string or no password is providedVaultFileGenerationException
-
getVault
Retrieve vault (plain) with a password Will get the vault key from the ciphers key with a key generated with a password and unlock the cipher vault with the previously obtained Vault Key and iv- Parameters:
password- user password- Returns:
- plain vault
- Throws:
PasswordException- if the password don't unlock any cipher keyCipherVaultException- when the decryption of the vault with the vault key didn't work
-
lock
Lock the vault, that means that the previous PlainVault generated by getVault will not work anymore. PlainVault memory will be safely delete. You have to unlock (with getVault) again.- Throws:
VaultFileGenerationException- when an encryption error occurred during the locking process
-
saveToFile
Save VaultFile in the file system- Parameters:
filePath- path for saving- Throws:
VaultFileIOException- if the writing operation failed
-
getInputStream
Get an InputStream object that represent the vaultFile and can be used to be saved in a file for example- Returns:
- representation of the VaultFile as an InputStream
-
getName
Get the name of the vault File- Returns:
- vault name
-
setFrom
update important elements of cypherVault- Throws:
CipherExceptionVaultException
-