diff --git a/lib/SimpleSAML/Bindings/SAML20/HTTPPost.php b/lib/SimpleSAML/Bindings/SAML20/HTTPPost.php index 6b1b22b6256926bf84a354321064539b9849878d..83680fa8edde825cec263de47502efa187e36c29 100644 --- a/lib/SimpleSAML/Bindings/SAML20/HTTPPost.php +++ b/lib/SimpleSAML/Bindings/SAML20/HTTPPost.php @@ -64,24 +64,12 @@ class SimpleSAML_Bindings_SAML20_HTTPPost { $destination = $spmd['AssertionConsumerService']; - if(!array_key_exists('privatekey', $idpmd)) { - throw new Exception('Missing \'privatekey\' option from metadata for idp: ' . $idpmetaindex); - } - - if(!array_key_exists('certificate', $idpmd)) { - throw new Exception('Missing \'certificate\' option from metadata for idp: ' . $idpmetaindex); - } - - if(array_key_exists('privatekey_pass', $idpmd)) { - $passphrase = $idpmd['privatekey_pass']; - } else { - $passphrase = NULL; - } + $privatekey = SimpleSAML_Utilities::loadPrivateKey($idpmd, TRUE); + $publickey = SimpleSAML_Utilities::loadPublicKey($idpmd, TRUE); $signer = new SimpleSAML_XML_Signer(array( - 'privatekey' => $idpmd['privatekey'], - 'privatekey_pass' => $passphrase, - 'certificate' => $idpmd['certificate'], + 'privatekey_array' => $privatekey, + 'publickey_array' => $publickey, 'id' => 'ID', )); diff --git a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php index ef2f97eb94781f1380a96dcbd026a68c15293507..9290a670311b57d13885736e4d649b3134173e34 100644 --- a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php +++ b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php @@ -82,23 +82,9 @@ class SimpleSAML_Bindings_Shib13_HTTPPost { throw new Exception('Claimed ACS (shire) and ACS in SP Metadata do not match. [' . $claimedacs. '] [' . $destination . ']'); } + $privatekey = SimpleSAML_Utilities::loadPrivateKey($idpmd, TRUE); + $publickey = SimpleSAML_Utilities::loadPublicKey($idpmd, TRUE); - if(!array_key_exists('privatekey', $idpmd)) { - throw new Exception('Missing \'privatekey\' option from metadata for idp: ' . $idpmetaindex); - } - - if(!array_key_exists('certificate', $idpmd)) { - throw new Exception('Missing \'certificate\' option from metadata for idp: ' . $idpmetaindex); - } - - if(array_key_exists('privatekey_pass', $idpmd)) { - $passphrase = $idpmd['privatekey_pass']; - } else { - $passphrase = NULL; - } - - - $responsedom = new DOMDocument(); $responsedom->loadXML(str_replace ("\r", "", $response)); @@ -130,9 +116,8 @@ class SimpleSAML_Bindings_Shib13_HTTPPost { $signer = new SimpleSAML_XML_Signer(array( - 'privatekey' => $idpmd['privatekey'], - 'privatekey_pass' => $passphrase, - 'certificate' => $idpmd['certificate'], + 'privatekey_array' => $privatekey, + 'publickey_array' => $publickey, 'id' => ($signResponse ? 'ResponseID' : 'AssertionID') , ));