Search in sources :

Example 1 with CamelliaEngine

use of org.bouncycastle.crypto.engines.CamelliaEngine in project rxlib by RockyLOMO.

the class CamelliaCrypt method getCipher.

@Override
protected StreamBlockCipher getCipher(boolean isEncrypted) throws InvalidAlgorithmParameterException {
    CamelliaEngine engine = new CamelliaEngine();
    StreamBlockCipher cipher;
    if (_name.equals(CIPHER_CAMELLIA_128_CFB)) {
        cipher = new CFBBlockCipher(engine, getIVLength() * 8);
    } else if (_name.equals(CIPHER_CAMELLIA_192_CFB)) {
        cipher = new CFBBlockCipher(engine, getIVLength() * 8);
    } else if (_name.equals(CIPHER_CAMELLIA_256_CFB)) {
        cipher = new CFBBlockCipher(engine, getIVLength() * 8);
    } else {
        throw new InvalidAlgorithmParameterException(_name);
    }
    return cipher;
}
Also used : StreamBlockCipher(org.bouncycastle.crypto.StreamBlockCipher) CFBBlockCipher(org.bouncycastle.crypto.modes.CFBBlockCipher) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) CamelliaEngine(org.bouncycastle.crypto.engines.CamelliaEngine)

Aggregations

InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1 StreamBlockCipher (org.bouncycastle.crypto.StreamBlockCipher)1 CamelliaEngine (org.bouncycastle.crypto.engines.CamelliaEngine)1 CFBBlockCipher (org.bouncycastle.crypto.modes.CFBBlockCipher)1