Skip to content

Commit

Permalink
Merge pull request #35 from gerrywastaken/feature-improve-private-key…
Browse files Browse the repository at this point in the history
…-access-exception

Make inaccessable private key exception more informative
  • Loading branch information
calcinai committed Jun 29, 2015
2 parents 194068f + bb23ade commit 1b996c8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/XeroPHP/Remote/OAuth/SignatureMethod/RSASHA1.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ class RSASHA1 implements SignatureMethodInterface {

public static function generateSignature(array $config, $sbs, $secret) {
// Fetch the private key
if(false === $private_key_id = openssl_pkey_get_private($config['rsa_private_key']))
throw new Exception('Cannot access private key for signing');
if(false === $private_key_id = openssl_pkey_get_private($config['rsa_private_key'])){
throw new Exception("Cannot access private key for signing: openssl_pkey_get_private('${config['rsa_private_key']}') returned false");
}

// Sign using the key
if(false === openssl_sign($sbs, $signature, $private_key_id)) {
Expand Down

0 comments on commit 1b996c8

Please sign in to comment.