Skip to content
Snippets Groups Projects
Commit 9437553f authored by Olav Morken's avatar Olav Morken
Browse files

{SAML20,Shib13}/HTTPPost: Use SimpleSAML_Utilities::load{Private,Public}Key

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@932 44740490-163a-0410-bde0-09ae8108e29a
parent f3ffd33d
No related branches found
No related tags found
No related merge requests found
......@@ -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',
));
......
......@@ -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') ,
));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment