Code example for InvalidKeyException

Methods: getMessage

0
			// Constant used to initialize cipher to encryption mode 
			this.cipher.init(Cipher.ENCRYPT_MODE, key.getKey(), this.ivSpec);
			this.encryptMode = true;
 
		} catch (InvalidKeyException e) {
			String errorMessage = HDIVUtil.getMessage("cipher.init.encrypt", e.getMessage());
			throw new HDIVException(errorMessage, e);
		} catch (InvalidAlgorithmParameterException e) {
			String errorMessage = HDIVUtil.getMessage("cipher.init.encrypt", e.getMessage());
			throw new HDIVException(errorMessage, e);
		} 
	} 
 
	/** 
	 * Generates a Cipher object that implements the specified <code>transformation</code>, initializes cipher vector 
	 * and initializes cipher to decryption mode with a key and a set of algorithm parameters. 
	 *  
	 * @param key 
	 *            the encryption key 
	 * @throws HDIVException