Search in sources :

Example 1 with StreamBlockCipher

use of org.bouncycastle.crypto.StreamBlockCipher in project rxlib by RockyLOMO.

the class BlowFishCrypt method getCipher.

@Override
protected StreamBlockCipher getCipher(boolean isEncrypted) throws InvalidAlgorithmParameterException {
    BlowfishEngine engine = new BlowfishEngine();
    StreamBlockCipher cipher;
    if (_name.equals(CIPHER_BLOWFISH_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) BlowfishEngine(org.bouncycastle.crypto.engines.BlowfishEngine)

Example 2 with StreamBlockCipher

use of org.bouncycastle.crypto.StreamBlockCipher in project rxlib by RockyLOMO.

the class AesCrypt method getCipher.

@Override
protected StreamBlockCipher getCipher(boolean isEncrypted) throws InvalidAlgorithmParameterException {
    AESFastEngine engine = new AESFastEngine();
    StreamBlockCipher cipher;
    if (_name.equals(CIPHER_AES_128_CFB)) {
        cipher = new CFBBlockCipher(engine, getIVLength() * 8);
    } else if (_name.equals(CIPHER_AES_192_CFB)) {
        cipher = new CFBBlockCipher(engine, getIVLength() * 8);
    } else if (_name.equals(CIPHER_AES_256_CFB)) {
        cipher = new CFBBlockCipher(engine, getIVLength() * 8);
    } else if (_name.equals(CIPHER_AES_128_OFB)) {
        cipher = new OFBBlockCipher(engine, getIVLength() * 8);
    } else if (_name.equals(CIPHER_AES_192_OFB)) {
        cipher = new OFBBlockCipher(engine, getIVLength() * 8);
    } else if (_name.equals(CIPHER_AES_256_OFB)) {
        cipher = new OFBBlockCipher(engine, getIVLength() * 8);
    } else {
        throw new InvalidAlgorithmParameterException(_name);
    }
    return cipher;
}
Also used : StreamBlockCipher(org.bouncycastle.crypto.StreamBlockCipher) OFBBlockCipher(org.bouncycastle.crypto.modes.OFBBlockCipher) CFBBlockCipher(org.bouncycastle.crypto.modes.CFBBlockCipher) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) AESFastEngine(org.bouncycastle.crypto.engines.AESFastEngine)

Example 3 with StreamBlockCipher

use of org.bouncycastle.crypto.StreamBlockCipher 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)

Example 4 with StreamBlockCipher

use of org.bouncycastle.crypto.StreamBlockCipher in project rxlib by RockyLOMO.

the class SeedCrypt method getCipher.

@Override
protected StreamBlockCipher getCipher(boolean isEncrypted) throws InvalidAlgorithmParameterException {
    SEEDEngine engine = new SEEDEngine();
    StreamBlockCipher cipher;
    if (_name.equals(CIPHER_SEED_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) SEEDEngine(org.bouncycastle.crypto.engines.SEEDEngine)

Aggregations

InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)4 StreamBlockCipher (org.bouncycastle.crypto.StreamBlockCipher)4 CFBBlockCipher (org.bouncycastle.crypto.modes.CFBBlockCipher)4 AESFastEngine (org.bouncycastle.crypto.engines.AESFastEngine)1 BlowfishEngine (org.bouncycastle.crypto.engines.BlowfishEngine)1 CamelliaEngine (org.bouncycastle.crypto.engines.CamelliaEngine)1 SEEDEngine (org.bouncycastle.crypto.engines.SEEDEngine)1 OFBBlockCipher (org.bouncycastle.crypto.modes.OFBBlockCipher)1