From f85f97bfddc543cf211b94ec5784fd2c61832ac9 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 24 Sep 2018 12:49:03 +0100 Subject: [PATCH] [Minor] Fix rawkey loading in arc module --- src/plugins/lua/arc.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/lua/arc.lua b/src/plugins/lua/arc.lua index ebc3ac280..bf6010c3f 100644 --- a/src/plugins/lua/arc.lua +++ b/src/plugins/lua/arc.lua @@ -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 -- 2.39.5