List of usage examples for javax.crypto Cipher getInstance
public static final Cipher getInstance(String transformation, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException
From source file:gov.nih.nci.security.util.AESEncryption.java
public AESEncryption(String passphrase, boolean isMD5Hash) throws EncryptionException { try {/*from www . ja v a 2 s .c o m*/ this.provider = new BouncyCastleProvider(); SecretKeySpec skey = getSKeySpec(passphrase, isMD5Hash); encryptCipher = Cipher.getInstance(AES_ENCRYPTION_SCHEME, provider); decryptCipher = Cipher.getInstance(AES_ENCRYPTION_SCHEME, provider); encryptCipher.init(Cipher.ENCRYPT_MODE, skey); AlgorithmParameters ap = encryptCipher.getParameters(); decryptCipher.init(Cipher.DECRYPT_MODE, skey, ap); } catch (NoSuchAlgorithmException e) { throw new EncryptionException(e); } catch (NoSuchPaddingException e) { throw new EncryptionException(e); } catch (InvalidKeyException e) { throw new EncryptionException(e); } catch (InvalidAlgorithmParameterException e) { throw new EncryptionException(e); } }