diff --git a/lib/SimpleSAML/Utils/Crypto.php b/lib/SimpleSAML/Utils/Crypto.php
index 14cfeec0f921174a049171cd75a127bdef6b53ff..480d3a6ebb6346e879fd784a7b69796014597f8f 100644
--- a/lib/SimpleSAML/Utils/Crypto.php
+++ b/lib/SimpleSAML/Utils/Crypto.php
@@ -53,8 +53,8 @@ class Crypto
             }
         }
 
-        throw new \SimpleSAML_Error_Exception("Failed to decrypt ciphertext \"".bin2hex($ciphertext).
-            '", hmac: "'.bin2hex($hmac).'", iv: "'.bin2hex($iv).'", msg: "'.bin2hex($msg).'"');
+        throw new \SimpleSAML_Error_Exception("Failed to decrypt ciphertext \"".
+            base64_encode($ciphertext).'", hmac: "'.base64_encode($hmac).'", iv: "'.base64_encode($iv).'"');
     }