<html> <head><title>dkim_sign()</title></head> <body> <!-- $Id: dkim_sign.html,v 1.6 2010/07/24 04:52:15 cm-msk Exp $ --> <h1>dkim_sign()</h1> <p align="right"><a href="index.html">[back to index]</a></p> <table border="0" cellspacing=4 cellpadding=4> <!---------- Synopsis -----------> <tr><th valign="top" align=left width=150>SYNOPSIS</th><td> <pre> #include <dkim.h> <a href="dkim.html"><tt>DKIM</tt></a> *dkim_sign( <a href="dkim_lib.html"><tt>DKIM_LIB</tt></a> *libhandle, const char *id, void *memclosure, const unsigned char *secretkey, const unsigned char *selector, const unsigned char *domain, <a href="dkim_canon_t.html"><tt>dkim_canon_t</tt></a> hdrcanon_alg, <a href="dkim_canon_t.html"><tt>dkim_canon_t</tt></a> bodycanon_alg, <a href="dkim_alg_t.html"><tt>dkim_alg_t</tt></a> sign_alg, ssize_t length <a href="dkim_stat.html"><tt>DKIM_STAT</tt></a> *statp ); </pre> Create a new handle for signing a message. </td></tr> <!----------- Description ----------> <tr><th valign="top" align=left>DESCRIPTION</th><td> <table border="1" cellspacing=1 cellpadding=4> <tr align="left" valign=top> <th width="80">Called When</th> <td><tt>dkim_sign()</tt> is called when preparing to process a new message that will be signed later by a private key. </td> </tr> </table> <!----------- Arguments ----------> <tr><th valign="top" align=left>ARGUMENTS</th><td> <table border="1" cellspacing=0> <tr bgcolor="#dddddd"><th>Argument</th><th>Description</th></tr> <tr valign="top"><td>libhandle</td> <td><b>DKIM</b> library instance handle, returned by an earlier call to <a href="dkim_init.html"><tt>dkim_init()</tt></a>. </td></tr> <tr valign="top"><td>id</td> <td>An opaque, printable string for identifying this message, suitable for use in logging or debug output. </td></tr> <tr valign="top"><td>memclosure</td> <td>Opaque memory closure, passed directly to the caller-provided <tt>malloc()</tt> and/or <tt>free()</tt> replacement functions. </td></tr> <tr valign="top"><td>secretkey</td> <td>The private key to be used when signing this message. This must be a NULL-terminated string containing either a PEM-formatted private key, or a DER-formatted private key after being encoded with base64. </td></tr> <tr valign="top"><td>selector</td> <td>The name of the selector to be reported in the signature on this message. </td></tr> <tr valign="top"><td>domain</td> <td>The domain doing the signing; this will be the domain whose DNS will be queried by the verifier for key and policy data. </td></tr> <tr valign="top"><td>hdrcanon_alg</td> <td>The canonicalization algorithm to use when preparing the headers of this message for signing. </td></tr> <tr valign="top"><td>bodycanon_alg</td> <td>The canonicalization algorithm to use when preparing the body of this message for signing. </td></tr> <tr valign="top"><td>sign_alg</td> <td>The signing algorithm to use when generating the signature to be attached to this message. </td></tr> <tr valign="top"><td>length</td> <td>The number of bytes of the body to sign. A value of -1 will cause the entire message to be signed. </td></tr> <tr valign="top"><td>statp</td> <td>Pointer to a <a href="dkim_stat.html"><tt>DKIM_STAT</tt></a> object which receives the completion status of this operation. </td></tr> </table> </td></tr> <!----------- Notes ----------> <tr> <th valign="top" align=left>NOTES</th> <td> <ul> <li><tt>DKIM_STAT_INVALID</tt> can be returned if, for example, a signing handle using SHA256 is requested when the library was not compiled against a version of OpenSSL that had support for that hash algorithm. </ul> </td> </tr> <!----------- Return Values ----------> <tr> <th valign="top" align=left>RETURN VALUES</th> <td> <ul> <li>On success, a pointer to the created <a href="dkim.html"><tt>DKIM</tt></a> handle is returned. <li>On failure, NULL is returned and the value of <tt>statp</tt> is updated to indicate the cause of the problem. </ul> </td> </tr> </table> <hr size="1"> <font size="-1"> Copyright (c) 2005-2007 Sendmail, Inc. and its suppliers. All rights reserved. <br> Copyright (c) 2009-2011, The OpenDKIM Project. All rights reserved. <br> By using this file, you agree to the terms and conditions set forth in the respective licenses. </font> </body> </html>