# dkim_set_key_lookup()

[back to index]

SYNOPSIS

    #include <dkim.h>
    DKIM_STAT dkim_set_key_lookup(
    	DKIM_LIB *libopendkim,
            DKIM_CBSTAT (*func) (DKIM *dkim,
                                 DKIM_SIGINFO *siginfo,
    	                     unsigned char *buf,
    	                     size_t buflen));
    );

Defines a function which should do key lookups rather than implementing the DKIM specification (e.g a DNS lookup). The query method specified in the signature will be ignored.

DESCRIPTION

Called When | `dkim_set_key_lookup()` can be called at any time.

ARGUMENTS

Argument | Description
--- | ---
libopendkim | Library-specific instance handle, returned by `dkim_init()`.

func

A pointer to a function which the library should use in place of its own code to do key lookups. The function will receive four things: A `DKIM` handle referencing the job being processed, a pointer to a `DKIM_SIGINFO` handle identifying the signature whose public key should be retrieved, a pointer to a buffer that should receive the result of the key lookup, and the number of bytes available there. The function should return an appropriate `DKIM_CBSTAT` return code after loading the buffer with its lookup result (if any). If `func` is NULL, the internal key lookup implementation, which will do what the signature requests, will be used.

RETURN VALUES

- DKIM_STAT_OK -- success

NOTES

- The callback should place into the provided buffer a NULL-terminated string formatted as a legal DKIM key record according to RFC4871 Section 3.6.1.

Copyright (c) 2007 Sendmail, Inc. and its suppliers. All rights reserved.
Copyright (c) 2009-2011, The OpenDKIM Project. All rights reserved.
By using this file, you agree to the terms and conditions set forth in the respective licenses.