gwt/3.3/src/pubnub/api/Pubnub.java
/**
     * AES Encryption
     *
     * @param boolean encrypt_or_decrypt ENCRYPT/DECRYPT mode
     * @param ByteArray input_bytes
     * @return ByteArray
     * @throws Exception
     */
AES Encryption
@param boolean encrypt_or_decrypt ENCRYPT/DECRYPT mode
@param ByteArray input_bytes
@return ByteArray
@throws Exception
AES Encryption @param boolean encrypt_or_decrypt ENCRYPT / DECRYPT mode @param ByteArray input_bytes @return ByteArray @throws Exception
private byte[] transform(boolean encrypt_or_decrypt, byte[] input_bytes) throws Exception {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        byte[] iv_bytes = "0123456789012345".getBytes();
        byte[] key_bytes = md5(this.CIPHER_KEY);
        SecretKeySpec key = new SecretKeySpec(key_bytes, "AES");
        IvParameterSpec ivSpec = new IvParameterSpec(iv_bytes);
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        if (encrypt_or_decrypt) {
            cipher.init(Cipher.ENCRYPT_MODE, key, ivSpec);
            ByteArrayInputStream b_in = new ByteArrayInputStream(input_bytes);
            CipherInputStream c_in = new CipherInputStream(b_in, cipher);
            int ch;
            while ((ch = c_in.read()) >= 0) {
                output.write(ch);
            }
            c_in.close();
        } else {
            cipher.init(Cipher.DECRYPT_MODE, key, ivSpec);
            CipherOutputStream c_out = new CipherOutputStream(output, cipher);
            c_out.write(input_bytes);
            c_out.close();
        }
        return output.toByteArray();
    }
private byte [ ] transform ( boolean encrypt_or_decrypt , byte [ ] input_bytes ) throws Exception { ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; byte [ ] iv_bytes = "0123456789012345" . getBytes ( ) ; byte [ ] key_bytes = md5 ( this . CIPHER_KEY ) ; SecretKeySpec key = new SecretKeySpec ( key_bytes , "AES" ) ; IvParameterSpec ivSpec = new IvParameterSpec ( iv_bytes ) ; Cipher cipher = Cipher . getInstance ( "AES/CBC/PKCS5Padding" ) ; if ( encrypt_or_decrypt ) { cipher . init ( Cipher . ENCRYPT_MODE , key , ivSpec ) ; ByteArrayInputStream b_in = new ByteArrayInputStream ( input_bytes ) ; CipherInputStream c_in = new CipherInputStream ( b_in , cipher ) ; int ch ; while ( ( ch = c_in . read ( ) ) >= 0 ) { output . write ( ch ) ; } c_in . close ( ) ; } else { cipher . init ( Cipher . DECRYPT_MODE , key , ivSpec ) ; CipherOutputStream c_out = new CipherOutputStream ( output , cipher ) ; c_out . write ( input_bytes ) ; c_out . close ( ) ; } return output . toByteArray ( ) ; }
AES Encryption
 @param boolean encrypt_or_decrypt ENCRYPT/DECRYPT mode
 @param ByteArray input_bytes
 @return ByteArray
 @throws Exception
AES Encryption @param boolean encrypt_or_decrypt ENCRYPT / DECRYPT mode @param ByteArray input_bytes @return ByteArray @throws Exception