1--TEST-- 2Crypto\Cipher::decryptFinish basic usage. 3--FILE-- 4<?php 5$key = str_repeat('x', 32); 6$iv = str_repeat('i', 16); 7 8$ciphertext = pack("H*", '8f8853a1685607133cb9ee0fc7a5b8a57103935cbc39ea680def0db0767e954e'); 9 10$cipher = new Crypto\Cipher('aes-256-cbc'); 11 12// invalid order 13try { 14 $cipher->decryptFinish(); 15} 16catch (Crypto\CipherException $e) { 17 if ($e->getCode() === Crypto\CipherException::FINISH_DECRYPT_FORBIDDEN) { 18 echo "FINAL STATUS\n"; 19 } 20} 21 22// init first 23$cipher->decryptInit($key, $iv); 24$result = $cipher->decryptUpdate($ciphertext); 25$result .= $cipher->decryptFinish(); 26echo $result . "\n"; 27?> 28--EXPECT-- 29FINAL STATUS 30aaaaaaaaaaaaaaaa 31