Package org.bouncycastle.crypto.modes

Examples of org.bouncycastle.crypto.modes.CBCBlockCipher


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

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

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

         if (this.forWrapping) {
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

        //
        // twofish with IV0 test
        //
        BufferedBlockCipher c1 = new PaddedBufferedBlockCipher(
                                    new CBCBlockCipher(new TwofishEngine()));
        BufferedBlockCipher c2 = new PaddedBufferedBlockCipher(
                                    new CBCBlockCipher(new TwofishEngine()));
        i1 = new IESEngine(
                       new ECDHBasicAgreement(),
                       new KDF2BytesGenerator(new SHA1Digest()),
                       new HMac(new SHA1Digest()),
                       c1);
View Full Code Here

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

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

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

         if (this.forWrapping) {
View Full Code Here

      tmp=new byte[bsize];
      System.arraycopy(key, 0, tmp, 0, tmp.length);
      key=tmp;
    }
    try{
      cipher=new CBCBlockCipher(new BlowfishEngine());
      CipherParameters param=new ParametersWithIV(new KeyParameter(key), iv);
      if(mode==ENCRYPT_MODE){ cipher.init(true, param); }
      else{ cipher.init(false, param); }
    }
    catch(Exception e){
View Full Code Here

      byte[] tmp=new byte[bsize];
      System.arraycopy(key, 0, tmp, 0, tmp.length);
      key=tmp;
    }
    try{
      cipher=new CBCBlockCipher(new DESedeEngine());
      CipherParameters param=new ParametersWithIV(new KeyParameter(key), iv);

      if(mode==ENCRYPT_MODE){ cipher.init(true, param); }
      else{ cipher.init(false, param); }
    }
View Full Code Here

            new SHA1Digest(), new SHA1Digest(), cipherKeySize, keyExchange);
    }

    private static CBCBlockCipher createAESCipher()
    {
        return new CBCBlockCipher(new AESFastEngine());
    }
View Full Code Here

        return new CBCBlockCipher(new AESFastEngine());
    }
   
    private static CBCBlockCipher createDESedeCipher()
    {
        return new CBCBlockCipher(new DESedeEngine());
    }
View Full Code Here

    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

    static public class DESCBC
        extends JCEBlockCipher
    {
        public DESCBC()
        {
            super(new CBCBlockCipher(new DESEngine()), 64);
        }
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.