[Minor] code cleanup in AesCryptoHelper
This commit is contained in:
parent
abf02c3c3d
commit
1c60977bc4
|
@ -80,7 +80,8 @@ public class AesCryptoHelper {
|
|||
|
||||
// read the initialization vector from the normal input stream
|
||||
byte[] initVector = new byte[16];
|
||||
inputStream.read(initVector);
|
||||
if (inputStream.read(initVector) == -1)
|
||||
throw new IllegalStateException("Failed to read init vector!");
|
||||
|
||||
// init cipher
|
||||
Cipher cipher = Cipher.getInstance(CIPHER);
|
||||
|
@ -196,7 +197,6 @@ public class AesCryptoHelper {
|
|||
}
|
||||
|
||||
logger.info("Decrypted file " + encryptedFileS + " to " + decryptedFileS);
|
||||
|
||||
}
|
||||
|
||||
public static void decrypt(char[] password, byte[] salt, InputStream fis, OutputStream fos) {
|
||||
|
@ -219,7 +219,8 @@ public class AesCryptoHelper {
|
|||
|
||||
// read the initialization vector
|
||||
byte[] initVector = new byte[16];
|
||||
fis.read(initVector);
|
||||
if (fis.read(initVector) == -1)
|
||||
throw new IllegalStateException("Failed to read init vector!");
|
||||
|
||||
// init cipher
|
||||
Cipher cipher = Cipher.getInstance(CIPHER);
|
||||
|
@ -248,10 +249,6 @@ public class AesCryptoHelper {
|
|||
return encrypt(password, salt, clearText.getBytes());
|
||||
}
|
||||
|
||||
public static byte[] encrypt(SecretKey secret, byte[] salt, String clearText) {
|
||||
return encrypt(secret, clearText.getBytes());
|
||||
}
|
||||
|
||||
public static byte[] encrypt(char[] password, byte[] salt, byte[] clearTextBytes) {
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue