Exemple #1
0
 /**
  * Initializes this cipher with a key and a source of randomness. The cipher is initialized for
  * one of the following four operations: encryption, decryption, key wrapping or key unwrapping,
  * depending on the value of <code>opmode</code>.
  *
  * <p>If this cipher (including its underlying feedback or padding scheme) requires any random
  * bytes, it will get them from <code>random</code>.
  *
  * @param opmode the operation mode of this cipher (this is one of the following: <code>
  *     ENCRYPT_MODE</code>, <code>DECRYPT_MODE</code>), <code>WRAP_MODE</code> or <code>
  *     UNWRAP_MODE</code>)
  * @param key the encryption key
  * @param random the source of randomness
  * @exception InvalidKeyException if the given key is inappropriate for initializing this cipher
  */
 protected void engineInit(int opmode, Key key, SecureRandom random) throws InvalidKeyException {
   try {
     core.init(opmode, key, (AlgorithmParameterSpec) null, random);
   } catch (InvalidAlgorithmParameterException ie) {
     InvalidKeyException ike = new InvalidKeyException("requires PBE parameters");
     ike.initCause(ie);
     throw ike;
   }
 }
Exemple #2
0
 protected void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random)
     throws InvalidKeyException, InvalidAlgorithmParameterException {
   core.init(opmode, key, params, random);
 }