8251117: Cannot check P11Key size in P11Cipher and P11AEADCipher
Reviewed-by: valeriep
This commit is contained in:
parent
ed5696dd2c
commit
1cc09ccaef
@ -280,7 +280,9 @@ final class P11AEADCipher extends CipherSpi {
|
||||
SecureRandom sr)
|
||||
throws InvalidKeyException, InvalidAlgorithmParameterException {
|
||||
reset(true);
|
||||
if (fixedKeySize != -1 && key.getEncoded().length != fixedKeySize) {
|
||||
if (fixedKeySize != -1 &&
|
||||
((key instanceof P11Key) ? ((P11Key) key).length() >> 3 :
|
||||
key.getEncoded().length) != fixedKeySize) {
|
||||
throw new InvalidKeyException("Key size is invalid");
|
||||
}
|
||||
P11Key newKey = P11SecretKeyFactory.convertKey(token, key, ALGO);
|
||||
|
@ -345,7 +345,9 @@ final class P11Cipher extends CipherSpi {
|
||||
SecureRandom random)
|
||||
throws InvalidKeyException, InvalidAlgorithmParameterException {
|
||||
reset(true);
|
||||
if (fixedKeySize != -1 && key.getEncoded().length != fixedKeySize) {
|
||||
if (fixedKeySize != -1 &&
|
||||
((key instanceof P11Key) ? ((P11Key) key).length() >> 3 :
|
||||
key.getEncoded().length) != fixedKeySize) {
|
||||
throw new InvalidKeyException("Key size is invalid");
|
||||
}
|
||||
switch (opmode) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user