mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Remove mcrypt
This commit is contained in:
parent
3f04ee0b8b
commit
bc4676e050
80 changed files with 0 additions and 7028 deletions
|
@ -8,7 +8,6 @@ addons:
|
|||
- re2c
|
||||
- libgmp-dev
|
||||
- libicu-dev
|
||||
- libmcrypt-dev
|
||||
- libtidy-dev
|
||||
- libenchant-dev
|
||||
- libaspell-dev
|
||||
|
|
|
@ -344,11 +344,6 @@ PRIMARY MAINTAINER: Rui Hirokawa <hirokawa@php.net>
|
|||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: mcrypt
|
||||
PRIMARY MAINTAINER: Derick Rethans <derick@derickrethans.nl>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: opcache
|
||||
PRIMARY MAINTAINER: Dmitry Stogov <dmitry@zend.com>, Xinchen Hui <laruence@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
mcrypt
|
||||
Sascha Schumann, Derick Rethans
|
|
@ -1,6 +0,0 @@
|
|||
/* $Id$ */
|
||||
|
||||
ToDo:
|
||||
- Convert to zend_parse_parameters
|
||||
- Unify error handling
|
||||
- Implement encryption streams
|
|
@ -1,59 +0,0 @@
|
|||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
AC_DEFUN([PHP_MCRYPT_CHECK_VERSION],[
|
||||
old_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS=-I$MCRYPT_DIR/include
|
||||
AC_MSG_CHECKING(for libmcrypt version)
|
||||
AC_EGREP_CPP(yes,[
|
||||
#include <mcrypt.h>
|
||||
#if MCRYPT_API_VERSION >= 20021217
|
||||
yes
|
||||
#endif
|
||||
],[
|
||||
AC_MSG_RESULT(>= 2.5.6)
|
||||
],[
|
||||
AC_MSG_ERROR(libmcrypt version 2.5.6 or greater required.)
|
||||
])
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
])
|
||||
|
||||
|
||||
PHP_ARG_WITH(mcrypt, for mcrypt support,
|
||||
[ --with-mcrypt[=DIR] Include mcrypt support])
|
||||
|
||||
if test "$PHP_MCRYPT" != "no"; then
|
||||
for i in $PHP_MCRYPT /usr/local /usr; do
|
||||
test -f $i/include/mcrypt.h && MCRYPT_DIR=$i && break
|
||||
done
|
||||
|
||||
if test -z "$MCRYPT_DIR"; then
|
||||
AC_MSG_ERROR(mcrypt.h not found. Please reinstall libmcrypt.)
|
||||
fi
|
||||
|
||||
PHP_MCRYPT_CHECK_VERSION
|
||||
|
||||
PHP_CHECK_LIBRARY(mcrypt, mcrypt_module_open,
|
||||
[
|
||||
PHP_ADD_LIBRARY(ltdl,, MCRYPT_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_LIBMCRYPT,1,[ ])
|
||||
],[
|
||||
PHP_CHECK_LIBRARY(mcrypt, mcrypt_module_open,
|
||||
[
|
||||
AC_DEFINE(HAVE_LIBMCRYPT,1,[ ])
|
||||
],[
|
||||
AC_MSG_ERROR([Sorry, I was not able to diagnose which libmcrypt version you have installed.])
|
||||
],[
|
||||
-L$MCRYPT_DIR/$PHP_LIBDIR
|
||||
])
|
||||
],[
|
||||
-L$MCRYPT_DIR/$PHP_LIBDIR -lltdl
|
||||
])
|
||||
|
||||
PHP_ADD_LIBRARY_WITH_PATH(mcrypt, $MCRYPT_DIR/$PHP_LIBDIR, MCRYPT_SHARED_LIBADD)
|
||||
PHP_ADD_INCLUDE($MCRYPT_DIR/include)
|
||||
|
||||
PHP_SUBST(MCRYPT_SHARED_LIBADD)
|
||||
PHP_NEW_EXTENSION(mcrypt, mcrypt.c mcrypt_filter.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
|
||||
fi
|
|
@ -1,19 +0,0 @@
|
|||
// $Id$
|
||||
// vim:ft=javascript
|
||||
|
||||
ARG_WITH("mcrypt", "mcrypt support", "no");
|
||||
|
||||
if (PHP_MCRYPT != "no") {
|
||||
|
||||
if (CHECK_HEADER_ADD_INCLUDE('mcrypt.h', 'CFLAGS_MCRYPT') &&
|
||||
CHECK_LIB('libmcrypt_a.lib;libmcrypt.lib', 'mcrypt') &&
|
||||
CHECK_LIB('Advapi32.lib', 'mcrypt')
|
||||
) {
|
||||
|
||||
EXTENSION('mcrypt', 'mcrypt.c mcrypt_filter.c', false, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||
AC_DEFINE('HAVE_LIBMCRYPT', 1);
|
||||
AC_DEFINE('HAVE_LIBMCRYPT24', 1);
|
||||
} else {
|
||||
WARNING("mcrypt not enabled; libraries and headers not found");
|
||||
}
|
||||
}
|
1433
ext/mcrypt/mcrypt.c
1433
ext/mcrypt/mcrypt.c
File diff suppressed because it is too large
Load diff
|
@ -1,285 +0,0 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Sara Golemon <pollita@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#include "php.h"
|
||||
|
||||
#include "php_mcrypt_filter.h"
|
||||
#include "php_ini.h"
|
||||
#include <mcrypt.h>
|
||||
|
||||
typedef struct _php_mcrypt_filter_data {
|
||||
MCRYPT module;
|
||||
char encrypt;
|
||||
int blocksize;
|
||||
char *block_buffer;
|
||||
int block_used;
|
||||
char persistent;
|
||||
} php_mcrypt_filter_data;
|
||||
|
||||
static php_stream_filter_status_t php_mcrypt_filter(
|
||||
php_stream *stream,
|
||||
php_stream_filter *thisfilter,
|
||||
php_stream_bucket_brigade *buckets_in,
|
||||
php_stream_bucket_brigade *buckets_out,
|
||||
size_t *bytes_consumed,
|
||||
int flags)
|
||||
{
|
||||
php_mcrypt_filter_data *data;
|
||||
php_stream_bucket *bucket;
|
||||
size_t consumed = 0;
|
||||
php_stream_filter_status_t exit_status = PSFS_FEED_ME;
|
||||
|
||||
if (!thisfilter || !Z_PTR(thisfilter->abstract)) {
|
||||
/* Should never happen */
|
||||
return PSFS_ERR_FATAL;
|
||||
}
|
||||
|
||||
data = (php_mcrypt_filter_data *)(Z_PTR(thisfilter->abstract));
|
||||
while(buckets_in->head) {
|
||||
bucket = buckets_in->head;
|
||||
|
||||
consumed += bucket->buflen;
|
||||
|
||||
if (data->blocksize) {
|
||||
/* Blockmode cipher */
|
||||
char *outchunk;
|
||||
int chunklen = (int)(bucket->buflen + data->block_used), n;
|
||||
php_stream_bucket *newbucket;
|
||||
|
||||
outchunk = pemalloc(chunklen, data->persistent);
|
||||
if (data->block_used) {
|
||||
memcpy(outchunk, data->block_buffer, data->block_used);
|
||||
}
|
||||
memcpy(outchunk + data->block_used, bucket->buf, bucket->buflen);
|
||||
|
||||
for(n=0; (n + data->blocksize) <= chunklen; n += data->blocksize) {
|
||||
|
||||
if (data->encrypt) {
|
||||
mcrypt_generic(data->module, outchunk + n, data->blocksize);
|
||||
} else {
|
||||
mdecrypt_generic(data->module, outchunk + n, data->blocksize);
|
||||
}
|
||||
}
|
||||
data->block_used = chunklen - n;
|
||||
memcpy(data->block_buffer, outchunk + n, data->block_used);
|
||||
|
||||
newbucket = php_stream_bucket_new(stream, outchunk, n, 1, data->persistent);
|
||||
php_stream_bucket_append(buckets_out, newbucket);
|
||||
|
||||
exit_status = PSFS_PASS_ON;
|
||||
|
||||
php_stream_bucket_unlink(bucket);
|
||||
php_stream_bucket_delref(bucket);
|
||||
} else {
|
||||
/* Stream cipher */
|
||||
php_stream_bucket_make_writeable(bucket);
|
||||
if (data->encrypt) {
|
||||
mcrypt_generic(data->module, bucket->buf, (int)bucket->buflen);
|
||||
} else {
|
||||
mdecrypt_generic(data->module, bucket->buf, (int)bucket->buflen);
|
||||
}
|
||||
php_stream_bucket_append(buckets_out, bucket);
|
||||
|
||||
exit_status = PSFS_PASS_ON;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & PSFS_FLAG_FLUSH_CLOSE) && data->blocksize && data->block_used) {
|
||||
php_stream_bucket *newbucket;
|
||||
|
||||
memset(data->block_buffer + data->block_used, 0, data->blocksize - data->block_used);
|
||||
if (data->encrypt) {
|
||||
mcrypt_generic(data->module, data->block_buffer, data->blocksize);
|
||||
} else {
|
||||
mdecrypt_generic(data->module, data->block_buffer, data->blocksize);
|
||||
}
|
||||
|
||||
newbucket = php_stream_bucket_new(stream, data->block_buffer, data->blocksize, 0, data->persistent);
|
||||
php_stream_bucket_append(buckets_out, newbucket);
|
||||
|
||||
exit_status = PSFS_PASS_ON;
|
||||
}
|
||||
|
||||
if (bytes_consumed) {
|
||||
*bytes_consumed = consumed;
|
||||
}
|
||||
|
||||
return exit_status;
|
||||
}
|
||||
|
||||
static void php_mcrypt_filter_dtor(php_stream_filter *thisfilter)
|
||||
{
|
||||
if (thisfilter && Z_PTR(thisfilter->abstract)) {
|
||||
php_mcrypt_filter_data *data = (php_mcrypt_filter_data*) Z_PTR(thisfilter->abstract);
|
||||
|
||||
if (data->block_buffer) {
|
||||
pefree(data->block_buffer, data->persistent);
|
||||
}
|
||||
|
||||
mcrypt_generic_deinit(data->module);
|
||||
mcrypt_module_close(data->module);
|
||||
|
||||
pefree(data, data->persistent);
|
||||
}
|
||||
}
|
||||
|
||||
static php_stream_filter_ops php_mcrypt_filter_ops = {
|
||||
php_mcrypt_filter,
|
||||
php_mcrypt_filter_dtor,
|
||||
"mcrypt.*"
|
||||
};
|
||||
|
||||
/* {{{ php_mcrypt_filter_create
|
||||
* Instantiate mcrypt filter
|
||||
*/
|
||||
static php_stream_filter *php_mcrypt_filter_create(const char *filtername, zval *filterparams, int persistent)
|
||||
{
|
||||
int encrypt = 1, iv_len, key_len, keyl, result;
|
||||
const char *cipher = filtername + sizeof("mcrypt.") - 1;
|
||||
zval *tmpzval;
|
||||
MCRYPT mcrypt_module;
|
||||
char *iv = NULL, *key = NULL;
|
||||
char *algo_dir = INI_STR("mcrypt.algorithms_dir");
|
||||
char *mode_dir = INI_STR("mcrypt.modes_dir");
|
||||
char *mode = "cbc";
|
||||
php_mcrypt_filter_data *data;
|
||||
|
||||
php_error_docref(NULL, E_DEPRECATED, "mcrypt and mdecrypt stream filters have been deprecated");
|
||||
|
||||
if (strncasecmp(filtername, "mdecrypt.", sizeof("mdecrypt.") - 1) == 0) {
|
||||
encrypt = 0;
|
||||
cipher += sizeof("de") - 1;
|
||||
} else if (strncasecmp(filtername, "mcrypt.", sizeof("mcrypt.") - 1) != 0) {
|
||||
/* Should never happen */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!filterparams || Z_TYPE_P(filterparams) != IS_ARRAY) {
|
||||
php_error_docref(NULL, E_WARNING, "Filter parameters for %s must be an array", filtername);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((tmpzval = zend_hash_str_find(Z_ARRVAL_P(filterparams), ZEND_STRL("mode")))) {
|
||||
if (Z_TYPE_P(tmpzval) == IS_STRING) {
|
||||
mode = Z_STRVAL_P(tmpzval);
|
||||
} else {
|
||||
php_error_docref(NULL, E_WARNING, "mode is not a string, ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
if ((tmpzval=zend_hash_str_find(Z_ARRVAL_P(filterparams), ZEND_STRL("algorithms_dir")))) {
|
||||
if (Z_TYPE_P(tmpzval) == IS_STRING) {
|
||||
algo_dir = Z_STRVAL_P(tmpzval);
|
||||
} else {
|
||||
php_error_docref(NULL, E_WARNING, "algorithms_dir is not a string, ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
if ((tmpzval=zend_hash_str_find(Z_ARRVAL_P(filterparams), ZEND_STRL("modes_dir")))) {
|
||||
if (Z_TYPE_P(tmpzval) == IS_STRING) {
|
||||
mode_dir = Z_STRVAL_P(tmpzval);
|
||||
} else {
|
||||
php_error_docref(NULL, E_WARNING, "modes_dir is not a string, ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
if ((tmpzval = zend_hash_str_find(Z_ARRVAL_P(filterparams), ZEND_STRL("key"))) &&
|
||||
Z_TYPE_P(tmpzval) == IS_STRING) {
|
||||
key = Z_STRVAL_P(tmpzval);
|
||||
key_len = (int)Z_STRLEN_P(tmpzval);
|
||||
} else {
|
||||
php_error_docref(NULL, E_WARNING, "key not specified or is not a string");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mcrypt_module = mcrypt_module_open((char *)cipher, algo_dir, mode, mode_dir);
|
||||
if (mcrypt_module == MCRYPT_FAILED) {
|
||||
php_error_docref(NULL, E_WARNING, "Could not open encryption module");
|
||||
return NULL;
|
||||
}
|
||||
iv_len = mcrypt_enc_get_iv_size(mcrypt_module);
|
||||
keyl = mcrypt_enc_get_key_size(mcrypt_module);
|
||||
if (keyl < key_len) {
|
||||
key_len = keyl;
|
||||
}
|
||||
|
||||
if (!(tmpzval = zend_hash_str_find(Z_ARRVAL_P(filterparams), ZEND_STRL("iv"))) ||
|
||||
Z_TYPE_P(tmpzval) != IS_STRING) {
|
||||
php_error_docref(NULL, E_WARNING, "Filter parameter[iv] not provided or not of type: string");
|
||||
mcrypt_module_close(mcrypt_module);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
iv = emalloc(iv_len + 1);
|
||||
if ((size_t)iv_len <= Z_STRLEN_P(tmpzval)) {
|
||||
memcpy(iv, Z_STRVAL_P(tmpzval), iv_len);
|
||||
} else {
|
||||
memcpy(iv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval));
|
||||
memset(iv + Z_STRLEN_P(tmpzval), 0, iv_len - Z_STRLEN_P(tmpzval));
|
||||
}
|
||||
|
||||
result = mcrypt_generic_init(mcrypt_module, key, key_len, iv);
|
||||
efree(iv);
|
||||
if (result < 0) {
|
||||
switch (result) {
|
||||
case -3:
|
||||
php_error_docref(NULL, E_WARNING, "Key length incorrect");
|
||||
break;
|
||||
case -4:
|
||||
php_error_docref(NULL, E_WARNING, "Memory allocation error");
|
||||
break;
|
||||
case -1:
|
||||
default:
|
||||
php_error_docref(NULL, E_WARNING, "Unknown error");
|
||||
break;
|
||||
}
|
||||
mcrypt_module_close(mcrypt_module);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = pemalloc(sizeof(php_mcrypt_filter_data), persistent);
|
||||
data->module = mcrypt_module;
|
||||
data->encrypt = encrypt;
|
||||
if (mcrypt_enc_is_block_mode(mcrypt_module)) {
|
||||
data->blocksize = mcrypt_enc_get_block_size(mcrypt_module);
|
||||
data->block_buffer = pemalloc(data->blocksize, persistent);
|
||||
} else {
|
||||
data->blocksize = 0;
|
||||
data->block_buffer = NULL;
|
||||
}
|
||||
data->block_used = 0;
|
||||
data->persistent = persistent;
|
||||
|
||||
return php_stream_filter_alloc(&php_mcrypt_filter_ops, data, persistent);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
php_stream_filter_factory php_mcrypt_filter_factory = {
|
||||
php_mcrypt_filter_create
|
||||
};
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Sascha Schumann <sascha@schumann.cx> |
|
||||
| Derick Rethans <derick@derickrethans.nl> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_MCRYPT_H
|
||||
#define PHP_MCRYPT_H
|
||||
|
||||
#if HAVE_LIBMCRYPT
|
||||
|
||||
#ifdef ZTS
|
||||
#include "TSRM.h"
|
||||
#endif
|
||||
|
||||
extern zend_module_entry mcrypt_module_entry;
|
||||
#define mcrypt_module_ptr &mcrypt_module_entry
|
||||
|
||||
#include "php_version.h"
|
||||
#define PHP_MCRYPT_VERSION PHP_VERSION
|
||||
|
||||
/* Functions for both old and new API */
|
||||
PHP_FUNCTION(mcrypt_ecb);
|
||||
PHP_FUNCTION(mcrypt_cbc);
|
||||
PHP_FUNCTION(mcrypt_cfb);
|
||||
PHP_FUNCTION(mcrypt_ofb);
|
||||
PHP_FUNCTION(mcrypt_get_cipher_name);
|
||||
PHP_FUNCTION(mcrypt_get_block_size);
|
||||
PHP_FUNCTION(mcrypt_get_key_size);
|
||||
PHP_FUNCTION(mcrypt_create_iv);
|
||||
|
||||
/* Support functions for old API */
|
||||
PHP_FUNCTION(mcrypt_list_algorithms);
|
||||
PHP_FUNCTION(mcrypt_list_modes);
|
||||
PHP_FUNCTION(mcrypt_get_iv_size);
|
||||
PHP_FUNCTION(mcrypt_encrypt);
|
||||
PHP_FUNCTION(mcrypt_decrypt);
|
||||
|
||||
/* Functions for new API */
|
||||
PHP_FUNCTION(mcrypt_module_open);
|
||||
PHP_FUNCTION(mcrypt_generic_init);
|
||||
PHP_FUNCTION(mcrypt_generic);
|
||||
PHP_FUNCTION(mdecrypt_generic);
|
||||
PHP_FUNCTION(mcrypt_generic_deinit);
|
||||
|
||||
PHP_FUNCTION(mcrypt_enc_self_test);
|
||||
PHP_FUNCTION(mcrypt_enc_is_block_algorithm_mode);
|
||||
PHP_FUNCTION(mcrypt_enc_is_block_algorithm);
|
||||
PHP_FUNCTION(mcrypt_enc_is_block_mode);
|
||||
PHP_FUNCTION(mcrypt_enc_get_block_size);
|
||||
PHP_FUNCTION(mcrypt_enc_get_key_size);
|
||||
PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes);
|
||||
PHP_FUNCTION(mcrypt_enc_get_iv_size);
|
||||
PHP_FUNCTION(mcrypt_enc_get_algorithms_name);
|
||||
PHP_FUNCTION(mcrypt_enc_get_modes_name);
|
||||
PHP_FUNCTION(mcrypt_module_self_test);
|
||||
PHP_FUNCTION(mcrypt_module_is_block_algorithm_mode);
|
||||
PHP_FUNCTION(mcrypt_module_is_block_algorithm);
|
||||
PHP_FUNCTION(mcrypt_module_is_block_mode);
|
||||
PHP_FUNCTION(mcrypt_module_get_algo_block_size);
|
||||
PHP_FUNCTION(mcrypt_module_get_algo_key_size);
|
||||
PHP_FUNCTION(mcrypt_module_get_supported_key_sizes);
|
||||
PHP_FUNCTION(mcrypt_module_close);
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(mcrypt)
|
||||
int le_h;
|
||||
char *modes_dir;
|
||||
char *algorithms_dir;
|
||||
int fd[2]; // RANDOM = 0, URANDOM = 1
|
||||
ZEND_END_MODULE_GLOBALS(mcrypt)
|
||||
|
||||
#define MCG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mcrypt, v)
|
||||
|
||||
#else
|
||||
#define mcrypt_module_ptr NULL
|
||||
#endif
|
||||
|
||||
#define phpext_mcrypt_ptr mcrypt_module_ptr
|
||||
|
||||
#endif
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 7 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2016 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Sara Golemon <pollita@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef PHP_MCRYPT_FILTER_H
|
||||
#define PHP_MCRYPT_FILTER_H
|
||||
|
||||
extern php_stream_filter_factory php_mcrypt_filter_factory;
|
||||
|
||||
PHP_MINIT_FUNCTION(mcrypt_filter);
|
||||
PHP_MSHUTDOWN_FUNCTION(mcrypt_filter);
|
||||
PHP_MINFO_FUNCTION(mcrypt_filter);
|
||||
|
||||
#endif /* PHP_MCRYPT_FILTER_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*/
|
|
@ -1,231 +0,0 @@
|
|||
--TEST--
|
||||
Test for blowfish compatibility
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
if(!function_exists("hex2bin")) {
|
||||
function hex2bin($data) {
|
||||
$len = strlen($data);
|
||||
return pack("H" . $len, $data);
|
||||
}
|
||||
}
|
||||
|
||||
print "key plain crypt guess stat\n";
|
||||
$null = "\0\0\0\0\0\0\0\0";
|
||||
$vectors = file(dirname(__FILE__) . "/vectors.txt");
|
||||
|
||||
$td = mcrypt_module_open ("blowfish", "", MCRYPT_MODE_ECB, "");
|
||||
|
||||
foreach($vectors as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
list($key,$plain,$crypt) = preg_split("/[[:space:]]+/",$data);
|
||||
printf("%s %s ",
|
||||
$key,
|
||||
$plain
|
||||
);
|
||||
$key = hex2bin(trim($key));
|
||||
$plain = hex2bin(($plain));
|
||||
$crypt = strtolower(trim($crypt));
|
||||
|
||||
mcrypt_generic_init ($td, $key, $null);
|
||||
$guess = mcrypt_generic ($td, $plain);
|
||||
$guess = bin2hex($guess);
|
||||
printf("%s %s %s\n",
|
||||
$crypt,
|
||||
$guess,
|
||||
($crypt==$guess ? "OK" : "BAD")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Longer test case from http://www.schneier.com/code/vectors.txt
|
||||
$td = mcrypt_module_open ("blowfish", "", MCRYPT_MODE_CBC, "");
|
||||
|
||||
$key = hex2bin( "0123456789ABCDEFF0E1D2C3B4A59687" );
|
||||
$iv = hex2bin( "FEDCBA9876543210" );
|
||||
$plain = hex2bin( "37363534333231204E6F77206973207468652074696D6520666F722000" );
|
||||
|
||||
mcrypt_generic_init( $td, $key, $iv );
|
||||
$guess = bin2hex( mcrypt_generic( $td, $plain ) );
|
||||
|
||||
echo "\n", $guess, "\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
key plain crypt guess stat
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%eblowfish.php on line %d
|
||||
0000000000000000 0000000000000000
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
4ef997456198dd78 4ef997456198dd78 OK
|
||||
FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
51866fd5b85ecb8a 51866fd5b85ecb8a OK
|
||||
3000000000000000 1000000000000001
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
7d856f9a613063f2 7d856f9a613063f2 OK
|
||||
1111111111111111 1111111111111111
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
2466dd878b963c9d 2466dd878b963c9d OK
|
||||
0123456789ABCDEF 1111111111111111
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
61f9c3802281b096 61f9c3802281b096 OK
|
||||
1111111111111111 0123456789ABCDEF
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
7d0cc630afda1ec7 7d0cc630afda1ec7 OK
|
||||
FEDCBA9876543210 0123456789ABCDEF
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
0aceab0fc6a0a28d 0aceab0fc6a0a28d OK
|
||||
7CA110454A1A6E57 01A1D6D039776742
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
59c68245eb05282b 59c68245eb05282b OK
|
||||
0131D9619DC1376E 5CD54CA83DEF57DA
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
b1b8cc0b250f09a0 b1b8cc0b250f09a0 OK
|
||||
07A1133E4A0B2686 0248D43806F67172
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
1730e5778bea1da4 1730e5778bea1da4 OK
|
||||
3849674C2602319E 51454B582DDF440A
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
a25e7856cf2651eb a25e7856cf2651eb OK
|
||||
04B915BA43FEB5B6 42FD443059577FA2
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
353882b109ce8f1a 353882b109ce8f1a OK
|
||||
0113B970FD34F2CE 059B5E0851CF143A
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
48f4d0884c379918 48f4d0884c379918 OK
|
||||
0170F175468FB5E6 0756D8E0774761D2
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
432193b78951fc98 432193b78951fc98 OK
|
||||
43297FAD38E373FE 762514B829BF486A
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
13f04154d69d1ae5 13f04154d69d1ae5 OK
|
||||
07A7137045DA2A16 3BDD119049372802
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
2eedda93ffd39c79 2eedda93ffd39c79 OK
|
||||
04689104C2FD3B2F 26955F6835AF609A
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
d887e0393c2da6e3 d887e0393c2da6e3 OK
|
||||
37D06BB516CB7546 164D5E404F275232
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
5f99d04f5b163969 5f99d04f5b163969 OK
|
||||
1F08260D1AC2465E 6B056E18759F5CCA
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
4a057a3b24d3977b 4a057a3b24d3977b OK
|
||||
584023641ABA6176 004BD6EF09176062
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
452031c1e4fada8e 452031c1e4fada8e OK
|
||||
025816164629B007 480D39006EE762F2
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
7555ae39f59b87bd 7555ae39f59b87bd OK
|
||||
49793EBC79B3258F 437540C8698F3CFA
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
53c55f9cb49fc019 53c55f9cb49fc019 OK
|
||||
4FB05E1515AB73A7 072D43A077075292
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
7a8e7bfa937e89a3 7a8e7bfa937e89a3 OK
|
||||
49E95D6D4CA229BF 02FE55778117F12A
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
cf9c5d7a4986adb5 cf9c5d7a4986adb5 OK
|
||||
018310DC409B26D6 1D9D5C5018F728C2
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
d1abb290658bc778 d1abb290658bc778 OK
|
||||
1C587F1C13924FEF 305532286D6F295A
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
55cb3774d13ef201 55cb3774d13ef201 OK
|
||||
0101010101010101 0123456789ABCDEF
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
fa34ec4847b268b2 fa34ec4847b268b2 OK
|
||||
1F1F1F1F0E0E0E0E 0123456789ABCDEF
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
a790795108ea3cae a790795108ea3cae OK
|
||||
E0FEE0FEF1FEF1FE 0123456789ABCDEF
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
c39e072d9fac631d c39e072d9fac631d OK
|
||||
0000000000000000 FFFFFFFFFFFFFFFF
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
014933e0cdaff6e4 014933e0cdaff6e4 OK
|
||||
FFFFFFFFFFFFFFFF 0000000000000000
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
f21e9a77b71c49bc f21e9a77b71c49bc OK
|
||||
0123456789ABCDEF 0000000000000000
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
245946885754369a 245946885754369a OK
|
||||
FEDCBA9876543210 FFFFFFFFFFFFFFFF
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
6b5c5a9c5d9e0a5a 6b5c5a9c5d9e0a5a OK
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
|
||||
|
||||
6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc
|
|
@ -1,20 +0,0 @@
|
|||
--TEST--
|
||||
Bug #35496 (Crash in mcrypt_generic()/mdecrypt_generic() without proper init).
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open('rijndael-256', '', 'ofb', '');
|
||||
mcrypt_generic($td, "foobar");
|
||||
mdecrypt_generic($td, "baz");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%ebug35496.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug35496.php on line 3
|
||||
|
||||
Warning: mcrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug35496.php on line 3
|
||||
|
||||
Deprecated: Function mdecrypt_generic() is deprecated in %s%ebug35496.php on line 4
|
||||
|
||||
Warning: mdecrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug35496.php on line 4
|
Binary file not shown.
|
@ -1,17 +0,0 @@
|
|||
--TEST--
|
||||
Bug #41252 (Calling mcrypt_generic without first calling mcrypt_generic_init crashes)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_ECB, '');
|
||||
echo mcrypt_generic($td,'aaaaaaaa');
|
||||
print "I'm alive!\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%ebug41252.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug41252.php on line 3
|
||||
|
||||
Warning: mcrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug41252.php on line 3
|
||||
I'm alive!
|
|
@ -1,27 +0,0 @@
|
|||
--TEST--
|
||||
Bug #43143 (Warning about empty IV with MCRYPT_MODE_ECB)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip";
|
||||
if (!extension_loaded("hash")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "ECB\n";
|
||||
$input = 'to be encrypted';
|
||||
$mkey = hash('sha256', 'secret key', TRUE);
|
||||
$data = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $mkey, $input, MCRYPT_MODE_ECB);
|
||||
echo "CFB\n";
|
||||
$input = 'to be encrypted';
|
||||
$mkey = hash('sha256', 'secret key', TRUE);
|
||||
$data = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $mkey, $input, MCRYPT_MODE_CFB);
|
||||
echo "END\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
ECB
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug43143.php on line 5
|
||||
CFB
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug43143.php on line 9
|
||||
|
||||
Warning: mcrypt_encrypt(): Encryption mode requires an initialization vector of size 32 in %sbug43143.php on line 9
|
||||
END
|
|
@ -1,22 +0,0 @@
|
|||
--TEST--
|
||||
Bug #46010 (warnings incorrectly generated for iv in ecb mode)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$key = "012345678901234567890123";
|
||||
var_dump(bin2hex(mcrypt_encrypt(MCRYPT_TRIPLEDES, $key, "data", MCRYPT_MODE_ECB)));
|
||||
var_dump(bin2hex(mcrypt_encrypt(MCRYPT_TRIPLEDES, $key, "data", MCRYPT_MODE_ECB, "a")));
|
||||
var_dump(bin2hex(mcrypt_encrypt(MCRYPT_TRIPLEDES, $key, "data", MCRYPT_MODE_ECB, "12345678")));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug46010.php on line 4
|
||||
string(16) "f7a2ce11d4002294"
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug46010.php on line 5
|
||||
string(16) "f7a2ce11d4002294"
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug46010.php on line 6
|
||||
string(16) "f7a2ce11d4002294"
|
|
@ -1,21 +0,0 @@
|
|||
--TEST--
|
||||
Bug #49738 (calling mcrypt after mcrypt_generic_deinit crashes)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_ECB, '');
|
||||
mcrypt_generic_init($td, 'aaaaaaaa', 'aaaaaaaa');
|
||||
mcrypt_generic_deinit($td);
|
||||
echo mcrypt_generic($td, 'aaaaaaaa');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%ebug49738.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug49738.php on line 3
|
||||
|
||||
Deprecated: Function mcrypt_generic_deinit() is deprecated in %s%ebug49738.php on line 4
|
||||
|
||||
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug49738.php on line 5
|
||||
|
||||
Warning: mcrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug49738.php on line 5
|
|
@ -1,58 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_create_iv https://bugs.php.net/bug.php?id=55169
|
||||
--CREDIT--
|
||||
Ryan Biesemeyer <ryan@yaauie.com>
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
for( $i=1; $i<=64; $i = $i*2 ){
|
||||
echo 'Input: '. $i . PHP_EOL;
|
||||
$random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM );
|
||||
echo ' Length: ' . strlen( $random ) . PHP_EOL;
|
||||
echo ' Hex: '. bin2hex( $random ) . PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Input: 1
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 1
|
||||
Hex: %x
|
||||
|
||||
Input: 2
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 2
|
||||
Hex: %x
|
||||
|
||||
Input: 4
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 4
|
||||
Hex: %x
|
||||
|
||||
Input: 8
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 8
|
||||
Hex: %x
|
||||
|
||||
Input: 16
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 16
|
||||
Hex: %x
|
||||
|
||||
Input: 32
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 32
|
||||
Hex: %x
|
||||
|
||||
Input: 64
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
|
||||
Length: 64
|
||||
Hex: %x
|
|
@ -1,20 +0,0 @@
|
|||
--TEST--
|
||||
Bug #70625: mcrypt_encrypt() : won't return data when no IV was specified under RC4
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$key = 'secretkey';
|
||||
$ciphertext = mcrypt_encrypt(MCRYPT_ARCFOUR, $key, 'payload', MCRYPT_MODE_STREAM);
|
||||
var_dump(bin2hex($ciphertext));
|
||||
$plaintext = mcrypt_decrypt(MCRYPT_ARCFOUR, $key, $ciphertext, MCRYPT_MODE_STREAM);
|
||||
var_dump($plaintext);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug70625.php on line 4
|
||||
string(14) "d5c9a57023d0f1"
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%ebug70625.php on line 6
|
||||
string(7) "payload"
|
|
@ -1,24 +0,0 @@
|
|||
--TEST--
|
||||
Bug #8040 (MCRYPT_MODE_* do not seem to exist)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting (E_ALL ^ E_NOTICE);
|
||||
echo MCRYPT_TWOFISH."\n";
|
||||
echo MCRYPT_MODE_CBC."\n";
|
||||
|
||||
define ("MODE1", MCRYPT_MODE_CBC);
|
||||
echo MODE1."\n";
|
||||
|
||||
define ("CIPHER", MCRYPT_TWOFISH);
|
||||
define ("MODE2", MCRYPT_MODE_CBC);
|
||||
define ("MODE3", MCRYPT_CBC);
|
||||
|
||||
printf ("cipher=".CIPHER. " mode1=".MODE2. " mode2=". MODE3."\n");
|
||||
?>
|
||||
--EXPECT--
|
||||
twofish
|
||||
cbc
|
||||
cbc
|
||||
cipher=twofish mode1=cbc mode2=MCRYPT_CBC
|
|
@ -1,34 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_cbc
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$key = "0123456789012345";
|
||||
$secret = "PHP Testfest 2008";
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_CBC), MCRYPT_RAND);
|
||||
$enc_data = mcrypt_encrypt($cipher, $key, $secret, MCRYPT_MODE_CBC, $iv);
|
||||
|
||||
// we have to trim as AES rounds the blocks and decrypt doesnt detect that
|
||||
echo trim(mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_CBC, $iv)) . "\n";
|
||||
|
||||
// a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
|
||||
var_dump(mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_CBC));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_cbc.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%emcrypt_cbc.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc.php on line 7
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc.php on line 10
|
||||
PHP Testfest 2008
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc.php on line 13
|
||||
|
||||
Warning: mcrypt_decrypt(): Encryption mode requires an initialization vector of size 16 in %s on line %d
|
||||
bool(false)
|
|
@ -1,114 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_cbc() function : basic functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_cbc(int cipher, string key, string data, int mode, string iv)
|
||||
* Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$data = b"This is the secret message which must be encrypted";
|
||||
|
||||
// tripledes uses keys with exactly 192 bits (24 bytes)
|
||||
$keys = array(
|
||||
b'12345678',
|
||||
b'12345678901234567890',
|
||||
b'123456789012345678901234',
|
||||
b'12345678901234567890123456'
|
||||
);
|
||||
$data1 = array(
|
||||
'IleMhoxiOthmHua4tFBHOw==',
|
||||
'EeF1s6C+w1IiHj1gdDn81g==',
|
||||
'EEuXpjZPueyYoG0LGQ199Q==',
|
||||
'EEuXpjZPueyYoG0LGQ199Q=='
|
||||
);
|
||||
// tripledes is a block cipher of 64 bits (8 bytes)
|
||||
$ivs = array(
|
||||
b'1234',
|
||||
b'12345678',
|
||||
b'123456789'
|
||||
);
|
||||
// data represented in base64 (ascii)
|
||||
$data2 = array(
|
||||
'+G7nGcWIxij3TZjpI9lJdQ==',
|
||||
'3bJiFMeyScxOLQcE6mZtLg==',
|
||||
'+G7nGcWIxij3TZjpI9lJdQ=='
|
||||
);
|
||||
|
||||
$iv = b'12345678';
|
||||
echo "\n--- testing different key lengths\n";
|
||||
for ($i = 0; $i < sizeof($keys); $i++) {
|
||||
echo "\nkey length=".strlen($keys[$i])."\n";
|
||||
special_var_dump(mcrypt_decrypt($cipher, $keys[$i], base64_decode($data1[$i]), MCRYPT_MODE_CBC, $iv));
|
||||
}
|
||||
|
||||
$key = b'123456789012345678901234';
|
||||
echo "\n--- testing different iv lengths\n";
|
||||
for ($i = 0; $i < sizeof($ivs); $i++) {
|
||||
echo "\niv length=".strlen($ivs[$i])."\n";
|
||||
special_var_dump(mcrypt_decrypt($cipher, $key, base64_decode($data2[$i]), MCRYPT_MODE_CBC, $ivs[$i]));
|
||||
}
|
||||
|
||||
function special_var_dump($str) {
|
||||
var_dump(bin2hex($str));
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
--- testing different key lengths
|
||||
|
||||
key length=8
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 41
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=20
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 41
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=24
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 41
|
||||
string(32) "736563726574206d6573736167650000"
|
||||
|
||||
key length=26
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 41
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
--- testing different iv lengths
|
||||
|
||||
iv length=4
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 48
|
||||
|
||||
Warning: mcrypt_decrypt(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
iv length=8
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 48
|
||||
string(32) "659ec947f4dc3a3b9c50de744598d3c8"
|
||||
|
||||
iv length=9
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 48
|
||||
|
||||
Warning: mcrypt_decrypt(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
===DONE===
|
|
@ -1,97 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_cbc() function : basic functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_cbc(int cipher, string key, string data, int mode, string iv)
|
||||
* Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$data = b"This is the secret message which must be encrypted";
|
||||
|
||||
// tripledes uses keys with exactly 192 bits (24 bytes)
|
||||
$keys = array(
|
||||
b'12345678',
|
||||
b'12345678901234567890',
|
||||
b'123456789012345678901234',
|
||||
b'12345678901234567890123456');
|
||||
// tripledes is a block cipher of 64 bits (8 bytes)
|
||||
$ivs = array(
|
||||
b'1234',
|
||||
b'12345678',
|
||||
b'123456789');
|
||||
|
||||
|
||||
$iv = b'12345678';
|
||||
echo "\n--- testing different key lengths\n";
|
||||
foreach ($keys as $key) {
|
||||
echo "\nkey length=".strlen($key)."\n";
|
||||
var_dump(bin2hex(mcrypt_encrypt($cipher, $key, $data, MCRYPT_MODE_CBC, $iv)));
|
||||
}
|
||||
|
||||
$key = b'123456789012345678901234';
|
||||
echo "\n--- testing different iv lengths\n";
|
||||
foreach ($ivs as $iv) {
|
||||
echo "\niv length=".strlen($iv)."\n";
|
||||
var_dump(bin2hex(mcrypt_encrypt($cipher, $key, $data, MCRYPT_MODE_CBC, $iv)));
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
--- testing different key lengths
|
||||
|
||||
key length=8
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 28
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=20
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 28
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=24
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 28
|
||||
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
|
||||
|
||||
key length=26
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 28
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
--- testing different iv lengths
|
||||
|
||||
iv length=4
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 35
|
||||
|
||||
Warning: mcrypt_encrypt(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
iv length=8
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 35
|
||||
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
|
||||
|
||||
iv length=9
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 35
|
||||
|
||||
Warning: mcrypt_encrypt(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
===DONE===
|
|
@ -1,33 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_cfb
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$key = "0123456789012345";
|
||||
$secret = "PHP Testfest 2008";
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_CFB), MCRYPT_RAND);
|
||||
$enc_data = mcrypt_encrypt($cipher, $key, $secret, MCRYPT_MODE_CFB, $iv);
|
||||
|
||||
// we have to trim as AES rounds the blocks and decrypt doesnt detect that
|
||||
echo trim(mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_CFB, $iv)) . "\n";
|
||||
|
||||
// a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
|
||||
var_dump(mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_CFB));
|
||||
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_cfb.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%emcrypt_cfb.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cfb.php on line 7
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cfb.php on line 10
|
||||
PHP Testfest 2008
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cfb.php on line 13
|
||||
|
||||
Warning: mcrypt_decrypt(): Encryption mode requires an initialization vector of size 16 in %s on line %d
|
||||
bool(false)
|
|
@ -1,28 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_create_iv
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$iv1 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_RAND);
|
||||
$iv2 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_DEV_URANDOM);
|
||||
$iv3 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_DEV_RANDOM);
|
||||
|
||||
echo strlen($iv1) . "\n";
|
||||
echo strlen($iv2) . "\n";
|
||||
echo strlen($iv3) . "\n";
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_create_iv.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%emcrypt_create_iv.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_create_iv.php on line 3
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%emcrypt_create_iv.php on line 3
|
||||
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_create_iv.php on line 4
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%emcrypt_create_iv.php on line 4
|
||||
16
|
||||
16
|
||||
16
|
|
@ -1,40 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_decrypt
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$key = "0123456789012345";
|
||||
$secret = "PHP Testfest 2008";
|
||||
$mode = MCRYPT_MODE_CBC;
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, $mode), MCRYPT_RAND);
|
||||
$enc_data = mcrypt_encrypt($cipher, $key, $secret, $mode, $iv);
|
||||
|
||||
// we have to trim as AES rounds the blocks and decrypt doesnt detect that
|
||||
echo trim(mcrypt_decrypt($cipher, $key, $enc_data, $mode, $iv)) . "\n";
|
||||
|
||||
// a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
|
||||
var_dump(mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_CBC));
|
||||
|
||||
var_dump(mcrypt_decrypt(MCRYPT_BLOWFISH, "FooBar", $enc_data, MCRYPT_MODE_CBC, $iv));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_decrypt.php on line 7
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%emcrypt_decrypt.php on line 7
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_decrypt.php on line 8
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt.php on line 11
|
||||
PHP Testfest 2008
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt.php on line 14
|
||||
|
||||
Warning: mcrypt_decrypt(): Encryption mode requires an initialization vector of size 16 in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt.php on line 16
|
||||
|
||||
Warning: mcrypt_decrypt(): Received initialization vector of size 16, but size 8 is required for this encryption mode in %s on line %d
|
||||
bool(false)
|
|
@ -1,119 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_decrypt() function : basic functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_decrypt() : basic functionality ***\n";
|
||||
|
||||
|
||||
// Initialise all required variables
|
||||
$cipher = MCRYPT_3DES;
|
||||
$mode = MCRYPT_MODE_CBC;
|
||||
|
||||
// tripledes uses keys with exactly 192 bits (24 bytes)
|
||||
$keys = array(
|
||||
b'12345678',
|
||||
b'12345678901234567890',
|
||||
b'123456789012345678901234',
|
||||
b'12345678901234567890123456'
|
||||
);
|
||||
$data1 = array(
|
||||
'IleMhoxiOthmHua4tFBHOw==',
|
||||
'EeF1s6C+w1IiHj1gdDn81g==',
|
||||
'EEuXpjZPueyYoG0LGQ199Q==',
|
||||
'EEuXpjZPueyYoG0LGQ199Q=='
|
||||
);
|
||||
// tripledes is a block cipher of 64 bits (8 bytes)
|
||||
$ivs = array(
|
||||
b'1234',
|
||||
b'12345678',
|
||||
b'123456789'
|
||||
);
|
||||
$data2 = array(
|
||||
'+G7nGcWIxij3TZjpI9lJdQ==',
|
||||
'3bJiFMeyScxOLQcE6mZtLg==',
|
||||
'+G7nGcWIxij3TZjpI9lJdQ=='
|
||||
);
|
||||
|
||||
$iv = b'12345678';
|
||||
echo "\n--- testing different key lengths\n";
|
||||
for ($i = 0; $i < sizeof($keys); $i++) {
|
||||
echo "\nkey length=".strlen($keys[$i])."\n";
|
||||
special_var_dump(mcrypt_decrypt($cipher, $keys[$i], base64_decode($data1[$i]), $mode, $iv));
|
||||
}
|
||||
|
||||
$key = b'123456789012345678901234';
|
||||
echo "\n--- testing different iv lengths\n";
|
||||
for ($i = 0; $i < sizeof($ivs); $i++) {
|
||||
echo "\niv length=".strlen($ivs[$i])."\n";
|
||||
special_var_dump(mcrypt_decrypt($cipher, $key, base64_decode($data2[$i]), $mode, $ivs[$i]));
|
||||
}
|
||||
|
||||
function special_var_dump($str) {
|
||||
var_dump(bin2hex($str));
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_decrypt() : basic functionality ***
|
||||
|
||||
--- testing different key lengths
|
||||
|
||||
key length=8
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 44
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=20
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 44
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=24
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 44
|
||||
string(32) "736563726574206d6573736167650000"
|
||||
|
||||
key length=26
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 44
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
--- testing different iv lengths
|
||||
|
||||
iv length=4
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 51
|
||||
|
||||
Warning: mcrypt_decrypt(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
iv length=8
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 51
|
||||
string(32) "659ec947f4dc3a3b9c50de744598d3c8"
|
||||
|
||||
iv length=9
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 51
|
||||
|
||||
Warning: mcrypt_decrypt(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
===DONE===
|
|
@ -1,114 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_decrypt() function : basic functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_decrypt() : basic functionality ***\n";
|
||||
|
||||
|
||||
// Initialise all required variables
|
||||
$cipher = MCRYPT_3DES;
|
||||
$mode = MCRYPT_MODE_ECB;
|
||||
|
||||
// tripledes uses keys with exactly 192 bits (24 bytes)
|
||||
$keys = array(
|
||||
b'12345678',
|
||||
b'12345678901234567890',
|
||||
b'123456789012345678901234',
|
||||
b'12345678901234567890123456'
|
||||
);
|
||||
$data1 = array(
|
||||
'0D4ArM3ejyhic9rnCcIW9A==',
|
||||
'q0wt1YeOjLpnKm5WsrzKEw==',
|
||||
'zwKEFeqHkhlj+7HZTRA/yA==',
|
||||
'zwKEFeqHkhlj+7HZTRA/yA=='
|
||||
);
|
||||
// tripledes is a block cipher of 64 bits (8 bytes)
|
||||
$ivs = array(
|
||||
b'1234',
|
||||
b'12345678',
|
||||
b'123456789'
|
||||
);
|
||||
$data2 = array(
|
||||
'+G7nGcWIxigQcJD+2P14HA==',
|
||||
'+G7nGcWIxigQcJD+2P14HA==',
|
||||
'+G7nGcWIxigQcJD+2P14HA=='
|
||||
);
|
||||
|
||||
echo "\n--- testing different key lengths\n";
|
||||
for ($i = 0; $i < sizeof($keys); $i++) {
|
||||
echo "\nkey length=".strlen($keys[$i])."\n";
|
||||
special_var_dump(mcrypt_decrypt($cipher, $keys[$i], base64_decode($data1[$i]), $mode));
|
||||
}
|
||||
|
||||
$key = b'123456789012345678901234';
|
||||
echo "\n--- testing different iv lengths\n";
|
||||
for ($i = 0; $i < sizeof($ivs); $i++) {
|
||||
echo "\niv length=".strlen($ivs[$i])."\n";
|
||||
special_var_dump(mcrypt_decrypt($cipher, $key, base64_decode($data2[$i]), $mode, $ivs[$i]));
|
||||
}
|
||||
|
||||
function special_var_dump($str) {
|
||||
var_dump(bin2hex($str));
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_decrypt() : basic functionality ***
|
||||
|
||||
--- testing different key lengths
|
||||
|
||||
key length=8
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 43
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=20
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 43
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=24
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 43
|
||||
string(32) "736563726574206d6573736167650000"
|
||||
|
||||
key length=26
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 43
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
--- testing different iv lengths
|
||||
|
||||
iv length=4
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 50
|
||||
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
|
||||
|
||||
iv length=8
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 50
|
||||
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
|
||||
|
||||
iv length=9
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 50
|
||||
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
|
||||
===DONE===
|
|
@ -1,55 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_decrypt() function : error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_decrypt() : error conditions ***\n";
|
||||
|
||||
|
||||
//Test mcrypt_decrypt with one more than the expected number of arguments
|
||||
echo "\n-- Testing mcrypt_decrypt() function with more than expected no. of arguments --\n";
|
||||
$cipher = 'string_val';
|
||||
$key = 'string_val';
|
||||
$data = 'string_val';
|
||||
$mode = 'string_val';
|
||||
$iv = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( mcrypt_decrypt($cipher, $key, $data, $mode, $iv, $extra_arg) );
|
||||
|
||||
// Testing mcrypt_decrypt with one less than the expected number of arguments
|
||||
echo "\n-- Testing mcrypt_decrypt() function with less than expected no. of arguments --\n";
|
||||
$cipher = 'string_val';
|
||||
$key = 'string_val';
|
||||
$data = 'string_val';
|
||||
var_dump( mcrypt_decrypt($cipher, $key, $data) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_decrypt() : error conditions ***
|
||||
|
||||
-- Testing mcrypt_decrypt() function with more than expected no. of arguments --
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_error.php on line 19
|
||||
|
||||
Warning: mcrypt_decrypt() expects at most 5 parameters, 6 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing mcrypt_decrypt() function with less than expected no. of arguments --
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_error.php on line 26
|
||||
|
||||
Warning: mcrypt_decrypt() expects at least 4 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
|
@ -1,255 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_decrypt() function : usage variation
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_decrypt() : usage variation ***\n";
|
||||
|
||||
// Define error handler
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
if (error_reporting() != 0) {
|
||||
// report non-silenced errors
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
}
|
||||
}
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
$key = b'string_val';
|
||||
$data = b'string_val';
|
||||
$mode = MCRYPT_MODE_ECB;
|
||||
$iv = b'string_val';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// define some classes
|
||||
class classWithToString
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
class classWithoutToString
|
||||
{
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// add arrays
|
||||
$index_array = array (1, 2, 3);
|
||||
$assoc_array = array ('one' => 1, 'two' => 2);
|
||||
|
||||
//array of values to iterate over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
|
||||
// null data
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// object data
|
||||
'instance of classWithToString' => new classWithToString(),
|
||||
'instance of classWithoutToString' => new classWithoutToString(),
|
||||
|
||||
// undefined data
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
// resource variable
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of the array for cipher
|
||||
|
||||
foreach($inputs as $valueType =>$value) {
|
||||
echo "\n--$valueType--\n";
|
||||
var_dump( mcrypt_decrypt($value, $key, $data, $mode, $iv) );
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_decrypt() : usage variation ***
|
||||
|
||||
--int 0--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int 1--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int 12345--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int -12345--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float 10.5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float -10.5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float 12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float -12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float .5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 1 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--int indexed array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 1 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--associative array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 1 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--nested arrays--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 1 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--uppercase NULL--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase null--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase true--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase false--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--uppercase TRUE--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--uppercase FALSE--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty string DQ--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty string SQ--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--instance of classWithToString--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 1 to be string, object given, %s(%d)
|
||||
NULL
|
||||
|
||||
--undefined var--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--unset var--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--resource--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 1 to be string, resource given, %s(%d)
|
||||
NULL
|
||||
===DONE===
|
|
@ -1,255 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_decrypt() function : usage variation
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_decrypt() : usage variation ***\n";
|
||||
|
||||
// Define error handler
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
if (error_reporting() != 0) {
|
||||
// report non-silenced errors
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
}
|
||||
}
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$data = b'string_val';
|
||||
$mode = MCRYPT_MODE_ECB;
|
||||
$iv = b'01234567';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// define some classes
|
||||
class classWithToString
|
||||
{
|
||||
public function __toString() {
|
||||
return b"Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
class classWithoutToString
|
||||
{
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = b<<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// add arrays
|
||||
$index_array = array (1, 2, 3);
|
||||
$assoc_array = array ('one' => 1, 'two' => 2);
|
||||
|
||||
//array of values to iterate over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
|
||||
// null data
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// object data
|
||||
'instance of classWithToString' => new classWithToString(),
|
||||
'instance of classWithoutToString' => new classWithoutToString(),
|
||||
|
||||
// undefined data
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
// resource variable
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of the array for key
|
||||
|
||||
foreach($inputs as $valueType =>$value) {
|
||||
echo "\n--$valueType--\n";
|
||||
var_dump( bin2hex(mcrypt_decrypt($cipher, $value, $data, $mode, $iv)));
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_decrypt() : usage variation ***
|
||||
|
||||
--int 0--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int 1--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int 12345--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int -12345--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float 10.5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float -10.5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float 12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float -12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float .5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int indexed array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--associative array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--nested arrays--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase NULL--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase null--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase true--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase false--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase TRUE--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase FALSE--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty string DQ--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty string SQ--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--instance of classWithToString--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, object given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--undefined var--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--unset var--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--resource--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, resource given, %s(%d)
|
||||
string(0) ""
|
||||
===DONE===
|
|
@ -1,235 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_decrypt() function : usage variation
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_decrypt() : usage variation ***\n";
|
||||
|
||||
// Define error handler
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
if (error_reporting() != 0) {
|
||||
// report non-silenced errors
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
}
|
||||
}
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
||||
$mode = MCRYPT_MODE_ECB;
|
||||
$iv = b'01234567';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// define some classes
|
||||
class classWithToString
|
||||
{
|
||||
public function __toString() {
|
||||
return b"Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
class classWithoutToString
|
||||
{
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = b<<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// add arrays
|
||||
$index_array = array (1, 2, 3);
|
||||
$assoc_array = array ('one' => 1, 'two' => 2);
|
||||
|
||||
//array of values to iterate over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
|
||||
// null data
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// object data
|
||||
'instance of classWithToString' => new classWithToString(),
|
||||
'instance of classWithoutToString' => new classWithoutToString(),
|
||||
|
||||
// undefined data
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
// resource variable
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of the array for data
|
||||
|
||||
foreach($inputs as $valueType =>$value) {
|
||||
echo "\n--$valueType--\n";
|
||||
var_dump(bin2hex(mcrypt_decrypt($cipher, $key, $value, $mode, $iv)));
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_decrypt() : usage variation ***
|
||||
|
||||
--int 0--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "52833a00168e547f"
|
||||
|
||||
--int 1--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "82011a0a93098a13"
|
||||
|
||||
--int 12345--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "e8b71c21b6acc162"
|
||||
|
||||
--int -12345--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "db3c458e975563a8"
|
||||
|
||||
--float 10.5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "6ee8764562f25913"
|
||||
|
||||
--float -10.5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "d63b39fd5f65678e"
|
||||
|
||||
--float 12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(32) "7712cc4828221be40672239d9c32e742"
|
||||
|
||||
--float -12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(32) "caa892cb5d28b53c2b75b1e0799427c3"
|
||||
|
||||
--float .5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "99880c86884385d9"
|
||||
|
||||
--empty array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 3 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int indexed array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 3 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--associative array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 3 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--nested arrays--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 3 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase NULL--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "d27689f6fd9700f4"
|
||||
|
||||
--lowercase null--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "d27689f6fd9700f4"
|
||||
|
||||
--lowercase true--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "82011a0a93098a13"
|
||||
|
||||
--lowercase false--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "d27689f6fd9700f4"
|
||||
|
||||
--uppercase TRUE--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "82011a0a93098a13"
|
||||
|
||||
--uppercase FALSE--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "d27689f6fd9700f4"
|
||||
|
||||
--empty string DQ--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "d27689f6fd9700f4"
|
||||
|
||||
--empty string SQ--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "d27689f6fd9700f4"
|
||||
|
||||
--instance of classWithToString--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(32) "46677e368bc07ef375bd580e0c4b2594"
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 3 to be string, object given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--undefined var--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "d27689f6fd9700f4"
|
||||
|
||||
--unset var--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
string(16) "d27689f6fd9700f4"
|
||||
|
||||
--resource--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 3 to be string, resource given, %s(%d)
|
||||
string(0) ""
|
||||
===DONE===
|
|
@ -1,255 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_decrypt() function : usage variation
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_decrypt() : usage variation ***\n";
|
||||
|
||||
// Define error handler
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
if (error_reporting() != 0) {
|
||||
// report non-silenced errors
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
}
|
||||
}
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$key = b'string_val';
|
||||
$data = b'string_val';
|
||||
$iv = b'01234567';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// define some classes
|
||||
class classWithToString
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
class classWithoutToString
|
||||
{
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// add arrays
|
||||
$index_array = array (1, 2, 3);
|
||||
$assoc_array = array ('one' => 1, 'two' => 2);
|
||||
|
||||
//array of values to iterate over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
|
||||
// null data
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// object data
|
||||
'instance of classWithToString' => new classWithToString(),
|
||||
'instance of classWithoutToString' => new classWithoutToString(),
|
||||
|
||||
// undefined data
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
// resource variable
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of the array for mode
|
||||
|
||||
foreach($inputs as $valueType =>$value) {
|
||||
echo "\n--$valueType--\n";
|
||||
var_dump( mcrypt_decrypt($cipher, $key, $data, $value, $iv) );
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_decrypt() : usage variation ***
|
||||
|
||||
--int 0--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int 1--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int 12345--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int -12345--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float 10.5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float -10.5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float 12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float -12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float .5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--int indexed array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--associative array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--nested arrays--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--uppercase NULL--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase null--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase true--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase false--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--uppercase TRUE--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--uppercase FALSE--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty string DQ--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty string SQ--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--instance of classWithToString--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, object given, %s(%d)
|
||||
NULL
|
||||
|
||||
--undefined var--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--unset var--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--resource--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, resource given, %s(%d)
|
||||
NULL
|
||||
===DONE===
|
|
@ -1,255 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_decrypt() function : usage variation
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_decrypt() : usage variation ***\n";
|
||||
|
||||
// Define error handler
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
if (error_reporting() != 0) {
|
||||
// report non-silenced errors
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
}
|
||||
}
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
||||
$data = b'string_val';
|
||||
$mode = MCRYPT_MODE_CBC;
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// define some classes
|
||||
class classWithToString
|
||||
{
|
||||
public function __toString() {
|
||||
return b"Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
class classWithoutToString
|
||||
{
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = b<<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// add arrays
|
||||
$index_array = array (1, 2, 3);
|
||||
$assoc_array = array ('one' => 1, 'two' => 2);
|
||||
|
||||
//array of values to iterate over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
|
||||
// null data
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// object data
|
||||
'instance of classWithToString' => new classWithToString(),
|
||||
'instance of classWithoutToString' => new classWithoutToString(),
|
||||
|
||||
// undefined data
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
// resource variable
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of the array for iv
|
||||
|
||||
foreach($inputs as $valueType =>$value) {
|
||||
echo "\n--$valueType--\n";
|
||||
var_dump(bin2hex(mcrypt_decrypt($cipher, $key, $data, $mode, $value)));
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_decrypt() : usage variation ***
|
||||
|
||||
--int 0--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int 1--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int 12345--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int -12345--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float 10.5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float -10.5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float 12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float -12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float .5--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int indexed array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--associative array--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--nested arrays--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase NULL--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase null--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase true--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase false--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase TRUE--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase FALSE--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty string DQ--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty string SQ--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--instance of classWithToString--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, object given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--undefined var--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--unset var--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--resource--
|
||||
Error: 8192 - Function mcrypt_decrypt() is deprecated, %s%emcrypt_decrypt_variation5.php(107)
|
||||
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, resource given, %s(%d)
|
||||
string(0) ""
|
||||
===DONE===
|
|
@ -1,30 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_ecb
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$key = "0123456789012345";
|
||||
$secret = "PHP Testfest 2008";
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND);
|
||||
$enc_data = mcrypt_encrypt($cipher, $key, $secret, MCRYPT_MODE_ECB, $iv);
|
||||
|
||||
// we have to trim as AES rounds the blocks and decrypt doesnt detect that
|
||||
echo trim(mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_ECB, $iv)) . "\n";
|
||||
|
||||
// a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
|
||||
mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_ECB);
|
||||
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_ecb.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%emcrypt_ecb.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb.php on line 7
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb.php on line 10
|
||||
PHP Testfest 2008
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb.php on line 13
|
|
@ -1,111 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_cbc() function : basic functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
/* Prototype : string mcrypt_ecb(int cipher, string key, string data, int mode, string iv)
|
||||
* Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$data = b"This is the secret message which must be encrypted";
|
||||
|
||||
// tripledes uses keys up to 192 bits (24 bytes)
|
||||
$keys = array(
|
||||
b'12345678',
|
||||
b'12345678901234567890',
|
||||
b'123456789012345678901234',
|
||||
b'12345678901234567890123456'
|
||||
);
|
||||
$data1 = array(
|
||||
'0D4ArM3ejyhic9rnCcIW9A==',
|
||||
'q0wt1YeOjLpnKm5WsrzKEw==',
|
||||
'zwKEFeqHkhlj+7HZTRA/yA==',
|
||||
'zwKEFeqHkhlj+7HZTRA/yA=='
|
||||
);
|
||||
// tripledes is a block cipher of 64 bits (8 bytes)
|
||||
$ivs = array(
|
||||
b'1234',
|
||||
b'12345678',
|
||||
b'123456789'
|
||||
);
|
||||
$data2 = array(
|
||||
'+G7nGcWIxigQcJD+2P14HA==',
|
||||
'+G7nGcWIxigQcJD+2P14HA==',
|
||||
'+G7nGcWIxigQcJD+2P14HA=='
|
||||
);
|
||||
|
||||
$iv = b'12345678';
|
||||
echo "\n--- testing different key lengths\n";
|
||||
for ($i = 0; $i < sizeof($keys); $i++) {
|
||||
echo "\nkey length=".strlen($keys[$i])."\n";
|
||||
special_var_dump(mcrypt_decrypt($cipher, $keys[$i], base64_decode($data1[$i]), MCRYPT_MODE_ECB, $iv));
|
||||
}
|
||||
|
||||
$key = b'123456789012345678901234';
|
||||
echo "\n--- testing different iv lengths\n";
|
||||
for ($i = 0; $i < sizeof($ivs); $i++) {
|
||||
echo "\niv length=".strlen($ivs[$i])."\n";
|
||||
special_var_dump(mcrypt_decrypt($cipher, $key, base64_decode($data2[$i]), MCRYPT_MODE_ECB, $ivs[$i]));
|
||||
}
|
||||
|
||||
function special_var_dump($str) {
|
||||
var_dump(bin2hex($str));
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
--- testing different key lengths
|
||||
|
||||
key length=8
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 42
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=20
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 42
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=24
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 42
|
||||
string(32) "736563726574206d6573736167650000"
|
||||
|
||||
key length=26
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 42
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
--- testing different iv lengths
|
||||
|
||||
iv length=4
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 49
|
||||
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
|
||||
|
||||
iv length=8
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 49
|
||||
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
|
||||
|
||||
iv length=9
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 49
|
||||
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
|
||||
===DONE===
|
|
@ -1,96 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_ecb() function : basic functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
/* Prototype : string mcrypt_ecb(int cipher, string key, string data, int mode, string iv)
|
||||
* Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$data = b"This is the secret message which must be encrypted";
|
||||
|
||||
// tripledes uses keys up to 192 bits (24 bytes)
|
||||
$keys = array(
|
||||
b'12345678',
|
||||
b'12345678901234567890',
|
||||
b'123456789012345678901234',
|
||||
b'12345678901234567890123456'
|
||||
);
|
||||
// tripledes is a block cipher of 64 bits (8 bytes)
|
||||
$ivs = array(
|
||||
b'1234',
|
||||
b'12345678',
|
||||
b'123456789'
|
||||
);
|
||||
|
||||
$iv = b'12345678';
|
||||
echo "\n--- testing different key lengths\n";
|
||||
foreach ($keys as $key) {
|
||||
echo "\nkey length=".strlen($key)."\n";
|
||||
var_dump(bin2hex(mcrypt_encrypt($cipher, $key, $data, MCRYPT_MODE_ECB, $iv)));
|
||||
}
|
||||
|
||||
$key = b"1234567890123456\0\0\0\0\0\0\0\0";
|
||||
echo "\n--- testing different iv lengths\n";
|
||||
foreach ($ivs as $iv) {
|
||||
echo "\niv length=".strlen($iv)."\n";
|
||||
var_dump(bin2hex(mcrypt_encrypt($cipher, $key, $data, MCRYPT_MODE_ECB, $iv)));
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
--- testing different key lengths
|
||||
|
||||
key length=8
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 31
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=20
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 31
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=24
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 31
|
||||
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
|
||||
|
||||
key length=26
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 31
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
--- testing different iv lengths
|
||||
|
||||
iv length=4
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 38
|
||||
string(112) "440a6f54601969b15e81df09cd381ef585fede5f3620587fd1a949c520aed9f6d10ebbabf2cea3e1f04c9251c2878c0ca37d51c80d490165"
|
||||
|
||||
iv length=8
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 38
|
||||
string(112) "440a6f54601969b15e81df09cd381ef585fede5f3620587fd1a949c520aed9f6d10ebbabf2cea3e1f04c9251c2878c0ca37d51c80d490165"
|
||||
|
||||
iv length=9
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 38
|
||||
string(112) "440a6f54601969b15e81df09cd381ef585fede5f3620587fd1a949c520aed9f6d10ebbabf2cea3e1f04c9251c2878c0ca37d51c80d490165"
|
||||
===DONE===
|
|
@ -1,41 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_enc_get_algorithms_name
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open('rijndael-128', '', MCRYPT_MODE_ECB, '');
|
||||
echo mcrypt_enc_get_algorithms_name($td) . "\n";
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, '');
|
||||
echo mcrypt_enc_get_algorithms_name($td) . "\n";
|
||||
$td = mcrypt_module_open(MCRYPT_RC2, '', MCRYPT_MODE_CBC, '');
|
||||
echo mcrypt_enc_get_algorithms_name($td) . "\n";
|
||||
$td = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, '');
|
||||
echo mcrypt_enc_get_algorithms_name($td) . "\n";
|
||||
$td = mcrypt_module_open('des', '', 'ecb', '');
|
||||
echo mcrypt_enc_get_algorithms_name($td) . "\n";
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_algorithms_name.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_algorithms_name() is deprecated in %s%emcrypt_enc_get_algorithms_name.php on line 3
|
||||
Rijndael-128
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_algorithms_name.php on line 4
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_algorithms_name() is deprecated in %s%emcrypt_enc_get_algorithms_name.php on line 5
|
||||
Rijndael-128
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_algorithms_name.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_algorithms_name() is deprecated in %s%emcrypt_enc_get_algorithms_name.php on line 7
|
||||
RC2
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_algorithms_name.php on line 8
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_algorithms_name() is deprecated in %s%emcrypt_enc_get_algorithms_name.php on line 9
|
||||
Blowfish
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_algorithms_name.php on line 10
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_algorithms_name() is deprecated in %s%emcrypt_enc_get_algorithms_name.php on line 11
|
||||
DES
|
|
@ -1,27 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_enc_get_block_size
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
|
||||
var_dump(mcrypt_enc_get_block_size($td));
|
||||
$td = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
|
||||
var_dump(mcrypt_enc_get_block_size($td));
|
||||
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
|
||||
var_dump(mcrypt_enc_get_block_size($td));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_block_size.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_block_size() is deprecated in %s%emcrypt_enc_get_block_size.php on line 3
|
||||
int(32)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_block_size.php on line 4
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_block_size() is deprecated in %s%emcrypt_enc_get_block_size.php on line 5
|
||||
int(8)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_block_size.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_block_size() is deprecated in %s%emcrypt_enc_get_block_size.php on line 7
|
||||
int(1)
|
|
@ -1,27 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_enc_get_iv_size
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
|
||||
var_dump(mcrypt_enc_get_iv_size($td));
|
||||
$td = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
|
||||
var_dump(mcrypt_enc_get_iv_size($td));
|
||||
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
|
||||
var_dump(mcrypt_enc_get_iv_size($td));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_iv_size.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_iv_size() is deprecated in %s%emcrypt_enc_get_iv_size.php on line 3
|
||||
int(32)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_iv_size.php on line 4
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_iv_size() is deprecated in %s%emcrypt_enc_get_iv_size.php on line 5
|
||||
int(8)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_iv_size.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_iv_size() is deprecated in %s%emcrypt_enc_get_iv_size.php on line 7
|
||||
int(0)
|
|
@ -1,27 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_enc_get_key_size
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
|
||||
var_dump(mcrypt_enc_get_key_size($td));
|
||||
$td = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
|
||||
var_dump(mcrypt_enc_get_key_size($td));
|
||||
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
|
||||
var_dump(mcrypt_enc_get_key_size($td));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_key_size.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_key_size() is deprecated in %s%emcrypt_enc_get_key_size.php on line 3
|
||||
int(32)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_key_size.php on line 4
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_key_size() is deprecated in %s%emcrypt_enc_get_key_size.php on line 5
|
||||
int(24)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_key_size.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_key_size() is deprecated in %s%emcrypt_enc_get_key_size.php on line 7
|
||||
int(32)
|
|
@ -1,48 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_enc_get_modes_name
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open('rijndael-128', '', MCRYPT_MODE_ECB, '');
|
||||
echo mcrypt_enc_get_modes_name($td) . "\n";
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
|
||||
echo mcrypt_enc_get_modes_name($td) . "\n";
|
||||
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
|
||||
echo mcrypt_enc_get_modes_name($td) . "\n";
|
||||
$td = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_OFB, '');
|
||||
echo mcrypt_enc_get_modes_name($td) . "\n";
|
||||
$td = mcrypt_module_open('des', '', 'ecb', '');
|
||||
echo mcrypt_enc_get_modes_name($td) . "\n";
|
||||
$td = mcrypt_module_open('des', '', 'cbc', '');
|
||||
echo mcrypt_enc_get_modes_name($td) . "\n";
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_modes_name() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 3
|
||||
ECB
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 4
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_modes_name() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 5
|
||||
CBC
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_modes_name() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 7
|
||||
STREAM
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 8
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_modes_name() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 9
|
||||
OFB
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 10
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_modes_name() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 11
|
||||
ECB
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 12
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_modes_name() is deprecated in %s%emcrypt_enc_get_mode_name.php on line 13
|
||||
CBC
|
|
@ -1,21 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_enc_get_supported_key_sizes
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open('rijndael-256', '', 'ecb', '');
|
||||
$var = mcrypt_enc_get_supported_key_sizes($td);
|
||||
var_dump($var);
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_get_supported_key_sizes.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_enc_get_supported_key_sizes() is deprecated in %s%emcrypt_enc_get_supported_key_sizes.php on line 3
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(16)
|
||||
[1]=>
|
||||
int(24)
|
||||
[2]=>
|
||||
int(32)
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_enc_is_block_algorithm
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
|
||||
var_dump(mcrypt_enc_is_block_algorithm($td));
|
||||
$td = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
|
||||
var_dump(mcrypt_enc_is_block_algorithm($td));
|
||||
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
|
||||
var_dump(mcrypt_enc_is_block_algorithm($td));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_is_block_algorithm.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_enc_is_block_algorithm() is deprecated in %s%emcrypt_enc_is_block_algorithm.php on line 3
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_is_block_algorithm.php on line 4
|
||||
|
||||
Deprecated: Function mcrypt_enc_is_block_algorithm() is deprecated in %s%emcrypt_enc_is_block_algorithm.php on line 5
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_is_block_algorithm.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_enc_is_block_algorithm() is deprecated in %s%emcrypt_enc_is_block_algorithm.php on line 7
|
||||
bool(false)
|
|
@ -1,27 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_enc_is_block_algorithm_mode
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_ECB, '');
|
||||
var_dump(mcrypt_enc_is_block_algorithm_mode($td));
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
|
||||
var_dump(mcrypt_enc_is_block_algorithm_mode($td));
|
||||
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
|
||||
var_dump(mcrypt_enc_is_block_algorithm_mode($td));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_is_block_algorithm_mode.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_enc_is_block_algorithm_mode() is deprecated in %s%emcrypt_enc_is_block_algorithm_mode.php on line 3
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_is_block_algorithm_mode.php on line 4
|
||||
|
||||
Deprecated: Function mcrypt_enc_is_block_algorithm_mode() is deprecated in %s%emcrypt_enc_is_block_algorithm_mode.php on line 5
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_is_block_algorithm_mode.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_enc_is_block_algorithm_mode() is deprecated in %s%emcrypt_enc_is_block_algorithm_mode.php on line 7
|
||||
bool(false)
|
|
@ -1,34 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_enc_is_block_mode
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
|
||||
var_dump(mcrypt_enc_is_block_mode($td));
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_ECB, '');
|
||||
var_dump(mcrypt_enc_is_block_mode($td));
|
||||
$td = mcrypt_module_open(MCRYPT_ARCFOUR, '', MCRYPT_MODE_STREAM, '');
|
||||
var_dump(mcrypt_enc_is_block_mode($td));
|
||||
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
|
||||
var_dump(mcrypt_enc_is_block_mode($td));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_is_block_mode.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_enc_is_block_mode() is deprecated in %s%emcrypt_enc_is_block_mode.php on line 3
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_is_block_mode.php on line 4
|
||||
|
||||
Deprecated: Function mcrypt_enc_is_block_mode() is deprecated in %s%emcrypt_enc_is_block_mode.php on line 5
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_is_block_mode.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_enc_is_block_mode() is deprecated in %s%emcrypt_enc_is_block_mode.php on line 7
|
||||
bool(false)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_is_block_mode.php on line 8
|
||||
|
||||
Deprecated: Function mcrypt_enc_is_block_mode() is deprecated in %s%emcrypt_enc_is_block_mode.php on line 9
|
||||
bool(false)
|
|
@ -1,13 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_enc_self_test
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
|
||||
var_dump(mcrypt_enc_self_test($td));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_enc_self_test.php on line 2
|
||||
|
||||
Deprecated: Function mcrypt_enc_self_test() is deprecated in %s%emcrypt_enc_self_test.php on line 3
|
||||
int(0)
|
|
@ -1,112 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_encrypt() function : TripleDES functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_encrypt() : TripleDES functionality ***\n";
|
||||
|
||||
//test CBC, ECB modes
|
||||
//test encrypt decrypt
|
||||
//test tripledes, aes
|
||||
//test different lengths of key, iv
|
||||
//test no iv being passed on CBC, ECB
|
||||
//test up to 32 bytes with unlimited strength
|
||||
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$mode = MCRYPT_MODE_CBC;
|
||||
$data = b'This is the secret message which must be encrypted';
|
||||
|
||||
// tripledes uses keys up to 192 bits (24 bytes)
|
||||
$keys = array(
|
||||
b'12345678',
|
||||
b'12345678901234567890',
|
||||
b'123456789012345678901234',
|
||||
b'12345678901234567890123456'
|
||||
);
|
||||
// tripledes is a block cipher of 64 bits (8 bytes)
|
||||
$ivs = array(
|
||||
b'1234',
|
||||
b'12345678',
|
||||
b'123456789'
|
||||
);
|
||||
|
||||
|
||||
$iv = b'12345678';
|
||||
echo "\n--- testing different key lengths\n";
|
||||
foreach ($keys as $key) {
|
||||
echo "\nkey length=".strlen($key)."\n";
|
||||
var_dump(bin2hex(mcrypt_encrypt($cipher, $key, $data, $mode, $iv)));
|
||||
}
|
||||
|
||||
$key = b'123456789012345678901234';
|
||||
echo "\n--- testing different iv lengths\n";
|
||||
foreach ($ivs as $iv) {
|
||||
echo "\niv length=".strlen($iv)."\n";
|
||||
var_dump(bin2hex(mcrypt_encrypt($cipher, $key, $data, $mode, $iv)));
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_encrypt() : TripleDES functionality ***
|
||||
|
||||
--- testing different key lengths
|
||||
|
||||
key length=8
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 40
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=20
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 40
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=24
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 40
|
||||
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
|
||||
|
||||
key length=26
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 40
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
--- testing different iv lengths
|
||||
|
||||
iv length=4
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 47
|
||||
|
||||
Warning: mcrypt_encrypt(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
iv length=8
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 47
|
||||
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
|
||||
|
||||
iv length=9
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 47
|
||||
|
||||
Warning: mcrypt_encrypt(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
===DONE===
|
|
@ -1,100 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_encrypt() function : TripleDES functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_encrypt() : TripleDES functionality ***\n";
|
||||
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$mode = MCRYPT_MODE_ECB;
|
||||
$data = b'This is the secret message which must be encrypted';
|
||||
|
||||
// tripledes uses keys up to 192 bits (24 bytes)
|
||||
$keys = array(
|
||||
b'12345678',
|
||||
b'12345678901234567890',
|
||||
b'123456789012345678901234',
|
||||
b'12345678901234567890123456'
|
||||
);
|
||||
|
||||
echo "\n--- testing different key lengths\n";
|
||||
foreach ($keys as $key) {
|
||||
echo "\nkey length=".strlen($key)."\n";
|
||||
var_dump(bin2hex(mcrypt_encrypt($cipher, $key, $data, $mode)));
|
||||
}
|
||||
|
||||
$key = b'123456789012345678901234';
|
||||
$ivs = array(
|
||||
b'1234',
|
||||
b'12345678',
|
||||
b'123456789'
|
||||
);
|
||||
|
||||
// ivs should be ignored in ecb mode
|
||||
echo "\n--- testing different iv lengths\n";
|
||||
foreach ($ivs as $iv) {
|
||||
echo "\niv length=".strlen($iv)."\n";
|
||||
var_dump(bin2hex(mcrypt_encrypt($cipher, $key, $data, $mode, $iv)));
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_encrypt() : TripleDES functionality ***
|
||||
|
||||
--- testing different key lengths
|
||||
|
||||
key length=8
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 25
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=20
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 25
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=24
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 25
|
||||
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
|
||||
|
||||
key length=26
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 25
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
--- testing different iv lengths
|
||||
|
||||
iv length=4
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 39
|
||||
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
|
||||
|
||||
iv length=8
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 39
|
||||
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
|
||||
|
||||
iv length=9
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 39
|
||||
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
|
||||
===DONE===
|
|
@ -1,56 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_encrypt() function : error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_encrypt() : error conditions ***\n";
|
||||
|
||||
|
||||
//Test mcrypt_encrypt with one more than the expected number of arguments
|
||||
echo "\n-- Testing mcrypt_encrypt() function with more than expected no. of arguments --\n";
|
||||
$cipher = 'string_val';
|
||||
$key = 'string_val';
|
||||
$data = 'string_val';
|
||||
$mode = 'string_val';
|
||||
$iv = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( mcrypt_encrypt($cipher, $key, $data, $mode, $iv, $extra_arg) );
|
||||
|
||||
// Testing mcrypt_encrypt with one less than the expected number of arguments
|
||||
echo "\n-- Testing mcrypt_encrypt() function with less than expected no. of arguments --\n";
|
||||
$cipher = 'string_val';
|
||||
$key = 'string_val';
|
||||
$data = 'string_val';
|
||||
var_dump( mcrypt_encrypt($cipher, $key, $data) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_encrypt() : error conditions ***
|
||||
|
||||
-- Testing mcrypt_encrypt() function with more than expected no. of arguments --
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_error.php on line 19
|
||||
|
||||
Warning: mcrypt_encrypt() expects at most 5 parameters, 6 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing mcrypt_encrypt() function with less than expected no. of arguments --
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_error.php on line 26
|
||||
|
||||
Warning: mcrypt_encrypt() expects at least 4 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
|
|
@ -1,256 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_encrypt() function : usage variation - different types for cipher
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_encrypt() : usage variation ***\n";
|
||||
|
||||
// Define error handler
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
if (error_reporting() != 0) {
|
||||
// report non-silenced errors
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
}
|
||||
}
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
$key = b'string_val';
|
||||
$data = b'string_val';
|
||||
$mode = MCRYPT_MODE_ECB;
|
||||
$iv = b'string_val';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// define some classes
|
||||
class classWithToString
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
class classWithoutToString
|
||||
{
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// add arrays
|
||||
$index_array = array (1, 2, 3);
|
||||
$assoc_array = array ('one' => 1, 'two' => 2);
|
||||
|
||||
//array of values to iterate over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
|
||||
// null data
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// object data
|
||||
'instance of classWithToString' => new classWithToString(),
|
||||
'instance of classWithoutToString' => new classWithoutToString(),
|
||||
|
||||
// undefined data
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
// resource variable
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of the array for cipher
|
||||
|
||||
foreach($inputs as $valueType =>$value) {
|
||||
echo "\n--$valueType--\n";
|
||||
var_dump( mcrypt_encrypt($value, $key, $data, $mode, $iv) );
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_encrypt() : usage variation ***
|
||||
|
||||
--int 0--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int 1--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int 12345--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int -12345--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float 10.5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float -10.5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float 12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float -12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float .5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 1 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--int indexed array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 1 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--associative array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 1 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--nested arrays--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 1 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--uppercase NULL--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase null--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase true--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase false--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--uppercase TRUE--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--uppercase FALSE--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty string DQ--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty string SQ--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--instance of classWithToString--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 1 to be string, object given, %s(%d)
|
||||
NULL
|
||||
|
||||
--undefined var--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--unset var--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--resource--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation1.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 1 to be string, resource given, %s(%d)
|
||||
NULL
|
||||
===DONE===
|
||||
|
|
@ -1,256 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_encrypt() function : usage variation
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_encrypt() : usage variation ***\n";
|
||||
|
||||
// Define error handler
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
if (error_reporting() != 0) {
|
||||
// report non-silenced errors
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
}
|
||||
}
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$data = b'string_val';
|
||||
$mode = MCRYPT_MODE_ECB;
|
||||
$iv = b'01234567';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// define some classes
|
||||
class classWithToString
|
||||
{
|
||||
public function __toString() {
|
||||
return b"Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
class classWithoutToString
|
||||
{
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = b<<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// add arrays
|
||||
$index_array = array (1, 2, 3);
|
||||
$assoc_array = array ('one' => 1, 'two' => 2);
|
||||
|
||||
//array of values to iterate over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
|
||||
// null data
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// object data
|
||||
'instance of classWithToString' => new classWithToString(),
|
||||
'instance of classWithoutToString' => new classWithoutToString(),
|
||||
|
||||
// undefined data
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
// resource variable
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of the array for key
|
||||
|
||||
foreach($inputs as $valueType =>$value) {
|
||||
echo "\n--$valueType--\n";
|
||||
var_dump( bin2hex(mcrypt_encrypt($cipher, $value, $data, $mode, $iv) ));
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_encrypt() : usage variation ***
|
||||
|
||||
--int 0--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int 1--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int 12345--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int -12345--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float 10.5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float -10.5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float 12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float -12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float .5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int indexed array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--associative array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--nested arrays--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase NULL--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase null--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase true--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase false--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase TRUE--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase FALSE--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty string DQ--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty string SQ--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--instance of classWithToString--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, object given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--undefined var--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--unset var--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--resource--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation2.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, resource given, %s(%d)
|
||||
string(0) ""
|
||||
===DONE===
|
||||
|
|
@ -1,236 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_encrypt() function : usage variation
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_encrypt() : usage variation ***\n";
|
||||
|
||||
// Define error handler
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
if (error_reporting() != 0) {
|
||||
// report non-silenced errors
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
}
|
||||
}
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
||||
$mode = MCRYPT_MODE_ECB;
|
||||
$iv = b'01234567';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// define some classes
|
||||
class classWithToString
|
||||
{
|
||||
public function __toString() {
|
||||
return b"Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
class classWithoutToString
|
||||
{
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = b<<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// add arrays
|
||||
$index_array = array (1, 2, 3);
|
||||
$assoc_array = array ('one' => 1, 'two' => 2);
|
||||
|
||||
//array of values to iterate over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
|
||||
// null data
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// object data
|
||||
'instance of classWithToString' => new classWithToString(),
|
||||
'instance of classWithoutToString' => new classWithoutToString(),
|
||||
|
||||
// undefined data
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
// resource variable
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of the array for data
|
||||
|
||||
foreach($inputs as $valueType =>$value) {
|
||||
echo "\n--$valueType--\n";
|
||||
var_dump( bin2hex(mcrypt_encrypt($cipher, $key, $value, $mode, $iv) ));
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_encrypt() : usage variation ***
|
||||
|
||||
--int 0--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "51dc9cd9179b718b"
|
||||
|
||||
--int 1--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "619c335f8c4f9cbf"
|
||||
|
||||
--int 12345--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "b1258d67ab73de00"
|
||||
|
||||
--int -12345--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "8eecf134443bd6b9"
|
||||
|
||||
--float 10.5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "34b5750a793baff5"
|
||||
|
||||
--float -10.5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "7a605f2aacc8a11d"
|
||||
|
||||
--float 12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(32) "74a0d7026ae586f476d4b17808851e86"
|
||||
|
||||
--float -12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(32) "bfb155997017986c01090afebd62c7ca"
|
||||
|
||||
--float .5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "cc60ac201164b6c7"
|
||||
|
||||
--empty array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 3 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int indexed array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 3 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--associative array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 3 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--nested arrays--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 3 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase NULL--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "6ece228c41457539"
|
||||
|
||||
--lowercase null--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "6ece228c41457539"
|
||||
|
||||
--lowercase true--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "619c335f8c4f9cbf"
|
||||
|
||||
--lowercase false--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "6ece228c41457539"
|
||||
|
||||
--uppercase TRUE--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "619c335f8c4f9cbf"
|
||||
|
||||
--uppercase FALSE--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "6ece228c41457539"
|
||||
|
||||
--empty string DQ--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "6ece228c41457539"
|
||||
|
||||
--empty string SQ--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "6ece228c41457539"
|
||||
|
||||
--instance of classWithToString--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(32) "749c3b4d16731d98370128754b7c930f"
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 3 to be string, object given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--undefined var--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "6ece228c41457539"
|
||||
|
||||
--unset var--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
string(16) "6ece228c41457539"
|
||||
|
||||
--resource--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation3.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 3 to be string, resource given, %s(%d)
|
||||
string(0) ""
|
||||
===DONE===
|
||||
|
|
@ -1,255 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_encrypt() function : usage variation
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_encrypt() : usage variation ***\n";
|
||||
|
||||
// Define error handler
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
if (error_reporting() != 0) {
|
||||
// report non-silenced errors
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
}
|
||||
}
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$key = b'string_val';
|
||||
$data = b'string_val';
|
||||
$iv = b'01234567';
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// define some classes
|
||||
class classWithToString
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
class classWithoutToString
|
||||
{
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// add arrays
|
||||
$index_array = array (1, 2, 3);
|
||||
$assoc_array = array ('one' => 1, 'two' => 2);
|
||||
|
||||
//array of values to iterate over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
|
||||
// null data
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// object data
|
||||
'instance of classWithToString' => new classWithToString(),
|
||||
'instance of classWithoutToString' => new classWithoutToString(),
|
||||
|
||||
// undefined data
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
// resource variable
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of the array for mode
|
||||
|
||||
foreach($inputs as $valueType =>$value) {
|
||||
echo "\n--$valueType--\n";
|
||||
var_dump( mcrypt_encrypt($cipher, $key, $data, $value, $iv) );
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_encrypt() : usage variation ***
|
||||
|
||||
--int 0--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int 1--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int 12345--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--int -12345--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float 10.5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float -10.5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float 12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float -12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--float .5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--int indexed array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--associative array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--nested arrays--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--uppercase NULL--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase null--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase true--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--lowercase false--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--uppercase TRUE--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--uppercase FALSE--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty string DQ--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty string SQ--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--instance of classWithToString--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, object given, %s(%d)
|
||||
NULL
|
||||
|
||||
--undefined var--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--unset var--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--resource--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation4.php(107)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, resource given, %s(%d)
|
||||
NULL
|
||||
===DONE===
|
|
@ -1,257 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_encrypt() function : usage variation
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt_encrypt() : usage variation ***\n";
|
||||
|
||||
// Define error handler
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
if (error_reporting() != 0) {
|
||||
// report non-silenced errors
|
||||
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
|
||||
}
|
||||
}
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
$cipher = MCRYPT_TRIPLEDES;
|
||||
$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
||||
$data = b'string_val';
|
||||
//in php, it incorrectly reports problems with iv in ECB mode.
|
||||
$mode = MCRYPT_MODE_CBC;
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// define some classes
|
||||
class classWithToString
|
||||
{
|
||||
public function __toString() {
|
||||
return b"Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
class classWithoutToString
|
||||
{
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = b<<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// add arrays
|
||||
$index_array = array (1, 2, 3);
|
||||
$assoc_array = array ('one' => 1, 'two' => 2);
|
||||
|
||||
//array of values to iterate over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
'int 0' => 0,
|
||||
'int 1' => 1,
|
||||
'int 12345' => 12345,
|
||||
'int -12345' => -2345,
|
||||
|
||||
// float data
|
||||
'float 10.5' => 10.5,
|
||||
'float -10.5' => -10.5,
|
||||
'float 12.3456789000e10' => 12.3456789000e10,
|
||||
'float -12.3456789000e10' => -12.3456789000e10,
|
||||
'float .5' => .5,
|
||||
|
||||
// array data
|
||||
'empty array' => array(),
|
||||
'int indexed array' => $index_array,
|
||||
'associative array' => $assoc_array,
|
||||
'nested arrays' => array('foo', $index_array, $assoc_array),
|
||||
|
||||
// null data
|
||||
'uppercase NULL' => NULL,
|
||||
'lowercase null' => null,
|
||||
|
||||
// boolean data
|
||||
'lowercase true' => true,
|
||||
'lowercase false' =>false,
|
||||
'uppercase TRUE' =>TRUE,
|
||||
'uppercase FALSE' =>FALSE,
|
||||
|
||||
// empty data
|
||||
'empty string DQ' => "",
|
||||
'empty string SQ' => '',
|
||||
|
||||
// object data
|
||||
'instance of classWithToString' => new classWithToString(),
|
||||
'instance of classWithoutToString' => new classWithoutToString(),
|
||||
|
||||
// undefined data
|
||||
'undefined var' => @$undefined_var,
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
// resource variable
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of the array for iv
|
||||
|
||||
foreach($inputs as $valueType =>$value) {
|
||||
echo "\n--$valueType--\n";
|
||||
var_dump( bin2hex(mcrypt_encrypt($cipher, $key, $data, $mode, $value)));
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt_encrypt() : usage variation ***
|
||||
|
||||
--int 0--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int 1--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int 12345--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int -12345--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float 10.5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float -10.5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float 12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float -12.3456789000e10--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--float .5--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--int indexed array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--associative array--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--nested arrays--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, array given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase NULL--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase null--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase true--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--lowercase false--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase TRUE--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--uppercase FALSE--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty string DQ--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--empty string SQ--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--instance of classWithToString--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, object given, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--undefined var--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--unset var--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
|
||||
string(0) ""
|
||||
|
||||
--resource--
|
||||
Error: 8192 - Function mcrypt_encrypt() is deprecated, %s%emcrypt_encrypt_variation5.php(108)
|
||||
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, resource given, %s(%d)
|
||||
string(0) ""
|
||||
===DONE===
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt filters
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
foreach (stream_get_filters() as $f) {
|
||||
if ($f == "mcrypt.*" || $f == "mdecrypt.*") {
|
||||
echo "FOUND\n";
|
||||
}
|
||||
}
|
||||
|
||||
$secretfile = 'secert-file.tmp';
|
||||
$passphrase = 'My secret';
|
||||
|
||||
$iv = substr(md5('iv'.$passphrase, true), 0, 8);
|
||||
$key = substr(md5('pass1'.$passphrase, true) .
|
||||
md5('pass2'.$passphrase, true), 0, 24);
|
||||
$opts = array('iv'=>$iv, 'key'=>$key);
|
||||
|
||||
$fp = fopen($secretfile, 'wb');
|
||||
stream_filter_append($fp, 'mcrypt.tripledes', STREAM_FILTER_WRITE, $opts);
|
||||
fwrite($fp, 'Secret secret secret data');
|
||||
fclose($fp);
|
||||
|
||||
echo md5_file($secretfile)."\n";
|
||||
|
||||
$fp = fopen($secretfile, 'rb');
|
||||
stream_filter_append($fp, 'mdecrypt.tripledes', STREAM_FILTER_READ, $opts);
|
||||
$data = stream_get_contents($fp);
|
||||
fclose($fp);
|
||||
|
||||
echo $data."\n";
|
||||
|
||||
@unlink($secretfile);
|
||||
|
||||
--EXPECTF--
|
||||
FOUND
|
||||
FOUND
|
||||
|
||||
Deprecated: stream_filter_append(): mcrypt and mdecrypt stream filters have been deprecated in %s%emcrypt_filters.php on line 17
|
||||
32e14bd3c31f2bd666e4290ebdb166a7
|
||||
|
||||
Deprecated: stream_filter_append(): mcrypt and mdecrypt stream filters have been deprecated in %s%emcrypt_filters.php on line 24
|
||||
Secret secret secret data
|
|
@ -1,18 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_get_block_size
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_get_block_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
|
||||
var_dump(mcrypt_get_block_size(MCRYPT_3DES, MCRYPT_MODE_CBC));
|
||||
var_dump(mcrypt_get_block_size(MCRYPT_WAKE, MCRYPT_MODE_STREAM));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_get_block_size() is deprecated in %s%emcrypt_get_block_size.php on line 2
|
||||
int(32)
|
||||
|
||||
Deprecated: Function mcrypt_get_block_size() is deprecated in %s%emcrypt_get_block_size.php on line 3
|
||||
int(8)
|
||||
|
||||
Deprecated: Function mcrypt_get_block_size() is deprecated in %s%emcrypt_get_block_size.php on line 4
|
||||
int(1)
|
|
@ -1,22 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_get_cipher_name
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo mcrypt_get_cipher_name(MCRYPT_RIJNDAEL_256) . "\n";
|
||||
echo mcrypt_get_cipher_name(MCRYPT_RC2) . "\n";
|
||||
echo mcrypt_get_cipher_name(MCRYPT_ARCFOUR) . "\n";
|
||||
echo mcrypt_get_cipher_name(MCRYPT_WAKE) . "\n";
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_get_cipher_name() is deprecated in %s%emcrypt_get_cipher_name.php on line 2
|
||||
Rijndael-256
|
||||
|
||||
Deprecated: Function mcrypt_get_cipher_name() is deprecated in %s%emcrypt_get_cipher_name.php on line 3
|
||||
RC2
|
||||
|
||||
Deprecated: Function mcrypt_get_cipher_name() is deprecated in %s%emcrypt_get_cipher_name.php on line 4
|
||||
RC4
|
||||
|
||||
Deprecated: Function mcrypt_get_cipher_name() is deprecated in %s%emcrypt_get_cipher_name.php on line 5
|
||||
WAKE
|
|
@ -1,24 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_enc_get_iv_size
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
|
||||
var_dump(mcrypt_get_iv_size(MCRYPT_3DES, MCRYPT_MODE_CBC));
|
||||
var_dump(mcrypt_get_iv_size(MCRYPT_WAKE, MCRYPT_MODE_STREAM));
|
||||
var_dump(mcrypt_get_iv_size(MCRYPT_XTEA, MCRYPT_MODE_STREAM));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_get_iv_size.php on line 2
|
||||
int(32)
|
||||
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_get_iv_size.php on line 3
|
||||
int(8)
|
||||
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_get_iv_size.php on line 4
|
||||
int(0)
|
||||
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_get_iv_size.php on line 5
|
||||
|
||||
Warning: mcrypt_get_iv_size(): Module initialization failed in %s on line %d
|
||||
bool(false)
|
|
@ -1,18 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_get_key_size
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_get_key_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
|
||||
var_dump(mcrypt_get_key_size(MCRYPT_3DES, MCRYPT_MODE_CBC));
|
||||
var_dump(mcrypt_get_key_size(MCRYPT_WAKE, MCRYPT_MODE_STREAM));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_get_key_size() is deprecated in %s%emcrypt_get_key_size.php on line 2
|
||||
int(32)
|
||||
|
||||
Deprecated: Function mcrypt_get_key_size() is deprecated in %s%emcrypt_get_key_size.php on line 3
|
||||
int(24)
|
||||
|
||||
Deprecated: Function mcrypt_get_key_size() is deprecated in %s%emcrypt_get_key_size.php on line 4
|
||||
int(32)
|
|
@ -1,17 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_list_algorithms
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
foreach (mcrypt_list_algorithms() as $algo) {
|
||||
if (in_array($algo, array('rijndael-256', 'des', 'blowfish', 'twofish'))) {
|
||||
echo "FOUND\n";
|
||||
}
|
||||
}
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_list_algorithms() is deprecated in %s%emcrypt_list_algorithms.php on line 2
|
||||
FOUND
|
||||
FOUND
|
||||
FOUND
|
||||
FOUND
|
|
@ -1,27 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_list_modes
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_list_modes());
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_list_modes() is deprecated in %s%emcrypt_list_modes.php on line 2
|
||||
array(8) {
|
||||
[0]=>
|
||||
string(3) "cbc"
|
||||
[1]=>
|
||||
string(3) "cfb"
|
||||
[2]=>
|
||||
string(3) "ctr"
|
||||
[3]=>
|
||||
string(3) "ecb"
|
||||
[4]=>
|
||||
string(4) "ncfb"
|
||||
[5]=>
|
||||
string(4) "nofb"
|
||||
[6]=>
|
||||
string(3) "ofb"
|
||||
[7]=>
|
||||
string(6) "stream"
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_module_get_algo_block_size
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_RIJNDAEL_256));
|
||||
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_RIJNDAEL_192));
|
||||
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_RC2));
|
||||
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_XTEA));
|
||||
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_CAST_256));
|
||||
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_BLOWFISH));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 2
|
||||
int(32)
|
||||
|
||||
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 3
|
||||
int(24)
|
||||
|
||||
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 4
|
||||
int(8)
|
||||
|
||||
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 5
|
||||
int(8)
|
||||
|
||||
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 6
|
||||
int(16)
|
||||
|
||||
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 7
|
||||
int(8)
|
|
@ -1,31 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_module_get_algo_key_size
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_RIJNDAEL_256));
|
||||
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_RIJNDAEL_192));
|
||||
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_RC2));
|
||||
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_XTEA));
|
||||
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_CAST_256));
|
||||
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_BLOWFISH));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 2
|
||||
int(32)
|
||||
|
||||
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 3
|
||||
int(32)
|
||||
|
||||
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 4
|
||||
int(128)
|
||||
|
||||
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 5
|
||||
int(16)
|
||||
|
||||
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 6
|
||||
int(32)
|
||||
|
||||
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 7
|
||||
int(56)
|
|
@ -1,22 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_module_get_supported_key_sizes
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_module_get_supported_key_sizes(MCRYPT_RIJNDAEL_256));
|
||||
var_dump(mcrypt_module_get_supported_key_sizes(MCRYPT_RC2));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_get_supported_key_sizes() is deprecated in %s%emcrypt_module_get_supported_key_sizes.php on line 2
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(16)
|
||||
[1]=>
|
||||
int(24)
|
||||
[2]=>
|
||||
int(32)
|
||||
}
|
||||
|
||||
Deprecated: Function mcrypt_module_get_supported_key_sizes() is deprecated in %s%emcrypt_module_get_supported_key_sizes.php on line 3
|
||||
array(0) {
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_module_is_block_algorithm
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_module_is_block_algorithm(MCRYPT_RIJNDAEL_128));
|
||||
var_dump(mcrypt_module_is_block_algorithm(MCRYPT_DES));
|
||||
var_dump(mcrypt_module_is_block_algorithm(MCRYPT_WAKE));
|
||||
var_dump(mcrypt_module_is_block_algorithm(MCRYPT_XTEA));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_is_block_algorithm() is deprecated in %s%emcrypt_module_is_block_algorithm.php on line 2
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_is_block_algorithm() is deprecated in %s%emcrypt_module_is_block_algorithm.php on line 3
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_is_block_algorithm() is deprecated in %s%emcrypt_module_is_block_algorithm.php on line 4
|
||||
bool(false)
|
||||
|
||||
Deprecated: Function mcrypt_module_is_block_algorithm() is deprecated in %s%emcrypt_module_is_block_algorithm.php on line 5
|
||||
bool(true)
|
|
@ -1,22 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_module_is_block_algorithm_mode
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_module_is_block_algorithm_mode(MCRYPT_MODE_CBC));
|
||||
var_dump(mcrypt_module_is_block_algorithm_mode(MCRYPT_MODE_ECB));
|
||||
var_dump(mcrypt_module_is_block_algorithm_mode(MCRYPT_MODE_STREAM));
|
||||
var_dump(mcrypt_module_is_block_algorithm_mode(MCRYPT_MODE_OFB));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_is_block_algorithm_mode() is deprecated in %s%emcrypt_module_is_block_algorithm_mode.php on line 2
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_is_block_algorithm_mode() is deprecated in %s%emcrypt_module_is_block_algorithm_mode.php on line 3
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_is_block_algorithm_mode() is deprecated in %s%emcrypt_module_is_block_algorithm_mode.php on line 4
|
||||
bool(false)
|
||||
|
||||
Deprecated: Function mcrypt_module_is_block_algorithm_mode() is deprecated in %s%emcrypt_module_is_block_algorithm_mode.php on line 5
|
||||
bool(true)
|
|
@ -1,26 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_module_is_block_mode
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_module_is_block_mode(MCRYPT_MODE_CBC));
|
||||
var_dump(mcrypt_module_is_block_mode(MCRYPT_MODE_ECB));
|
||||
var_dump(mcrypt_module_is_block_mode(MCRYPT_MODE_STREAM));
|
||||
var_dump(mcrypt_module_is_block_mode(MCRYPT_MODE_NOFB));
|
||||
var_dump(mcrypt_module_is_block_mode(MCRYPT_MODE_OFB));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_is_block_mode() is deprecated in %s%emcrypt_module_is_block_mode.php on line 2
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_is_block_mode() is deprecated in %s%emcrypt_module_is_block_mode.php on line 3
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_is_block_mode() is deprecated in %s%emcrypt_module_is_block_mode.php on line 4
|
||||
bool(false)
|
||||
|
||||
Deprecated: Function mcrypt_module_is_block_mode() is deprecated in %s%emcrypt_module_is_block_mode.php on line 5
|
||||
bool(false)
|
||||
|
||||
Deprecated: Function mcrypt_module_is_block_mode() is deprecated in %s%emcrypt_module_is_block_mode.php on line 6
|
||||
bool(false)
|
|
@ -1,17 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_module_open
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, ''));
|
||||
mcrypt_module_open('', '', '', '');
|
||||
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_module_open.php on line 2
|
||||
resource(%d) of type (mcrypt)
|
||||
|
||||
Deprecated: Function mcrypt_module_open() is deprecated in %s%emcrypt_module_open.php on line 3
|
||||
|
||||
Warning: mcrypt_module_open(): Could not open encryption module in %s on line %d
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_module_self_test
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mcrypt_module_self_test(MCRYPT_RIJNDAEL_128));
|
||||
var_dump(mcrypt_module_self_test(MCRYPT_RC2));
|
||||
var_dump(mcrypt_module_self_test(''));
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_module_self_test() is deprecated in %s%emcrypt_module_self_test.php on line 2
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_self_test() is deprecated in %s%emcrypt_module_self_test.php on line 3
|
||||
bool(true)
|
||||
|
||||
Deprecated: Function mcrypt_module_self_test() is deprecated in %s%emcrypt_module_self_test.php on line 4
|
||||
bool(false)
|
|
@ -1,32 +0,0 @@
|
|||
--TEST--
|
||||
mcrypt_ofb
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$key = "0123456789012345";
|
||||
$secret = "PHP Testfest 2008";
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_OFB), MCRYPT_RAND);
|
||||
$enc_data = mcrypt_decrypt($cipher, $key, $secret, MCRYPT_MODE_OFB, $iv);
|
||||
|
||||
// we have to trim as AES rounds the blocks and decrypt doesnt detect that
|
||||
echo trim(mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_OFB, $iv)) . "\n";
|
||||
|
||||
// a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
|
||||
mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_OFB);
|
||||
|
||||
--EXPECTF--
|
||||
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_ofb.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_create_iv() is deprecated in %s%emcrypt_ofb.php on line 6
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ofb.php on line 7
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ofb.php on line 10
|
||||
PHP Testfest 2008
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ofb.php on line 13
|
||||
|
||||
Warning: mcrypt_decrypt(): Encryption mode requires an initialization vector of size 16 in %s on line %d
|
|
@ -1,133 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_encrypt() function : AES functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
/* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
/* Prototype : string mcrypt_cbc(int cipher, string key, string data, int mode, string iv)
|
||||
* Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt : Rijndael128 functionality ***\n";
|
||||
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
$mode = MCRYPT_MODE_CBC;
|
||||
$data = b'This is the secret message which must be encrypted';
|
||||
|
||||
// keys up to 128 bits (16 bytes)
|
||||
$keys = array(
|
||||
null,
|
||||
'',
|
||||
b'12345678',
|
||||
b'1234567890123456'
|
||||
);
|
||||
// rijndael128 is a block cipher of 128 bits (16 bytes)
|
||||
$ivs = array(
|
||||
null,
|
||||
'',
|
||||
b'12345678',
|
||||
b'1234567890123456',
|
||||
b'12345678901234567'
|
||||
);
|
||||
|
||||
|
||||
$iv = b'1234567890123456';
|
||||
echo "\n--- testing different key lengths\n";
|
||||
foreach ($keys as $key) {
|
||||
echo "\nkey length=".strlen($key)."\n";
|
||||
$res = mcrypt_encrypt($cipher, $key, $data, MCRYPT_MODE_CBC, $iv);
|
||||
var_dump(bin2hex($res));
|
||||
}
|
||||
|
||||
$key = b'1234567890123456';
|
||||
echo "\n--- testing different iv lengths\n";
|
||||
foreach ($ivs as $iv) {
|
||||
echo "\niv length=".strlen($iv)."\n";
|
||||
$res = mcrypt_decrypt($cipher, $key, $res, MCRYPT_MODE_CBC, $iv);
|
||||
var_dump(bin2hex($res));
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt : Rijndael128 functionality ***
|
||||
|
||||
--- testing different key lengths
|
||||
|
||||
key length=0
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line 45
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=0
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line 45
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=8
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line 45
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=16
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line 45
|
||||
string(128) "dc8f957ec530acf10cd95ba7da7b6405380fe19a2941e9a8de54680512f18491bc374e5464885ae6c2ae2aa7a6cdd2fbe12a06bbc4bd59dbbfaa15f09044f101"
|
||||
|
||||
--- testing different iv lengths
|
||||
|
||||
iv length=0
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line 53
|
||||
|
||||
Warning: mcrypt_decrypt(): Received initialization vector of size 0, but size 16 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
iv length=0
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line 53
|
||||
|
||||
Warning: mcrypt_decrypt(): Received initialization vector of size 0, but size 16 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
iv length=8
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line 53
|
||||
|
||||
Warning: mcrypt_decrypt(): Received initialization vector of size 8, but size 16 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
iv length=16
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line 53
|
||||
string(32) "42adc8c0db19473f2c684ff2d6e828a5"
|
||||
|
||||
iv length=17
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line 53
|
||||
|
||||
Warning: mcrypt_decrypt(): Received initialization vector of size 17, but size 16 is required for this encryption mode in %s on line %d
|
||||
string(0) ""
|
||||
===DONE===
|
|
@ -1,115 +0,0 @@
|
|||
--TEST--
|
||||
Test mcrypt_encrypt() function : AES functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("mcrypt")) {
|
||||
print "skip - mcrypt extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
/* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
|
||||
* Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
/* Prototype : string mcrypt_cbc(int cipher, string key, string data, int mode, string iv)
|
||||
* Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
/* Prototype : string mcrypt_ecb(int cipher, string key, string data, int mode, string iv)
|
||||
* Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv
|
||||
* Source code: ext/mcrypt/mcrypt.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mcrypt : Rijndael128 functionality ***\n";
|
||||
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
$mode = MCRYPT_MODE_CBC;
|
||||
$data = b'This is the secret message which must be encrypted';
|
||||
|
||||
// keys : 20 bytes, 24 bytes, 30 Bytes, 32 Bytes, 40 Bytes
|
||||
$keys = array(
|
||||
b'12345678901234567890',
|
||||
b'123456789012345678901234',
|
||||
b'123456789012345678901234567890',
|
||||
b'12345678901234567890123456789012',
|
||||
b'1234567890123456789012345678901234567890'
|
||||
);
|
||||
// rijndael128 is a block cipher of 128 bits (16 bytes)
|
||||
$iv = b'1234567890123456';
|
||||
|
||||
echo "\n--- testing different key lengths\n";
|
||||
foreach ($keys as $key) {
|
||||
echo "\nkey length=".strlen($key)."\n";
|
||||
$res = mcrypt_encrypt($cipher, $key, $data, MCRYPT_MODE_CBC, $iv);
|
||||
var_dump(bin2hex($res));
|
||||
$res = mcrypt_decrypt($cipher, $key, $res, MCRYPT_MODE_CBC, $iv);
|
||||
var_dump(bin2hex($res));
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mcrypt : Rijndael128 functionality ***
|
||||
|
||||
--- testing different key lengths
|
||||
|
||||
key length=20
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 43
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 45
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=24
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 43
|
||||
string(128) "8ecdf1ed5742aff16ef34c819c8d22c707c54f4d9ffc18e5f6ab79fe68c25705351e2c001a0b9f29e5def67570ca9da644efb69a8bb97940cb4bec094dae8bb5"
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 45
|
||||
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
|
||||
|
||||
key length=30
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 43
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 30 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 45
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 30 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
key length=32
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 43
|
||||
string(128) "f23bc103bfd0859a8318acee6d96e5f43dff68f3cdeae817a1e77c33492e32bdb82c5f660fcd1a2bfda70d9de4d5d8028ce179a9e2f7f9ee7dd61c7b4b409e95"
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 45
|
||||
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
|
||||
|
||||
key length=40
|
||||
|
||||
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 43
|
||||
|
||||
Warning: mcrypt_encrypt(): Key of size 40 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 45
|
||||
|
||||
Warning: mcrypt_decrypt(): Key of size 40 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
|
||||
string(0) ""
|
||||
===DONE===
|
|
@ -1,33 +0,0 @@
|
|||
0000000000000000 0000000000000000 4EF997456198DD78
|
||||
FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF 51866FD5B85ECB8A
|
||||
3000000000000000 1000000000000001 7D856F9A613063F2
|
||||
1111111111111111 1111111111111111 2466DD878B963C9D
|
||||
0123456789ABCDEF 1111111111111111 61F9C3802281B096
|
||||
1111111111111111 0123456789ABCDEF 7D0CC630AFDA1EC7
|
||||
FEDCBA9876543210 0123456789ABCDEF 0ACEAB0FC6A0A28D
|
||||
7CA110454A1A6E57 01A1D6D039776742 59C68245EB05282B
|
||||
0131D9619DC1376E 5CD54CA83DEF57DA B1B8CC0B250F09A0
|
||||
07A1133E4A0B2686 0248D43806F67172 1730E5778BEA1DA4
|
||||
3849674C2602319E 51454B582DDF440A A25E7856CF2651EB
|
||||
04B915BA43FEB5B6 42FD443059577FA2 353882B109CE8F1A
|
||||
0113B970FD34F2CE 059B5E0851CF143A 48F4D0884C379918
|
||||
0170F175468FB5E6 0756D8E0774761D2 432193B78951FC98
|
||||
43297FAD38E373FE 762514B829BF486A 13F04154D69D1AE5
|
||||
07A7137045DA2A16 3BDD119049372802 2EEDDA93FFD39C79
|
||||
04689104C2FD3B2F 26955F6835AF609A D887E0393C2DA6E3
|
||||
37D06BB516CB7546 164D5E404F275232 5F99D04F5B163969
|
||||
1F08260D1AC2465E 6B056E18759F5CCA 4A057A3B24D3977B
|
||||
584023641ABA6176 004BD6EF09176062 452031C1E4FADA8E
|
||||
025816164629B007 480D39006EE762F2 7555AE39F59B87BD
|
||||
49793EBC79B3258F 437540C8698F3CFA 53C55F9CB49FC019
|
||||
4FB05E1515AB73A7 072D43A077075292 7A8E7BFA937E89A3
|
||||
49E95D6D4CA229BF 02FE55778117F12A CF9C5D7A4986ADB5
|
||||
018310DC409B26D6 1D9D5C5018F728C2 D1ABB290658BC778
|
||||
1C587F1C13924FEF 305532286D6F295A 55CB3774D13EF201
|
||||
0101010101010101 0123456789ABCDEF FA34EC4847B268B2
|
||||
1F1F1F1F0E0E0E0E 0123456789ABCDEF A790795108EA3CAE
|
||||
E0FEE0FEF1FEF1FE 0123456789ABCDEF C39E072D9FAC631D
|
||||
0000000000000000 FFFFFFFFFFFFFFFF 014933E0CDAFF6E4
|
||||
FFFFFFFFFFFFFFFF 0000000000000000 F21E9A77B71C49BC
|
||||
0123456789ABCDEF 0000000000000000 245946885754369A
|
||||
FEDCBA9876543210 FFFFFFFFFFFFFFFF 6B5C5A9C5D9E0A5A
|
|
@ -36,7 +36,6 @@ CREDIT_LINE("Internationalization", "Ed Batutis, Vladimir Iordanov, Dmitry Lakht
|
|||
CREDIT_LINE("JSON", "Jakub Zelenka, Omar Kilani, Scott MacVicar");
|
||||
CREDIT_LINE("LDAP", "Amitay Isaacs, Eric Warnke, Rasmus Lerdorf, Gerrit Thomson, Stig Venaas");
|
||||
CREDIT_LINE("LIBXML", "Christian Stocker, Rob Richards, Marcus Boerger, Wez Furlong, Shane Caraveo");
|
||||
CREDIT_LINE("mcrypt", "Sascha Schumann, Derick Rethans");
|
||||
CREDIT_LINE("Multibyte String Functions", "Tsukada Takuya, Rui Hirokawa");
|
||||
CREDIT_LINE("MySQL driver for PDO", "George Schlossnagle, Wez Furlong, Ilia Alshanetsky, Johannes Schlueter");
|
||||
CREDIT_LINE("MySQLi", "Zak Greant, Georg Richter, Andrey Hristov, Ulf Wendel");
|
||||
|
|
|
@ -1737,17 +1737,6 @@ soap.wsdl_cache_limit = 5
|
|||
; Sets the maximum number of open links or -1 for unlimited.
|
||||
ldap.max_links = -1
|
||||
|
||||
[mcrypt]
|
||||
; For more information about mcrypt settings see http://php.net/mcrypt-module-open
|
||||
|
||||
; Directory where to load mcrypt algorithms
|
||||
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
|
||||
;mcrypt.algorithms_dir=
|
||||
|
||||
; Directory where to load mcrypt modes
|
||||
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
|
||||
;mcrypt.modes_dir=
|
||||
|
||||
[dba]
|
||||
;dba.default_handler=
|
||||
|
||||
|
|
|
@ -1737,17 +1737,6 @@ soap.wsdl_cache_limit = 5
|
|||
; Sets the maximum number of open links or -1 for unlimited.
|
||||
ldap.max_links = -1
|
||||
|
||||
[mcrypt]
|
||||
; For more information about mcrypt settings see http://php.net/mcrypt-module-open
|
||||
|
||||
; Directory where to load mcrypt algorithms
|
||||
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
|
||||
;mcrypt.algorithms_dir=
|
||||
|
||||
; Directory where to load mcrypt modes
|
||||
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
|
||||
;mcrypt.modes_dir=
|
||||
|
||||
[dba]
|
||||
;dba.default_handler=
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ $TS \
|
|||
--enable-zip \
|
||||
--with-zlib \
|
||||
--with-zlib-dir=/usr \
|
||||
--with-mcrypt=/usr \
|
||||
--enable-soap \
|
||||
--enable-xmlreader \
|
||||
--with-xsl \
|
||||
|
|
|
@ -5,7 +5,6 @@ icu-57.1
|
|||
jpeglib-9b
|
||||
libcurl-7.50.3
|
||||
libiconv-1.14
|
||||
libmcrypt-2.5.8
|
||||
libmpir-2.7.2
|
||||
libpng-1.6.21
|
||||
libpq-9.5.3
|
||||
|
|
|
@ -1011,7 +1011,6 @@ extension=php_bz2.dll
|
|||
php_interbase.dll InterBase functions Requires: gds32.dll (bundled)
|
||||
php_ldap.dll LDAP functions requires libeay32.dll, ssleay32.dll (bundled)
|
||||
php_mbstring.dll Multi-Byte String functions None
|
||||
php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
|
||||
php_mime_magic.dll Mimetype functions Requires: magic.mime (bundled)
|
||||
php_ming.dll Ming functions for Flash None
|
||||
php_msql.dll mSQL functions Requires: msql.dll (bundled)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue