php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39236 Error in function openssl_get_privatekey
Submitted: 2006-10-23 13:07 UTC Modified: 2006-10-24 09:56 UTC
From: kprzemek at coig dot katowice dot pl Assigned: pajoye (profile)
Status: Not a bug Package: OpenSSL related
PHP Version: 5.1.6 OS: RHEL4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kprzemek at coig dot katowice dot pl
New email:
PHP Version: OS:

 

 [2006-10-23 13:07 UTC] kprzemek at coig dot katowice dot pl
Description:
------------
Private key password is always Ok, no matter if the password is right or wrong. And it's not OK, because if I give wrong private key password, I should get an error. So I guess this function isn't working well. Everything is OK on php4.4.2 Is is because php5? I had the same error. No matter if the password is right or wrong it's OK (it's functioning) and it shouldnt't be.

Reproduce code:
---------------
public function userPassCheck($password,$nruser,$name) {
      $nras=(int)$this->asID;
      ifx_textasvarchar(1);
      $sql="SELECT priv_key".
           "  FROM user_ssl ".
           " WHERE nras=$nras ".
           "   AND nruser=$nruser";
      $rs=$this->db->Execute($sql);
      if (!$rs) {
         $this->blad="<b>Error...</b><br>".
         $this->db->ErrorNo()." - ".
         $this->db->ErrorMsg();
         throw new Exception($this->blad);
      }
      $this->privkey=$rs->fields['priv_key'];
  $rsCert=openssl_get_privatekey($this->privkey,$password);
      if($rsCert) {
         echo "<br>OK";
      } else {
         echo "<br>NOT OK";
      }
   }

Expected result:
----------------
If password is wrong I expect "NOT OK" if is right "OK".

Actual result:
--------------
Always "OK".

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-23 13:18 UTC] pajoye@php.net
Please provide an example without external data, a link to a (sample) private key and the password to use.
 [2006-10-24 08:42 UTC] kprzemek at coig dot katowice dot pl
Sorry my mistake. I use the private key wthout password. I don't know haw I could not notice that. Thanks for help. Everything in openssl_get_privatekey works fine.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 16:01:37 2025 UTC