Skip to content

Commit

Permalink
bugfix: Check for supported signature algorithms when casting a key.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimeperez committed Feb 26, 2018
1 parent 0cc66be commit 28448b8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/SAML2/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ public static function castKey(XMLSecurityKey $key, $algorithm, $type = 'public'
return $key;
}

if (!in_array($algorithm, array(
XMLSecurityKey::RSA_SHA1,
XMLSecurityKey::RSA_SHA256,
XMLSecurityKey::RSA_SHA384,
XMLSecurityKey::RSA_SHA512
))) {
throw new \Exception('Unsupported signing algorithm.');
}

$keyInfo = openssl_pkey_get_details($key->key);
if ($keyInfo === FALSE) {
throw new Exception('Unable to get key details from XMLSecurityKey.');
Expand Down

0 comments on commit 28448b8

Please sign in to comment.