public static Cipher getAESCipher ( int mode , byte [ ] key ) { try { Cipher cipher = Cipher . getInstance ( "AES/CBC/PKCS5Padding" ) ; SecretKeySpec aesKey = new SecretKeySpec ( key , "AES" ) ; cipher . init ( mode , aesKey , IVPS ) ; return cipher ; } catch ( GeneralSecurityException gse ) { log . warning ( "Failed to create cipher" , gse ) ; } return null ; }
Creates our AES cipher .