diff --git a/composer.json b/composer.json
index fbe519d128900c8b3518e1bbe4f3babd2c59525e..ee3202e08026904164ba02a5426cbb532b9706ec 100644
--- a/composer.json
+++ b/composer.json
@@ -35,7 +35,7 @@
 		"ext-date": "*",
 		"ext-hash": "*",
 		"ext-json": "*",
-        "simplesamlphp/saml2": "dev-master#00e38f85b417be1e10a2d738dd2f5ea82edb472c as 2.2",
+        "simplesamlphp/saml2": "dev-master#a94403bfe5627c90fe3764e0ada5a44841a11e80 as 2.3.3",
         "robrichards/xmlseclibs": "~2.0",
         "whitehat101/apr1-md5": "~1.0",
         "twig/twig": "~1.0",
diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php
index 35156f7dbe192c5d60ed1841d9e9cfc6c0c8bc87..90451b7130eaabd1ac9fb2a5eebb259c755085bf 100644
--- a/lib/SimpleSAML/Metadata/SAMLBuilder.php
+++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php
@@ -688,6 +688,10 @@ class SimpleSAML_Metadata_SAMLBuilder
         $e = new \SAML2\XML\md\ContactPerson();
         $e->contactType = $type;
 
+        if (!empty($details['attributes'])) {
+            $e->ContactPersonAttributes = $details['attributes'];
+        }
+
         if (isset($details['company'])) {
             $e->Company = $details['company'];
         }
diff --git a/lib/SimpleSAML/Utils/Config/Metadata.php b/lib/SimpleSAML/Utils/Config/Metadata.php
index d9f93283520931b807bf1492e78d905d7e149984..8232e2d3fe3860f95b6da2feca07d2510998f18c 100644
--- a/lib/SimpleSAML/Utils/Config/Metadata.php
+++ b/lib/SimpleSAML/Utils/Config/Metadata.php
@@ -27,6 +27,12 @@ class Metadata
 
 
     /**
+     * Valid options for the ContactPerson element
+     *
+     * The 'attributes' option isn't defined in section 2.3.2.2 of the OASIS document, but
+     * it is required to allow additons to the main contact person element for trust
+     * frameworks.
+     *
      * @var array The valid configuration options for a contact configuration array.
      * @see "Metadata for the OASIS Security Assertion Markup Language (SAML) V2.0", section 2.3.2.2.
      */
@@ -37,6 +43,7 @@ class Metadata
         'surName',
         'telephoneNumber',
         'company',
+        'attributes',
     );
 
 
@@ -108,6 +115,13 @@ class Metadata
             throw new \InvalidArgumentException('"contactType" is mandatory and must be one of '.$types.".");
         }
 
+        // check attributes is an associative array
+        if (isset($contact['attributes'])) {
+            if (empty($contact['attributes']) || empty(array_filter(array_keys($contact['attributes']), 'is_string'))) {
+                throw new \InvalidArgumentException('"attributes" must be an array and cannot be empty.');
+            }
+        }
+
         // try to fill in givenName and surName from name
         if (isset($contact['name']) && !isset($contact['givenName']) && !isset($contact['surName'])) {
             // first check if it's comma separated