Examples of ParametersWithIV


Examples of org.apache.geronimo.crypto.crypto.params.ParametersWithIV

    {
        this.encrypting = encrypting;
       
        if (params instanceof ParametersWithIV)
        {
                ParametersWithIV ivParam = (ParametersWithIV)params;
                byte[]      iv = ivParam.getIV();

                if (iv.length != blockSize)
                {
                    throw new IllegalArgumentException("initialisation vector must be the same length as block size");
                }

                System.arraycopy(iv, 0, IV, 0, iv.length);

                reset();

                cipher.init(encrypting, ivParam.getParameters());
        }
        else
        {
                reset();
View Full Code Here

Examples of org.apache.geronimo.util.crypto.params.ParametersWithIV

    {
        this.encrypting = encrypting;
       
        if (params instanceof ParametersWithIV)
        {
                ParametersWithIV ivParam = (ParametersWithIV)params;
                byte[]      iv = ivParam.getIV();

                if (iv.length != blockSize)
                {
                    throw new IllegalArgumentException("initialisation vector must be the same length as block size");
                }

                System.arraycopy(iv, 0, IV, 0, iv.length);

                reset();

                cipher.init(encrypting, ivParam.getParameters());
        }
        else
        {
                reset();
View Full Code Here

Examples of org.bouncycastle.crypto.params.ParametersWithIV

    {
        this.encrypting = encrypting;
       
        if (params instanceof ParametersWithIV)
        {
                ParametersWithIV ivParam = (ParametersWithIV)params;
                byte[]      iv = ivParam.getIV();

                if (iv.length < IV.length)
                {
          // prepend the supplied IV with zeros (per FIPS PUB 81)
                    System.arraycopy(iv, 0, IV, IV.length - iv.length, iv.length);
          for (int i = 0; i < IV.length - iv.length; i++)
          {
            IV[i] = 0;
          }
                }
                else
                {
                    System.arraycopy(iv, 0, IV, 0, IV.length);
                }

                reset();

                cipher.init(true, ivParam.getParameters());
        }
        else
        {
                reset();
View Full Code Here

Examples of org.bouncycastle.crypto.params.ParametersWithIV

    {
        this.forEncryption = forEncryption;
    
        if (params instanceof ParametersWithIV)
        {
                ParametersWithIV ivParam = (ParametersWithIV)params;
                byte[]      iv = ivParam.getIV();

                if (iv.length < IV.length)
                {
                    // prepend the supplied IV with zeros (per FIPS PUB 81)
                    System.arraycopy(iv, 0, IV, IV.length - iv.length, iv.length);
                    for (int i = 0; i < IV.length - iv.length; i++)
                    {
                            IV[i] = 0;
                    }
                }
                else
                {
                    System.arraycopy(iv, 0, IV, 0, IV.length);
                }

                reset();

                cipher.init(true, ivParam.getParameters());
        }
        else
        {
                reset();
View Full Code Here

Examples of org.bouncycastle.crypto.params.ParametersWithIV

    {
        this.encrypting = encrypting;
       
        if (params instanceof ParametersWithIV)
        {
                ParametersWithIV ivParam = (ParametersWithIV)params;
                byte[]      iv = ivParam.getIV();

                if (iv.length < IV.length)
                {
          // prepend the supplied IV with zeros (per FIPS PUB 81)
                    System.arraycopy(iv, 0, IV, IV.length - iv.length, iv.length);
          for (int i = 0; i < IV.length - iv.length; i++)
          {
            IV[i] = 0;
          }
                }
                else
                {
                    System.arraycopy(iv, 0, IV, 0, IV.length);
                }

                reset();

                cipher.init(true, ivParam.getParameters());
        }
        else
        {
                reset();
View Full Code Here

Examples of org.bouncycastle.crypto.params.ParametersWithIV

  public void init(boolean forEncryption, CipherParameters params)
      throws IllegalArgumentException {
    this.encrypting = forEncryption;

    if (params instanceof ParametersWithIV) {
      ParametersWithIV ivParam = (ParametersWithIV)params;
      byte[]           iv      = ivParam.getIV();
      System.arraycopy(iv, 0, IV, 0, IV.length);

      reset();
      cipher.init(true, ivParam.getParameters());
    }
  }
View Full Code Here

Examples of org.bouncycastle.crypto.params.ParametersWithIV

    {
        this.encrypting = encrypting;
       
        if (params instanceof ParametersWithIV)
        {
                ParametersWithIV ivParam = (ParametersWithIV)params;
                byte[]      iv = ivParam.getIV();

                if (iv.length != blockSize)
                {
                    throw new IllegalArgumentException("initialisation vector must be the same length as block size");
                }

                System.arraycopy(iv, 0, IV, 0, iv.length);

                reset();

                cipher.init(encrypting, ivParam.getParameters());
        }
        else
        {
                reset();
View Full Code Here

Examples of org.bouncycastle.crypto.params.ParametersWithIV

        byte[]  dKey = generateDerivedKey(KEY_MATERIAL, keySize);

        byte[]  iv = generateDerivedKey(IV_MATERIAL, ivSize);

        return new ParametersWithIV(new KeyParameter(dKey, 0, keySize), iv, 0, ivSize);
    }
View Full Code Here

Examples of org.bouncycastle.crypto.params.ParametersWithIV

          if(!verifyHeader()){
            throw new GeneralSecurityException("MAC is incorrect");
          }
        }
        ParametersWithIV tempPram = null;
        try{
            KeyParameter cipherKey = new KeyParameter(KeyGenUtils.deriveSecretKey(unencryptedBaseKey,
              getClass(), kdfInput.underlyingKey.input,
              type.encryptKey).getEncoded());
            tempPram = new ParametersWithIV(cipherKey,
              KeyGenUtils.deriveIvParameterSpec(unencryptedBaseKey, getClass(),
                  kdfInput.underlyingIV.input, type.encryptKey).getIV());
        } catch(InvalidKeyException e) {
            throw new IllegalStateException(e); // Must be a bug.
        }
View Full Code Here

Examples of org.bouncycastle.crypto.params.ParametersWithIV

                  SecureRandom rng = NodeStarter.getGlobalSecureRandom();
                  rng.nextBytes(key);
                  rng.nextBytes(iv);
                  AESFastEngine e = new AESFastEngine();
                  SICBlockCipher ctr = new SICBlockCipher(e);
                  ctr.init(true, new ParametersWithIV(new KeyParameter(key),iv));
                  cis = new CipherInputStream(zis, new BufferedBlockCipher(ctr));
                  cisCounter = 0;
              }
              read = cis.read(buffer, 0, ((remaining > BUFFER_SIZE) || (remaining == -1)) ? BUFFER_SIZE : (int) remaining);
              cisCounter += read;
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.