Package org.bouncycastle.crypto.modes

Examples of org.bouncycastle.crypto.modes.CBCBlockCipher


    private PaddedBufferedBlockCipher bp;
   
    /** Creates a new instance of AESCipher */
    public AESCipher(boolean forEncryption, byte[] key, byte[] iv) {
        BlockCipher aes = new AESFastEngine();
        BlockCipher cbc = new CBCBlockCipher(aes);
        bp = new PaddedBufferedBlockCipher(cbc);
        KeyParameter kp = new KeyParameter(key);
        ParametersWithIV piv = new ParametersWithIV(kp, iv);
        bp.init(forEncryption, piv);
    }
View Full Code Here


    private BlockCipher cbc;
   
    /** Creates a new instance of AESCipher */
    public AESCipherCBCnoPad(boolean forEncryption, byte[] key) {
        BlockCipher aes = new AESFastEngine();
        cbc = new CBCBlockCipher(aes);
        KeyParameter kp = new KeyParameter(key);
        cbc.init(forEncryption, kp);
    }
View Full Code Here

        if ((macSizeInBits % 8) != 0)
        {
            throw new IllegalArgumentException("MAC size must be multiple of 8");
        }

        this.cipher = new CBCBlockCipher(cipher);
        this.padding = padding;
        this.macSize = macSizeInBits / 8;

        mac = new byte[cipher.getBlockSize()];
View Full Code Here

        if (!(cipher instanceof DESEngine))
        {
            throw new IllegalArgumentException("cipher must be instance of DESEngine");
        }

        this.cipher = new CBCBlockCipher(cipher);
        this.padding = padding;
        this.macSize = macSizeInBits / 8;

        mac = new byte[cipher.getBlockSize()];
View Full Code Here

        if ((macSizeInBits % 8) != 0)
        {
            throw new IllegalArgumentException("MAC size must be multiple of 8");
        }

        this.cipher = new CBCBlockCipher(cipher);
        this.macSize = macSizeInBits / 8;

        mac = new byte[cipher.getBlockSize()];

        buf = new byte[cipher.getBlockSize()];
View Full Code Here

    */
    public void init(boolean forWrapping, CipherParameters param)
    {

        this.forWrapping = forWrapping;
        this.engine = new CBCBlockCipher(new DESedeEngine());

        if (param instanceof KeyParameter)
        {
            this.param = (KeyParameter)param;

View Full Code Here

        /*
         * Setup the DESede cipher engine, create a PaddedBufferedBlockCipher
         * in CBC mode.
         */
        cipher = new PaddedBufferedBlockCipher(
                                    new CBCBlockCipher(new DESedeEngine()));

        /*
         * The input and output streams are currently set up
         * appropriately, and the key bytes are ready to be
         * used.
 
View Full Code Here

  /**
   * Initialize the cryptographic engine.
   * @param aKey
   */
  public JSignEncryptor(final byte[] aKey) {
    cipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new BlowfishEngine()));
    key = new KeyParameter(aKey);
  }
View Full Code Here

        if (!result.isSuccessful())
        {
            return result;
        }

        test = new CTSTester(2, new CBCBlockCipher(new DESEngine()), new ParametersWithIV(new KeyParameter(key1), iv), in1, out2);
        result = test.perform();

        if (!result.isSuccessful())
        {
            return result;
        }

        test = new CTSTester(3, new CBCBlockCipher(new SkipjackEngine()), new ParametersWithIV(new KeyParameter(key2), iv), in2, out3);
        result = test.perform();

        if (!result.isSuccessful())
        {
            return result;
View Full Code Here

        return "PKCS5S2";
    }

    public TestResult perform()
    {
        BufferedBlockCipher cipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new DESEngine()));
        Test                test = new PBETest(0, cipher, sample1, 64);
        TestResult          result = test.perform();

        if (!result.isSuccessful())
        {
            return new SimpleTestResult(false, getName() + ": " + result.toString());
        }

        cipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new DESedeEngine()));
        test = new PBETest(1, cipher, sample2, 192);
        result = test.perform();

        if (!result.isSuccessful())
        {
            return new SimpleTestResult(false, getName() + ": " + result.toString());
        }

        cipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new RC2Engine()));
        test = new PBETest(2, cipher, sample3, 0);
        result = test.perform();

        if (!result.isSuccessful())
        {
View Full Code Here

TOP

Related Classes of org.bouncycastle.crypto.modes.CBCBlockCipher

Copyright © 2018 www.massapicom. 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.