Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove checkCipherData #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,26 +252,6 @@ private static void checkCipherMode(int mode)
}
}

/**
* Perform simple checks for data to be ciphered: data not <code>null</code> or empty array and length of
* data is multiple of key size.
*
* @param data data to be ciphered and checked, <code>null</code> or empty array not permitted, length of
* data must be multiple of key size
* @param algorithm algorithm of key
* @param keyLength size of key
* @throws IllegalArgumentException if check of data fails
*/
private static void checkCipherData(byte[] data, String algorithm, int keyLength)
{
AssertUtil.notNullOrEmpty(data, "data");
if (data.length % keyLength != 0)
{
throw new IllegalArgumentException("only padded data to multiple of " + algorithm + " key size "
+ keyLength + " permitted, length of data: " + data.length);
}
}

/**
* Constant of separator String for algorithm, block mode and padding at transformation: <tt>/</tt>.
*
Expand Down Expand Up @@ -436,7 +416,6 @@ private static final byte[] cipherAES(String algorithm,
{
checkCipherKey(key, ALGORITHM_AES, KEY_SIZES_LIST_AES);
checkCipherMode(mode);
checkCipherData(data, ALGORITHM_AES, key.getEncoded().length);
Cipher cipher = getCipher(algorithm, key, mode, iv, provider);
return cipher.doFinal(data);
}
Expand Down