diff --git a/modules/saml/lib/Message.php b/modules/saml/lib/Message.php
index 64c06da132b4848b3a3e29b4db2d0cae673ebeef..3e0c7b51c5fddffaf2eb52ef1e94ec14a2eb4712 100644
--- a/modules/saml/lib/Message.php
+++ b/modules/saml/lib/Message.php
@@ -11,13 +11,13 @@
 class sspmod_saml_Message {
 
 	/**
-	 * Add signature key and and senders certificate to an element (Message or Assertion).
+	 * Add signature key and sender certificate to an element (Message or Assertion).
 	 *
 	 * @param SimpleSAML_Configuration $srcMetadata  The metadata of the sender.
 	 * @param SimpleSAML_Configuration $dstMetadata  The metadata of the recipient.
 	 * @param SAML2_Message $element  The element we should add the data to.
 	 */
-	public static function addSign(SimpleSAML_Configuration $srcMetadata, SimpleSAML_Configuration $dstMetadata = NULL, SAML2_SignedElement $element) {
+	public static function addSign(SimpleSAML_Configuration $srcMetadata, SimpleSAML_Configuration $dstMetadata, SAML2_SignedElement $element) {
 
 		$keyArray = SimpleSAML_Utilities::loadPrivateKey($srcMetadata, TRUE);
 		$certArray = SimpleSAML_Utilities::loadPublicKey($srcMetadata, FALSE);
diff --git a/www/saml2/idp/ArtifactResolutionService.php b/www/saml2/idp/ArtifactResolutionService.php
index 3b674b31552355ef868a8730178d2ff287326e4c..cf34392518dd4fc747ec124007dd4c60e443e45f 100644
--- a/www/saml2/idp/ArtifactResolutionService.php
+++ b/www/saml2/idp/ArtifactResolutionService.php
@@ -34,6 +34,10 @@ $request = $binding->receive();
 if (!($request instanceof SAML2_ArtifactResolve)) {
 	throw new Exception('Message received on ArtifactResolutionService wasn\'t a ArtifactResolve request.');
 }
+
+$issuer = $request->getIssuer();
+$spMetadata = $metadata->getMetadataConfig($issuer, 'saml20-sp-remote');
+
 $artifact = $request->getArtifact();
 
 $responseData = $store->get('artifact', $artifact);
@@ -51,5 +55,5 @@ $artifactResponse = new SAML2_ArtifactResponse();
 $artifactResponse->setIssuer($idpEntityId);
 $artifactResponse->setInResponseTo($request->getId());
 $artifactResponse->setAny($responseXML);
-sspmod_saml_Message::addSign($idpMetadata, NULL, $artifactResponse);
+sspmod_saml_Message::addSign($idpMetadata, $spMetadata, $artifactResponse);
 $binding->send($artifactResponse);