From 7dbce74a96d2b149adbc53daf58c33ec7492b1e3 Mon Sep 17 00:00:00 2001 From: Django Doucet Date: Fri, 21 Apr 2023 09:36:17 -0600 Subject: [PATCH] ensure signature block has algorithm --- includes/class-signature.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/includes/class-signature.php b/includes/class-signature.php index 0b2184d..9261d99 100644 --- a/includes/class-signature.php +++ b/includes/class-signature.php @@ -184,11 +184,13 @@ class Signature { } public static function get_signature_algorithm( $signature_block ) { - switch ( $signature_block['algorithm'] ) { - case 'rsa-sha-512': - return 'sha512'; - default: - return 'sha256'; + if ( $signature_block['algorithm'] ) { + switch ( $signature_block['algorithm'] ) { + case 'rsa-sha-512': + return 'sha512'; //hs2019 https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures-12 + default: + return 'sha256'; + } } return false; }