1--TEST--
2Crypto\Cipher::encrypt basic usage.
3--FILE--
4<?php
5$key = str_repeat('x', 32);
6$iv = str_repeat('i', 16);
7
8$data = str_repeat('a', 16);
9
10$cipher = new Crypto\Cipher('aes-256-cbc');
11
12// key length
13try {
14	$cipher->encrypt($data, 'short_key', $iv);
15}
16catch (Crypto\CipherException $e) {
17	if ($e->getCode() === Crypto\CipherException::KEY_LENGTH_INVALID) {
18		echo "SHORT KEY\n";
19	}
20}
21
22// iv length
23try {
24	$cipher->encrypt($data, $key, 'short_iv');
25}
26catch (Crypto\CipherException $e) {
27	if ($e->getCode() === Crypto\CipherException::IV_LENGTH_INVALID) {
28		echo "SHORT IV\n";
29	}
30}
31
32// init first
33echo bin2hex($cipher->encrypt($data, $key, $iv)) . "\n";
34
35?>
36--EXPECT--
37SHORT KEY
38SHORT IV
398f8853a1685607133cb9ee0fc7a5b8a57103935cbc39ea680def0db0767e954e
40