public void init(boolean encrypting,CipherParameters params) throws IllegalArgumentException {
  if (params instanceof ParametersWithIV) {
    ParametersWithIV ivParam=(ParametersWithIV)params;
    byte[] iv=ivParam.getIV();
    if (iv.length < IV.length) {
      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();
    if (ivParam.getParameters() != null) {
      cipher.init(true,ivParam.getParameters());
    }
  }
 else {
    reset();
    if (params != null) {
      cipher.init(true,params);
    }
  }
}

public void init ( boolean encrypting , CipherParameters params ) throws IllegalArgumentException { if ( params instanceof ParametersWithIV ) { ParametersWithIV ivParam = ( ParametersWithIV ) params ; byte [ ] iv = ivParam . getIV ( ) ; if ( iv . length < IV . length ) { 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 ( ) ; if ( ivParam . getParameters ( ) != null ) { cipher . init ( true , ivParam . getParameters ( ) ) ; } } else { reset ( ) ; if ( params != null ) { cipher . init ( true , params ) ; } } }
initialise the cipher and , possibly , the initialisation vector ( iv ) . if an iv isn ' t passed as part of the parameter , the iv will be all zeros . an iv which is too short is handled in fips compliant fashion .
