Ejemplo n.º 1
0
 public function isSupported(Phpfunc $phpfunc = null)
 {
     if (!is_object($phpfunc) || !$phpfunc instanceof $phpfunc) {
         $phpfunc = new Phpfunc();
     }
     if (!$phpfunc->function_exists('mcrypt_get_key_size')) {
         return false;
     }
     if (!$phpfunc->function_exists('mcrypt_get_iv_size')) {
         return false;
     }
     if (!$phpfunc->function_exists('mcrypt_create_iv')) {
         return false;
     }
     if (!$phpfunc->function_exists('mcrypt_encrypt')) {
         return false;
     }
     if (!$phpfunc->function_exists('mcrypt_decrypt')) {
         return false;
     }
     if (!$phpfunc->function_exists('mcrypt_list_algorithms')) {
         return false;
     }
     if (!$phpfunc->function_exists('hash')) {
         return false;
     }
     if (!$phpfunc->function_exists('hash_algos')) {
         return false;
     }
     $algorightms = $phpfunc->mcrypt_list_algorithms();
     if (!in_array('rijndael-128', $algorightms)) {
         return false;
     }
     if (!in_array('rijndael-192', $algorightms)) {
         return false;
     }
     if (!in_array('rijndael-256', $algorightms)) {
         return false;
     }
     $algorightms = $phpfunc->hash_algos();
     if (!in_array('sha256', $algorightms)) {
         return false;
     }
     return true;
 }
Ejemplo n.º 2
0
 public function isSupported(Phpfunc $phpfunc = null)
 {
     if (!is_object($phpfunc) || !$phpfunc instanceof $phpfunc) {
         $phpfunc = new Phpfunc();
     }
     if (!$phpfunc->function_exists('openssl_get_cipher_methods')) {
         return false;
     }
     if (!$phpfunc->function_exists('openssl_random_pseudo_bytes')) {
         return false;
     }
     if (!$phpfunc->function_exists('openssl_cipher_iv_length')) {
         return false;
     }
     if (!$phpfunc->function_exists('openssl_encrypt')) {
         return false;
     }
     if (!$phpfunc->function_exists('openssl_decrypt')) {
         return false;
     }
     if (!$phpfunc->function_exists('hash')) {
         return false;
     }
     if (!$phpfunc->function_exists('hash_algos')) {
         return false;
     }
     $algorightms = $phpfunc->openssl_get_cipher_methods();
     if (!in_array('aes-128-cbc', $algorightms)) {
         return false;
     }
     $algorightms = $phpfunc->hash_algos();
     if (!in_array('sha256', $algorightms)) {
         return false;
     }
     return true;
 }