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

SAML2: Add createKeyDescriptor() helper-function.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2291 44740490-163a-0410-bde0-09ae8108e29a
parent 71c45291
No related branches found
No related tags found
No related merge requests found
......@@ -469,4 +469,29 @@ class SAML2_Utils {
}
}
/**
* Create a KeyDescriptor with the given certificate.
*
* @param string $x509Data The certificate, as a base64-encoded DER data.
* @return SAML2_XML_md_KeyDescriptor The keydescriptor.
*/
public static function createKeyDescriptor($x509Data) {
assert('is_string($x509Data)');
$x509Certificate = new SAML2_XML_ds_X509Certificate();
$x509Certificate->certificate = $x509Data;
$x509Data = new SAML2_XML_ds_X509Data();
$x509Data->data[] = $x509Certificate;
$keyInfo = new SAML2_XML_ds_KeyInfo();
$keyInfo->info[] = $x509Data;
$keyDescriptor = new SAML2_XML_md_KeyDescriptor();
$keyDescriptor->KeyInfo = $keyInfo;
return $keyDescriptor;
}
}
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