From a2ac09c77c68833b3530c3c49ff0e248f0f5b077 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 30 Jul 2024 11:38:52 +0200 Subject: [PATCH] Bugfix: do not pretify XML before encrypting it --- src/XML/EncryptableElementTrait.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/XML/EncryptableElementTrait.php b/src/XML/EncryptableElementTrait.php index a85d4b06..89021882 100644 --- a/src/XML/EncryptableElementTrait.php +++ b/src/XML/EncryptableElementTrait.php @@ -71,10 +71,12 @@ public function encrypt(EncryptionAlgorithmInterface $encryptor): EncryptedData $encryptor->setBackend($this->getEncryptionBackend()); } + $xmlRepresentation = $this->toXML(); + return new EncryptedData( new CipherData( new CipherValue( - base64_encode($encryptor->encrypt($this->__toString())), + base64_encode($encryptor->encrypt($xmlRepresentation->ownerDocument->saveXML($xmlRepresentation))), ), ), null,