crypto/src/main/java/org/springframework/security/crypto/encrypt/CipherUtils.java
public static void initCipher(Cipher cipher, int mode, SecretKey secretKey,
			AlgorithmParameterSpec parameterSpec) {
		try {
			if (parameterSpec != null) {
				cipher.init(mode, secretKey, parameterSpec);
			}
			else {
				cipher.init(mode, secretKey);
			}
		}
		catch (InvalidKeyException e) {
			throw new IllegalArgumentException(
					"Unable to initialize due to invalid secret key", e);
		}
		catch (InvalidAlgorithmParameterException e) {
			throw new IllegalStateException(
					"Unable to initialize due to invalid decryption parameter spec", e);
		}
	}
public static void initCipher(Cipher cipher, int mode, SecretKey secretKey,
			AlgorithmParameterSpec parameterSpec) {
		try {
			if (parameterSpec != null) {
				cipher.init(mode, secretKey, parameterSpec);
			}
			else {
				cipher.init(mode, secretKey);
			}
		}
		catch (InvalidKeyException e) {
			throw new IllegalArgumentException(
					"Unable to initialize due to invalid secret key", e);
		}
		catch (InvalidAlgorithmParameterException e) {
			throw new IllegalStateException(
					"Unable to initialize due to invalid decryption parameter spec", e);
		}
	}
public static void initCipher ( Cipher cipher , int mode , SecretKey secretKey , AlgorithmParameterSpec parameterSpec ) { try { if ( parameterSpec != null ) { cipher . init ( mode , secretKey , parameterSpec ) ; } else { cipher . init ( mode , secretKey ) ; } } catch ( InvalidKeyException e ) { throw new IllegalArgumentException ( "Unable to initialize due to invalid secret key" , e ) ; } catch ( InvalidAlgorithmParameterException e ) { throw new IllegalStateException ( "Unable to initialize due to invalid decryption parameter spec" , e ) ; } }
Initializes the Cipher for use.
Initializes the Cipher for use .