I've improved my last patch. Now it can work on versions 34 and 35. I also fixed an issue that could prevent me from communicating with a server that doesn't have this patch. But I'm not sure if it's gone. I don't have any linux devices on which I can run nextcloud for experiments. But in any case, it allows nextcloud to work with other instances that have this patch. It's better than it being completely inoperable

--- lib/public/Security/Signature/Enum/SignatureAlgorithm.php  Thu Sep 24 16:42:24 2026 +++ /var/www/nextcloud/lib/public/Security/Signature/Enum/SignatureAlgorithm.php       Thu Oct  1 16:58:52 2026
@@ -22,4 +22,11 @@
        case RSA_SHA256 = 'rsa-sha256';
        /** @since 33.0.0 */
        case RSA_SHA512 = 'rsa-sha512';
+
+        public function toInt(): int {
+                return match($this) {
+                        self::RSA_SHA256 => OPENSSL_ALGO_SHA256,
+                        self::RSA_SHA512 => OPENSSL_ALGO_SHA512,
+                };
+        }
 }

--- a/lib/private/Security/Signature/Model/IncomingSignedRequest.php     Thu Sep 24 16:42:24 2026 +++ b/lib/private/Security/Signature/Model/IncomingSignedRequest.php  Thu Oct  1 17:06:08 2026
@@ -255,7 +255,7 @@
                        implode("\n", $this->getSignatureData()),
                        base64_decode($this->getSignature()),
                        $publicKey,
-                       $algorithm->value
+                       $algorithm->toInt()
                ) !== 1) {
                        throw new InvalidSignatureException('signature issue');
                }

--- lib/private/Security/Signature/Model/OutgoingSignedRequest.php   Thu Sep 24 16:42:24 2026 +++ /var/www/nextcloud/lib/private/Security/Signature/Model/OutgoingSignedRequest.php  Thu Oct  1 17:01:17 2026
@@ -188,7 +188,7 @@
                        implode("\n", $this->getSignatureData()),
                        $signed,
                        $privateKey,
-                       $this->getAlgorithm()->value
+                       $this->getAlgorithm()->toInt()
                );

                $this->setSignature(base64_encode($signed));


Reply via email to