Code example for CipherOutputStream

Methods: closewrite

0
			SecretKeySpec scs = new SecretKeySpec(key, "AES");
			Cipher cipher = Cipher.getInstance("AES/CFB/NoPadding", "ZBC");
			IvParameterSpec iv = new IvParameterSpec(initVector);
			ByteArrayOutputStream baos = new ByteArrayOutputStream(length);
			cipher.init(Cipher.DECRYPT_MODE, scs, iv);
			CipherOutputStream out = new CipherOutputStream(baos, cipher);
			out.write(data, offset, length);
			out.close();
			baos.close();
			return baos.toByteArray();
		} catch (Exception e) {
			throw new CryptoException(e);
		} 
	} 
 
	/* (non-Javadoc) 
	 * @see zorg.platform.CryptoUtils#aesEncrypt(byte[], byte[], byte[]) 
	 */ 
	@Override 
	public byte[] aesEncrypt(byte[] data, byte[] key, byte[] initVector)