From 8276a25484530d1c7bf262d9a5b7da3748ab6f76 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Fri, 20 Jun 2008 13:36:48 +0000 Subject: [PATCH] SimpleSAML_Metadata_SAMLParser: Add support for retrieving all X509-certificates which signs the entity. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@686 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Metadata/SAMLParser.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php index 9f15e1c06..951e6a934 100644 --- a/lib/SimpleSAML/Metadata/SAMLParser.php +++ b/lib/SimpleSAML/Metadata/SAMLParser.php @@ -1124,6 +1124,29 @@ class SimpleSAML_Metadata_SAMLParser { return FALSE; } + + /** + * Retrieve the X509 certificate(s) which was used to sign the metadata. + * + * This function will return all X509 certificates which validates this entity. + * The certificates will be returned as an array with strings with PEM-encoded certificates. + * + * @return Array with PEM-encoded certificates. This may be an empty array if no + * certificates sign this entity. + */ + public function getX509Certificates() { + $ret = array(); + + foreach($this->validator as $validator) { + $cert = $validator->getX509Certificate(); + if($cert !== NULL) { + $ret[] = $cert; + } + } + + return $ret; + } + } ?> \ No newline at end of file -- GitLab