1--TEST-- 2Stream cipher cbc encryption filter for reading 3--FILE-- 4<?php 5$algorithm = 'aes-256-cbc'; 6$key = str_repeat('x', 32); 7$iv = str_repeat('i', 16); 8$data = str_repeat('a', 16); 9 10$filename = (dirname( __FILE__) . "/stream_filters_cipher_cbc_enc_read.tmp"); 11file_put_contents($filename, $data); 12 13$context = stream_context_create(array( 14 'crypto' => array( 15 'filters' => array( 16 array( 17 'type' => 'cipher', 18 'action' => 'encrypt', 19 'algorithm' => $algorithm, 20 'key' => $key, 21 'iv' => $iv, 22 ) 23 ) 24 ), 25)); 26 27// init first 28echo bin2hex(file_get_contents("crypto.file://" . $filename, false, $context)); 29?> 30--CLEAN-- 31<?php 32$filename = (dirname( __FILE__) . "/stream_filters_cipher_cbc_enc_read.tmp"); 33if (file_exists($filename)) 34 unlink($filename); 35?> 36--EXPECT-- 378f8853a1685607133cb9ee0fc7a5b8a57103935cbc39ea680def0db0767e954e