org.bouncycastle.crypto.modes.AESCFBModePacketCipher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-lts8on Show documentation
Show all versions of bcprov-lts8on Show documentation
The Long Term Stable (LTS) Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains the JCA/JCE provider and low-level API for the BC LTS version 2.73.7 for Java 8 and later.
package org.bouncycastle.crypto.modes;
import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.ExceptionMessages;
import org.bouncycastle.crypto.PacketCipher;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV;
public interface AESCFBModePacketCipher
extends PacketCipher
{
default void checkCFBParameter(CipherParameters parameters)
{
if (parameters instanceof ParametersWithIV)
{
KeyParameter param = (KeyParameter)((ParametersWithIV)parameters).getParameters();
if (param == null)
{
throw new IllegalArgumentException(ExceptionMessages.CFB_CIPHER_UNITIALIZED);
}
int keyLen = param.getKeyLength();
if (keyLen < 16 || keyLen > 32 || (keyLen & 7) != 0)
{
throw new IllegalArgumentException(ExceptionMessages.AES_KEY_LENGTH);
}
}
else
{
throw new IllegalArgumentException(ExceptionMessages.CFB_CIPHER_UNITIALIZED);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy