protected void engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { if (params != null && params instanceof RC2ParameterSpec) { embeddedCipher.initEffectiveKeyBits(((RC2ParameterSpec) params).getEffectiveKeyBits()); } else { embeddedCipher.initEffectiveKeyBits(0); } core.init(opmode, key, params, random); }
protected void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { if (params != null && params.getAlgorithm().equals("RC2")) { try { RC2ParameterSpec rc2Params = params.getParameterSpec(RC2ParameterSpec.class); engineInit(opmode, key, rc2Params, random); } catch (InvalidParameterSpecException ipse) { throw new InvalidAlgorithmParameterException("Wrong parameter type: RC2 expected"); } } else { embeddedCipher.initEffectiveKeyBits(0); core.init(opmode, key, params, random); } }
protected void engineInit(int opmode, Key key, SecureRandom random) throws InvalidKeyException { embeddedCipher.initEffectiveKeyBits(0); core.init(opmode, key, random); }
protected int engineGetKeySize(Key key) throws InvalidKeyException { byte[] keyBytes = CipherCore.getKeyBytes(key); RC2Crypt.checkKey(key.getAlgorithm(), keyBytes.length); return keyBytes.length << 3; }