Fix on Asymetric key thumbprint calculation:

added exception management if the enc key doest not match

Change-Id: I6a6acb4b88a091df35f9e203bfc941a60118c9dd
This commit is contained in:
Sebastian Marcet
2016-01-08 15:33:50 -03:00
parent 37e236a2bb
commit 53aa542116

View File

@@ -99,9 +99,18 @@ abstract class AssymetricKey extends BaseModelEloquent implements IAssymetricKey
return $this->kid;
}
private function calculateThumbprint($alg){
$pem = str_replace( array("\n","\r"), '', trim($this->getPublicKeyPEM()));
return strtoupper(hash($alg, base64_decode($pem)));
private function calculateThumbprint($alg)
{
$res = '';
try {
$pem = str_replace(array("\n", "\r"), '', trim($this->getPublicKeyPEM()));
$res = strtoupper(hash($alg, base64_decode($pem)));
}
catch(Exception $ex)
{
$res = 'INVALID';
}
return $res;
}
/**