/** * initialise a RC2 cipher. * * @param encrypting whether or not we are for encryption. * @param params the parameters required to set up the cipher. * @exception IllegalArgumentException if the params argument is * inappropriate. */ public void init( boolean encrypting, CipherParameters params) { this.encrypting = encrypting; if (params instanceof RC2Parameters) { RC2Parameters param = (RC2Parameters)params; workingKey = generateWorkingKey(param.getKey(), param.getEffectiveKeyBits()); } else if (params instanceof KeyParameter) { byte[] key = ((KeyParameter)params).getKey(); workingKey = generateWorkingKey(key, key.length * 8); } else { throw new IllegalArgumentException("invalid parameter passed to RC2 init - " + params.getClass().getName()); } }
/** * initialise a RC2 cipher. * * @param encrypting whether or not we are for encryption. * @param params the parameters required to set up the cipher. * @exception IllegalArgumentException if the params argument is * inappropriate. */ public void init( boolean encrypting, CipherParameters params) { this.encrypting = encrypting; if (params instanceof RC2Parameters) { RC2Parameters param = (RC2Parameters)params; workingKey = generateWorkingKey(param.getKey(), param.getEffectiveKeyBits()); } else if (params instanceof KeyParameter) { byte[] key = ((KeyParameter)params).getKey(); workingKey = generateWorkingKey(key, key.length * 8); } else { throw new IllegalArgumentException("invalid parameter passed to RC2 init - " + params.getClass().getName()); } }