diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php index 9f15e1c061f949b995ff0473e6721fd0ed00999d..951e6a934650f7b67b99096b9b8cb9d5697f85f8 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