php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #76499 openssl_decrypt The cipher method list lack
Submitted: 2018-06-19 11:36 UTC Modified: 2018-07-01 04:22 UTC
From: song_121292057 at 126 dot com Assigned:
Status: No Feedback Package: Documentation problem
PHP Version: 7.1.18 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: song_121292057 at 126 dot com
New email:
PHP Version: OS:

 

 [2018-06-19 11:36 UTC] 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"}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-19 11:55 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2018-06-19 11:55 UTC] requinix@php.net
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.



 [2018-07-01 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 16:01:27 2019 UTC