예제 #1
0
 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);
 }
예제 #2
0
 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);
   }
 }
예제 #3
0
 protected void engineInit(int opmode, Key key, SecureRandom random) throws InvalidKeyException {
   embeddedCipher.initEffectiveKeyBits(0);
   core.init(opmode, key, random);
 }
예제 #4
0
 protected int engineGetKeySize(Key key) throws InvalidKeyException {
   byte[] keyBytes = CipherCore.getKeyBytes(key);
   RC2Crypt.checkKey(key.getAlgorithm(), keyBytes.length);
   return keyBytes.length << 3;
 }