Skip to content

Commit

Permalink
I'm not sure, but I think this is a bug
Browse files Browse the repository at this point in the history
first set key as a certificate string
openssl_x509_export($this->key, $str_cert);
...
$this->key = $str_cert;

and then try to get privatekey from cert string
$this->key = openssl_get_privatekey($this->key, $this->passphrase);

If I'm not right, then sorry for wasting your time.
  • Loading branch information
EvgenyNikolaev committed Apr 18, 2013
1 parent 371c300 commit 403b12f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions xmlseclibs.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,8 @@ public function loadKey($key, $isFile=FALSE, $isCert = FALSE) {
$this->key = $key;
}
if ($isCert) {
$this->key = openssl_x509_read($this->key);
openssl_x509_export($this->key, $str_cert);
$this->x509Certificate = $str_cert;
$this->key = $str_cert;
$x509 = openssl_x509_read($this->key);
$this->x509Certificate = openssl_x509_export($x509, $str_cert);
} else {
$this->x509Certificate = NULL;
}
Expand Down

1 comment on commit 403b12f

@Maks3w
Copy link

@Maks3w Maks3w commented on 403b12f Jun 11, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assignment is wrong because openssl_x509_export return is a boolean

Please sign in to comment.