Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian committed Feb 6, 2013
1 parent cd6d4ac commit c1b57db
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions library/Zend/Crypt/PublicKey/Rsa.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@ public function getOptions()
return $this->options;
}

/**
* Return last openssl error(s)
*
* @return string
*/
public function getOpensslErrorString()
{
$msg='';
while ($msg .= openssl_error_string())
$msg .= "\n";
return $msg;
}

/**
* Sign with private key
*
Expand All @@ -158,7 +171,7 @@ public function sign($data, Rsa\PrivateKey $privateKey = null)
);
if (false === $result) {
throw new Exception\RuntimeException(
'Can not generate signature; openssl ' . openssl_error_string()
'Can not generate signature; openssl ' . $this->getOpensslErrorString()
);
}

Expand Down Expand Up @@ -221,7 +234,7 @@ public function verify(
);
if (-1 === $result) {
throw new Exception\RuntimeException(
'Can not verify signature; openssl ' . openssl_error_string()
'Can not verify signature; openssl ' . $this->getOpensslErrorString()
);
}

Expand Down

0 comments on commit c1b57db

Please sign in to comment.