Skip to main content

Name

msys.validate.opendkim.get_num_sigs — Return the number of DKIM signatures

Synopsis

msys.validate.opendkim.get_num_sigs(dkim)

dkim: userdata, DKIM type

Description

**Configuration Change. ** This function is available as of version 3.6.

This function returns the number of DKIM signatures and requires the opendkim module. The dkim parameter is an array of DKIM_SIGINFO objects created by msys.validate.opendkim.verify. For a description of the DKIM_SIGINFO object see DKIM_DSIGINFO.

1require("opendkim.dkim");
2require("msys.validate.opendkim");
3local mod = {};
4
5function mod:validate_data(msg, accept, vctx)
6  local num = 0;
7  local stat;
8  local dkim_sig;
9  local dkim = msys.validate.opendkim.verify(msg);
10  num, stat = msys.validate.opendkim.get_num_sigs(dkim);
11  -- create loop controlled by num 
12  if num > 0 then
13    for i = 0, num-1 do
14      dkim_sig = msys.validate.opendkim.get_sig(dkim, i);
15      -- now do something with the signature
16      local size = msys.validate.opendkim.get_sig_keysize(dkim_sig);
17      if size < 1024 then
18        ...
19      end
20    end
21  end 
22  return msys.core.VALIDATE_CONT;
23end
24msys.registerModule("test_opendkim", mod);

This function returns the number of signatures and the DKIM status (DKIM_STAT). DKIM_STAT can be any one of the following values:

  • DKIM_STAT_OK – successful completion

  • DKIM_STAT_BADSIG – signature did not match headers and body

  • DKIM_STAT_NOSIG – no signature present

  • DKIM_STAT_NOKEY – no key available for verifying

  • DKIM_STAT_CANTVRFY – can't get key for verifying

  • DKIM_STAT_SYNTAX – message is not in valid syntax

  • DKIM_STAT_NORESOURCE – resource unavailable

  • DKIM_STAT_INTERNAL – internal error

  • DKIM_STAT_REVOKED – signing key revoked

  • DKIM_STAT_INVALID – invalid parameter(s)

  • DKIM_STAT_NOTIMPLEMENT – function not implemented

  • DKIM_STAT_KEYFAIL – key retrieval failed (try again later)

  • DKIM_STAT_CBREJECT – callback requested message rejection

  • DKIM_STAT_CBTRYAGAIN – callback can't complete (try again later)

  • DKIM_STAT_CBERROR – unspecified callback error

Enable this function with the statement require('msys.validate.opendkim');.

See Also

Was this page helpful?