Class Encryption
java.lang.Object
utils.Encryption
-
Constructor Summary
ConstructorsConstructorDescriptionEncryption(String password, String salt) Encryption(String password, String salt, int iv_size) -
Method Summary
Modifier and TypeMethodDescriptiondecrypt(InputStream inputStream) Decrypts a passed input stream and returns it.decryptionCipher(byte[] IV) Generates a decryption cipherencrypt(InputStream inputStream) Encrypts the provided input stream and returns itencryptionCipher(byte[] IV) Generates an encryption cipher based on the passed IVbyte[]Generates a new IV based on the set size
-
Constructor Details
-
Encryption
- Throws:
EncryptionException
-
Encryption
- Parameters:
password- Passwordsalt- Saltiv_size- IV Size- Throws:
EncryptionException- if the encryption fails
-
-
Method Details
-
generateIV
public byte[] generateIV()Generates a new IV based on the set size- Returns:
- the new IV
-
encrypt
Encrypts the provided input stream and returns it- Parameters:
inputStream- The input stream to encrypt- Returns:
- The encrypted input stream
- Throws:
EncryptionException- if the encryption fails
-
decrypt
Decrypts a passed input stream and returns it. Note that this method will not produce any meaningful output if the IV used on decryption isd different from the one used on encryption- Parameters:
inputStream- The input stream to decrypt- Returns:
- The decrypted input stream
- Throws:
EncryptionException
-
encryptionCipher
Generates an encryption cipher based on the passed IV- Parameters:
IV- The IV to use- Returns:
- The encryption cipher
- Throws:
EncryptionException- If the cipher generation fails
-
decryptionCipher
Generates a decryption cipher- Parameters:
IV- The IV to use- Returns:
- The generated cipher
- Throws:
EncryptionException
-