Doc #76499 [Opn->Fbk]: openssl_decrypt The cipher method list lack

From: Date: Tue, 19 Jun 2018 11:55:07 +0000
Subject: Doc #76499 [Opn->Fbk]: openssl_decrypt The cipher method list lack
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15796@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76499&edit=1 ID: 76499 Updated by: requinix@php.net Reported by: song_121292057 at 126 dot com Summary: openssl_decrypt The cipher method list lack -Status: Open +Status: Feedback Type: Documentation Problem Package: Documentation problem Operating System: Linux PHP Version: 7.1.18 Block user comment: N Private report: N New Comment: Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2018-06-19 11:36:20] song_121292057 at 126 dot com Description: ------------ --- From manual page: http://www.php.net/function.openssl-decrypt --- null Test script: --------------- $str = 'AL1t8UIi4gt8eFZQu7R631eI40YK8CEgVHPWRekE4cG+rRbEAwbiFrZViHU9OMTJVcNO/dvMCwUbyOs6mQKQCw=='; $key = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChFetx5+VKDoEXzZ+5Wozt3MfWMM/TiKMlWmAKXBViv8/e6j6SU/lSlWkMajd59aiWczs+qf9dMuRpe/l9Qke9DnVMn24JNLXjWD+y+w3yKRwd3CTtF7gx8/ToZl5XqFIT5YB1QfQCdAf8Z18IdQrJIijs8ssczY/RfqKZLo+KLQIDAQAB'; $md5key = strtoupper(md5($key)); $key = hex2bin($md5key); $decrypted= mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, base64_decode($str), MCRYPT_MODE_ECB); $decrypted_error= openssl_decrypt(base64_decode($str),'AES-128-CBC',$key,OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING); $decrypted_success= openssl_decrypt(base64_decode($str),'AES-128-ECB',$key,OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING); print_r($decrypted); echo "<br/>"; print_r($decrypted_error); echo "<br/>"; print_r($decrypted_success); exit(); Expected result: ---------------- {"resCode":"99024","resMessage":"UNKNOW_SERVICE_EXCEPTION"} {"resCode":"99024�A�0G�F %1��X�uݭ D�v6��G����U�SR�Y�w�p8=�� {"resCode":"99024","resMessage":"UNKNOW_SERVICE_EXCEPTION"} ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76499&edit=1

« previous php.doc.bugs (#15796) next »