Package eirb.pub.app.vault
Class CipherKey
java.lang.Object
eirb.pub.app.vault.CipherKey
-
Constructor Summary
ConstructorsConstructorDescriptionCipherKey(byte[] contentByte) Create a CipherKey object based on it's encrypted version (retrieved from a VaultFile for example) Decomposed as follows : hash|cipher The hash is 32 bytes longCipherKey(Key greenKeyToEncrypt, Key key, InitializationVector initVector) Create a cipherKey based on the information wanted inside. -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]concat(byte[] tab1, byte[] tab2) Concatenate two arrays togetherbyte[]getBytes()Get the byte representation of the ciphered keyRetrieve the InitializationVector from the CipherKeygetVaultKey(Key yellowKey) Retrieve the VaultKey from the CipherKey
-
Constructor Details
-
CipherKey
public CipherKey(Key greenKeyToEncrypt, Key key, InitializationVector initVector) throws CipherException Create a cipherKey based on the information wanted inside. No plain is stored in this object, only the cipher version is stored in this object. Field can be retrieved with the appropriate methods (getIV, getVaultKey)- Parameters:
greenKeyToEncrypt- vaultKey that will be encryptedkey- Key used for encryption of the fieldsinitVector- Initialization vector that will be encrypted- Throws:
CipherException- when an encryption error occurred
-
CipherKey
public CipherKey(byte[] contentByte) Create a CipherKey object based on it's encrypted version (retrieved from a VaultFile for example) Decomposed as follows : hash|cipher The hash is 32 bytes long- Parameters:
contentByte- byte representation of the ciphered JSON with VaultKey and Iv stored inside with the hash at the beginning
-
-
Method Details
-
getIV
Retrieve the InitializationVector from the CipherKey- Parameters:
yellowKey- key to decrypt the CipherKey- Returns:
- Initialization vector stored in the cipher representation of the key
- Throws:
KeyException- If the provided key is not able to decrypt the cipherKey
-
getVaultKey
Retrieve the VaultKey from the CipherKey- Parameters:
yellowKey- key to decrypt the CipherKey- Returns:
- Vault Key stored in the cipher representation of the key
- Throws:
KeyException- If the provided key is not able to decrypt the cipherKey
-
concat
public static byte[] concat(byte[] tab1, byte[] tab2) Concatenate two arrays together- Parameters:
tab1- first arraytab2- second array- Returns:
- array tab1|tab2
-
getBytes
public byte[] getBytes()Get the byte representation of the ciphered key- Returns:
- byte representation (hash|cipher) of the CipherKey
-