diff --git a/docs/simplesamlphp-reference-idp-hosted.txt b/docs/simplesamlphp-reference-idp-hosted.txt
index ca70f4f641d64989aec7c1c512f95325662359ac..9e2d14d097bf8ad576a9b0e4da72d4c5d99f6be0 100644
--- a/docs/simplesamlphp-reference-idp-hosted.txt
+++ b/docs/simplesamlphp-reference-idp-hosted.txt
@@ -156,6 +156,11 @@ The following SAML 2.0 options are available:
     any value in the SP-remote metadata overrides the one configured
     in the IdP metadata.
 
+`https.certificate`
+:   The certificate used by the webserver when handling connections.
+    This certificate will be added to the generated metadata of the IdP,
+    which is required by some SPs when using the HTTP-Artifact binding.
+
 `SingleSignOnService`
 :   Override the default URL for the SingleSignOnService for this
     IdP. This is an absolute URL. The default value is
diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php
index aeffb1af61bd5d8a1d89a499b6133659e90d0eb8..edd176e52762a2d6fcf8402d5001435ee2f16ed5 100644
--- a/lib/SimpleSAML/Metadata/SAMLBuilder.php
+++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php
@@ -586,15 +586,15 @@ class SimpleSAML_Metadata_SAMLBuilder {
 	private function addCertificate(SAML2_XML_md_RoleDescriptor $rd, SimpleSAML_Configuration $metadata) {
 
 		$certInfo = SimpleSAML_Utilities::loadPublicKey($metadata);
-		if ($certInfo === NULL || !array_key_exists('certData', $certInfo)) {
-			/* No certificate to add. */
-			return;
+		if ($certInfo !== NULL && array_key_exists('certData', $certInfo)) {
+			$certData = $certInfo['certData'];
+			$this->addX509KeyDescriptor($rd, 'signing', $certData);
+			$this->addX509KeyDescriptor($rd, 'encryption', $certData);
 		}
 
-		$certData = $certInfo['certData'];
-
-		$this->addX509KeyDescriptor($rd, 'signing', $certData);
-		$this->addX509KeyDescriptor($rd, 'encryption', $certData);
+		if ($metadata->hasValue('https.certData')) {
+			$this->addX509KeyDescriptor($rd, 'signing', $metadata->getString('https.certData'));
+		}
 	}
 
 }
diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php
index 965fa39144bc1eaae94358696f58f49ca7499839..9cd1f96011794b80aae221853d88ce3302600231 100644
--- a/www/saml2/idp/metadata.php
+++ b/www/saml2/idp/metadata.php
@@ -60,6 +60,12 @@ try {
 		$metaArray['scope'] = $idpmeta->getArray('scope');
 	}
 
+	if ($idpmeta->hasValue('https.certificate')) {
+		$httpsCert = SimpleSAML_Utilities::loadPublicKey($idpmeta, TRUE, 'https.');
+		assert('isset($httpsCert["certData"])');
+		$metaArray['https.certData'] = $httpsCert['certData'];
+	}
+
 
 	$metaflat = '$metadata[' . var_export($idpentityid, TRUE) . '] = ' . var_export($metaArray, TRUE) . ';';