diff --git a/lib/SimpleSAML/XML/SAML20/AuthnResponse.php b/lib/SimpleSAML/XML/SAML20/AuthnResponse.php
index 8f0390f6d59af6f79f8517e0a10c8e9cfc744e0b..6f7f5146402e123e5e94a671db2edc375d364564 100644
--- a/lib/SimpleSAML/XML/SAML20/AuthnResponse.php
+++ b/lib/SimpleSAML/XML/SAML20/AuthnResponse.php
@@ -392,7 +392,7 @@ class SimpleSAML_XML_SAML20_AuthnResponse extends SimpleSAML_XML_AuthnResponse {
 		
 		$destination = $spmd['AssertionConsumerService'];
 		
-		$base64 = isset($idpmd['base64attributes']) ? $idpmd['base64attributes'] : false;
+		$base64 = isset($spmd['base64attributes']) ? $spmd['base64attributes'] : false;
 		
 		$encodedattributes = '';
 		foreach ($attributes AS $name => $values) {