]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix rawkey loading in arc module
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 24 Sep 2018 11:49:03 +0000 (12:49 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 24 Sep 2018 11:49:03 +0000 (12:49 +0100)
src/plugins/lua/arc.lua

index ebc3ac280e33b18748487f328c216fbe0d3e77cc..bf6010c3fd624b191de945e9bc6b7be3314d4f30 100644 (file)
@@ -394,13 +394,19 @@ local function arc_sign_seal(task, params, header)
   local privkey
 
   if params.rawkey then
-    privkey = rspamd_rsa_privkey.load_pem(params.rawkey)
+    -- Distinguish between pem and base64
+    if string.match(params.rawkey, '^-----BEGIN') then
+      privkey = rspamd_rsa_privkey.load_pem(params.rawkey)
+    else
+      privkey = rspamd_rsa_privkey.load_base64(params.rawkey)
+    end
   elseif params.key then
     privkey = rspamd_rsa_privkey.load_file(params.key)
   end
 
   if not privkey then
     rspamd_logger.errx(task, 'cannot load private key for signing')
+    return
   end
 
   if settings.reuse_auth_results then