# dkim_getsighdr_d()

[back to index]

SYNOPSIS

    #include <dkim.h>
    DKIM_STAT dkim_getsighdr_d(
    	DKIM *dkim,
            size_t initial,
            unsigned char **buf,
            size_t *len
    );

Compute and retrieve the signature header for a message. This is similar to `dkim_getsighdr()` except that memory will be allocated for an arbitrarily long signature header, and a pointer to that memory will be returned as well as the length of the string at that location.

The memory thus allocated will be deallocated by the library when the `dkim` handle is closed.

DESCRIPTION

Called When | `dkim_getsig()` is called after `dkim_eom()` when `dkim` is a signing handle, i.e. one returned by an earlier call to `dkim_sign()`.

ARGUMENTS

Argument | Description
--- | ---
dkim | Message-specific handle, returned by `dkim_sign()`.
initial | Line length already consumed on the first line. Used to leave space when wrapping headers for the name of the header itself.
buf | The address of a pointer that will be updated to reference a buffer into which the generated signature header was placed. The buffer is NUL-terminated.
len | The address of an integer that will be updated to contain the length of the generated signature header. The length does not include the NUL byte at the end.

NOTES

- It is an error to call this function with a handle that was created using `dkim_verify()`.
- If for example, you want to have your headers wrapped at 75 bytes and the header to be added will be called "DKIM-Signature", the `initial` value should be 16 (length of the header's name plus room for a colon and a space). The default margin is 75; see `dkim_set_margin()`.
- When signing and "simple" canonicalization is in use, the header added to the message must be identical to the internal version used to generate the signature, or the message will not verify. In that case, the value of `initial` should be 16 (or more portably, `strlen(DKIM_SIGNHEADER) + 2)`.

Copyright (c) 2005, 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.