Annotation of embedaddon/php/ext/mcrypt/tests/mcrypt_cfb.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: mcrypt_cfb
3: --SKIPIF--
4: <?php if (!extension_loaded("mcrypt")) print "skip"; ?>
5: --FILE--
6: <?php
7: $key = "FooBar";
8: $secret = "PHP Testfest 2008";
9: $cipher = MCRYPT_RIJNDAEL_128;
10:
11: $iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_CFB), MCRYPT_RAND);
12: $enc_data = mcrypt_cfb($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv);
13:
14: // we have to trim as AES rounds the blocks and decrypt doesnt detect that
15: echo trim(mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";
16:
17: // a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
18: mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT);
19:
20: --EXPECTF--
21: PHP Testfest 2008
22:
23: Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>