Examples of BufferedBlockCipher


Examples of org.bouncycastle.crypto.BufferedBlockCipher

    }

    private BufferedBlockCipher createCipher(boolean encrypt) throws Exception {
        AESEngine blockCipher = new AESEngine();
        CBCBlockCipher cbcCipher = new CBCBlockCipher(blockCipher);
        BufferedBlockCipher cipher = new PaddedBufferedBlockCipher(cbcCipher);
        CipherParameters params = createCipherParams();
        cipher.init(encrypt, params);
        return cipher;
    }
View Full Code Here

Examples of org.bouncycastle.crypto.BufferedBlockCipher

    }

    @Override
    public void decrypt(File encrypted, File output) throws IOException, CryptoException {
        try {
            BufferedBlockCipher cipher = createCipher(false);
            decryptFile(encrypted, output, cipher);
        } catch (InvalidCipherTextException ex) {
            throw new CryptoException(ex.getMessage(), ex);
        }
    }
View Full Code Here

Examples of org.bouncycastle.crypto.BufferedBlockCipher

    }

    @Override
    public byte[] decrypt(byte[] encrypted) throws IOException, CryptoException {
        try {
            BufferedBlockCipher cipher = createCipher(false);
            return decryptBytes(encrypted, cipher);
        } catch (InvalidCipherTextException ex) {
            throw new CryptoException(ex.getMessage(), ex);
        }
    }
View Full Code Here

Examples of org.bouncycastle.crypto.BufferedBlockCipher

    }

    @Override
    public void encrypt(File clearText, File output) throws IOException, CryptoException {
        try {
            BufferedBlockCipher cipher = createCipher(true);
            encryptFile(clearText, output, cipher);
        } catch (InvalidCipherTextException ex) {
            throw new CryptoException(ex.getMessage(), ex);
        }
    }
View Full Code Here

Examples of org.bouncycastle.crypto.BufferedBlockCipher

    }

    @Override
    public byte[] encrypt(byte[] clearText) throws IOException, CryptoException {
        try {
            BufferedBlockCipher cipher = createCipher(true);
            return encryptBytes(clearText, cipher);
        } catch (InvalidCipherTextException ex) {
            throw new CryptoException(ex.getMessage(), ex);
        }
    }
View Full Code Here

Examples of org.bouncycastle.crypto.BufferedBlockCipher

    protected abstract PBEParametersGenerator createPBEParametersGenerator();

    private BufferedBlockCipher createCipher(boolean encrypt) {
        AESEngine blockCipher = new AESEngine();
        CBCBlockCipher cbcCipher = new CBCBlockCipher(blockCipher);
        BufferedBlockCipher cipher = new PaddedBufferedBlockCipher(cbcCipher);
        CipherParameters params = createCipherParams();
        cipher.init(encrypt, params);
        return cipher;
    }
View Full Code Here

Examples of org.bouncycastle2.crypto.BufferedBlockCipher

    {
        String  paddingName = Strings.toUpperCase(padding);

        if (paddingName.equals("NOPADDING"))
        {
            cipher = new BufferedBlockCipher(cipher.getUnderlyingCipher());
        }
        else if (paddingName.equals("PKCS5PADDING") || paddingName.equals("PKCS7PADDING") || paddingName.equals("ISO10126PADDING"))
        {
            cipher = new PaddedBufferedBlockCipher(cipher.getUnderlyingCipher());
        }
View Full Code Here

Examples of org.bouncycastle2.crypto.BufferedBlockCipher

    static public class CFB
        extends JCEBlockCipher
    {
        public CFB()
        {
            super(new BufferedBlockCipher(new CFBBlockCipher(new AESFastEngine(), 128)), 128);
        }
View Full Code Here

Examples of org.bouncycastle2.crypto.BufferedBlockCipher

    static public class OFB
        extends JCEBlockCipher
    {
        public OFB()
        {
            super(new BufferedBlockCipher(new OFBBlockCipher(new AESFastEngine(), 128)), 128);
        }
View Full Code Here

Examples of org.bouncycastle2.crypto.BufferedBlockCipher

            ivLength = baseEngine.getBlockSize();
            if (ivLength < 16)
            {
                throw new IllegalArgumentException("Warning: SIC-Mode can become a twotime-pad if the blocksize of the cipher is too small. Use a cipher with a block size of at least 128 bits (e.g. AES)");
            }
            cipher = new BufferedGenericBlockCipher(new BufferedBlockCipher(
                        new SICBlockCipher(baseEngine)));
        }
        else if (modeName.startsWith("CTR"))
        {
            ivLength = baseEngine.getBlockSize();
            cipher = new BufferedGenericBlockCipher(new BufferedBlockCipher(
                        new SICBlockCipher(baseEngine)));
        }
        else if (modeName.startsWith("GOFB"))
        {
            ivLength = baseEngine.getBlockSize();
            cipher = new BufferedGenericBlockCipher(new BufferedBlockCipher(
                        new GOFBBlockCipher(baseEngine)));
        }
        else if (modeName.startsWith("CTS"))
        {
            ivLength = baseEngine.getBlockSize();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.