Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 6ce9b276009a949b503cba300e09bfb2 > files > 7

opencdk-devel-0.6.6-1400.fc14.x86_64.rpm

<html>
<title>OpenCDK API Overview</title><body>
<head></head>

<!-- This file contains an intro section for OpenCDK.
    this file is included in the opencdk-api.html and
    thus should not have any begin or end HTML headers. 
 -->
 
<h2>Open Crypto Development Kit (OpenCDK) </h2>

<p> <b> Introduction </b> &nbsp;<br>

OpenCDK is a library which implements basic parts of the
OpenPGP (RFC2440) message format.

</p>


<a name="cdk_armor_filter_use">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_armor_filter_use</b>
(<i>cdk_stream_t</i> <b>inp</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>inp</b>
<dd> the stream to check
</dl>
<h3>Description</h3>
<ul>
Check if the stream contains armored data.
</ul>
<hr>


<a name="cdk_file_armor">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_file_armor</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>const char *</i> <b>file</b>
, <i>const char *</i> <b>output</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> Handle
<dt><i>const char *</i> <b>file</b>
<dd> Name of the file to protect.
<dt><i>const char *</i> <b>output</b>
<dd> Output filename.
</dl>
<h3>Description</h3>
<ul>
Protect a file with ASCII armor.
</ul>
<hr>


<a name="cdk_file_dearmor">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_file_dearmor</b>
(<i>const char *</i> <b>file</b>
, <i>const char *</i> <b>output</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const char *</i> <b>file</b>
<dd> Name of the file to unprotect.
<dt><i>const char *</i> <b>output</b>
<dd> Output filename.
</dl>
<h3>Description</h3>
<ul>
Remove ASCII armor from a file.
</ul>
<hr>


<a name="cdk_armor_encode_buffer">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_armor_encode_buffer</b>
(<i>const byte *</i> <b>inbuf</b>
, <i>size_t</i> <b>inlen</b>
, <i>char *</i> <b>outbuf</b>
, <i>size_t</i> <b>outlen</b>
, <i>size_t *</i> <b>nwritten</b>
, <i>int</i> <b>type</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const byte *</i> <b>inbuf</b>
<dd> the raw input buffer
<dt><i>size_t</i> <b>inlen</b>
<dd> raw buffer len
<dt><i>char *</i> <b>outbuf</b>
<dd> the destination buffer for the base64 output
<dt><i>size_t</i> <b>outlen</b>
<dd> destination buffer len
<dt><i>size_t *</i> <b>nwritten</b>
<dd> actual length of the base64 data
<dt><i>int</i> <b>type</b>
<dd> the base64 file type.
</dl>
<h3>Description</h3>
<ul>
Encode the given buffer into base64 format.
</ul>
<hr>


<a name="cdk_stream_encrypt">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_encrypt</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>cdk_strlist_t</i> <b>remusr</b>
, <i>cdk_stream_t</i> <b>inp</b>
, <i>cdk_stream_t</i> <b>out</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> Context handle for options
<dt><i>cdk_strlist_t</i> <b>remusr</b>
<dd> List of recipients
<dt><i>cdk_stream_t</i> <b>inp</b>
<dd> Input stream handle
<dt><i>cdk_stream_t</i> <b>out</b>
<dd> Output stream handle
</dl>
<h3>Description</h3>
<ul>
If remusr is NULL, then symmetric encryption is used. Via the
handle the caller can set or unset multiple options.
</ul>
<hr>


<a name="cdk_file_encrypt">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_file_encrypt</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>cdk_strlist_t</i> <b>remusr</b>
, <i>const char *</i> <b>file</b>
, <i>const char *</i> <b>output</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> Context handle
<dt><i>cdk_strlist_t</i> <b>remusr</b>
<dd> List of recipient
<dt><i>const char *</i> <b>file</b>
<dd> Input file
<dt><i>const char *</i> <b>output</b>
<dd> Output file
</dl>
<h3>Description</h3>
<ul>
Encrypt the given file and encrypt the session key with the
given recipient keys.
</ul>
<hr>


<a name="cdk_file_decrypt">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_file_decrypt</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>const char *</i> <b>file</b>
, <i>const char *</i> <b>output</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> Handle.
<dt><i>const char *</i> <b>file</b>
<dd> Name of the file to decrypt.
<dt><i>const char *</i> <b>output</b>
<dd> Output filename.
</dl>
<h3>Description</h3>
<ul>
Decrypt a file. When the operation was successful, hd can contain 
information about the signature (when present) and more.
</ul>
<hr>


<a name="cdk_data_transform">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_data_transform</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>enum cdk_crypto_mode_t</i> <b>mode</b>
, <i>cdk_strlist_t</i> <b>locusr</b>
, <i>cdk_strlist_t</i> <b>remusr</b>
, <i>const void *</i> <b>inbuf</b>
, <i>size_t</i> <b>insize</b>
, <i>byte **</i> <b>outbuf</b>
, <i>size_t *</i> <b>outsize</b>
, <i>int</i> <b>modval</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> session handle
<dt><i>enum cdk_crypto_mode_t</i> <b>mode</b>
<dd> crypto mode
<dt><i>cdk_strlist_t</i> <b>locusr</b>
<dd> local user list (sign mode only)
<dt><i>cdk_strlist_t</i> <b>remusr</b>
<dd> remote users 'recipients'
<dt><i>const void *</i> <b>inbuf</b>
<dd> input buffer with data
<dt><i>size_t</i> <b>insize</b>
<dd> length of data in bytes
<dt><i>byte **</i> <b>outbuf</b>
<dd> pointer to the output data (will be allocated)
<dt><i>size_t *</i> <b>outsize</b>
<dd> size of the new data in bytes
<dt><i>int</i> <b>modval</b>
<dd> value for the modus (for example sign mode)
</dl>
<h3>Description</h3>
<ul>
This function transforms data into the given openpgp mode. It works
exactly like the cdk_file_xxx functions with the exception that it can
be used with memory and not with streams or files.
</ul>
<hr>


<a name="cdk_kbnode_new">&nbsp</a><h2>Function</h2>
<i>cdk_kbnode_t</i>
<b>cdk_kbnode_new</b>
(<i>cdk_packet_t</i> <b>pkt</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_packet_t</i> <b>pkt</b>
<dd> the packet to add
</dl>
<h3>Description</h3>
<ul>
Allocate a new key node and add the packet.
</ul>
<hr>


<a name="cdk_kbnode_release">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_kbnode_release</b>
(<i>cdk_kbnode_t</i> <b>node</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd></dl>
<h3>Description</h3>
<ul>
Release the memory of the node.
</ul>
<hr>


<a name="cdk_kbnode_delete">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_kbnode_delete</b>
(<i>cdk_kbnode_t</i> <b>node</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the key node
</dl>
<h3>Description</h3>
<ul>
Mark the given node as deleted.
</ul>
<hr>


<a name="cdk_kbnode_insert">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_kbnode_insert</b>
(<i>cdk_kbnode_t</i> <b>root</b>
, <i>cdk_kbnode_t</i> <b>node</b>
, <i>int</i> <b>pkttype</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>root</b>
<dd> the root key node
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the node to add
<dt><i>int</i> <b>pkttype</b>
<dd> packet type
</dl>
<h3>Description</h3>
<ul>
Insert @node into the list after @root but before a packet which is not of
type @pkttype (only if @pkttype != 0).
</ul>
<hr>


<a name="cdk_kbnode_find_prev">&nbsp</a><h2>Function</h2>
<i>cdk_kbnode_t</i>
<b>cdk_kbnode_find_prev</b>
(<i>cdk_kbnode_t</i> <b>root</b>
, <i>cdk_kbnode_t</i> <b>node</b>
, <i>int</i> <b>pkttype</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>root</b>
<dd> the root key node
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the key node
<dt><i>int</i> <b>pkttype</b>
<dd> packet type
</dl>
<h3>Description</h3>
<ul>
Find the previous node (if @pkttype = 0) or the previous node
with pkttype @pkttype in the list starting with @root of @node.
</ul>
<hr>


<a name="cdk_kbnode_find_next">&nbsp</a><h2>Function</h2>
<i>cdk_kbnode_t</i>
<b>cdk_kbnode_find_next</b>
(<i>cdk_kbnode_t</i> <b>node</b>
, <i>int</i> <b>pkttype</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the key node
<dt><i>int</i> <b>pkttype</b>
<dd> packet type
</dl>
<h3>Description</h3>
<ul>
Ditto, but find the next packet.  The behaviour is trivial if
@pkttype is 0 but if it is specified, the next node with a packet
of this type is returned.  The function has some knowledge about
</ul>
<h3>the valid ordering of packets</h3>
<ul>
 e.g. if the next signature packet
is requested, the function will not return one if it encounters
a user-id.
</ul>
<hr>


<a name="cdk_kbnode_find">&nbsp</a><h2>Function</h2>
<i>cdk_kbnode_t</i>
<b>cdk_kbnode_find</b>
(<i>cdk_kbnode_t</i> <b>node</b>
, <i>int</i> <b>pkttype</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the key node
<dt><i>int</i> <b>pkttype</b>
<dd> packet type
</dl>
<h3>Description</h3>
<ul>
Try to find the next node with the packettype @pkttype.
</ul>
<hr>


<a name="cdk_kbnode_find_packet">&nbsp</a><h2>Function</h2>
<i>cdk_packet_t</i>
<b>cdk_kbnode_find_packet</b>
(<i>cdk_kbnode_t</i> <b>node</b>
, <i>int</i> <b>pkttype</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the key node
<dt><i>int</i> <b>pkttype</b>
<dd> packet type
</dl>
<h3>Description</h3>
<ul>
Same as cdk_kbnode_find but it returns the packet instead of the node.
</ul>
<hr>


<a name="cdk_kbnode_commit">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_kbnode_commit</b>
(<i>cdk_kbnode_t *</i> <b>root</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t *</i> <b>root</b>
<dd> the nodes
</dl>
<h3>Description</h3>
<ul>
Commit changes made to the kblist at ROOT. Note that ROOT my change,
and it is therefore passed by reference.
The function has the effect of removing all nodes marked as deleted.
returns true if any node has been changed 
</ul>
<hr>


<a name="cdk_kbnode_remove">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_kbnode_remove</b>
(<i>cdk_kbnode_t *</i> <b>root</b>
, <i>cdk_kbnode_t</i> <b>node</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t *</i> <b>root</b>
<dd> the root node
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the node to delete
</dl>
<h3>Description</h3>
<ul>
Remove a node from the root node.
</ul>
<hr>


<a name="cdk_kbnode_move">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_kbnode_move</b>
(<i>cdk_kbnode_t *</i> <b>root</b>
, <i>cdk_kbnode_t</i> <b>node</b>
, <i>cdk_kbnode_t</i> <b>where</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t *</i> <b>root</b>
<dd> root node
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the node to move
<dt><i>cdk_kbnode_t</i> <b>where</b>
<dd> destination place where to move the node.
</dl>
<h3>Description</h3>
<ul>
Move NODE behind right after WHERE or to the beginning if WHERE is NULL.
</ul>
<hr>


<a name="cdk_kbnode_get_packet">&nbsp</a><h2>Function</h2>
<i>cdk_packet_t</i>
<b>cdk_kbnode_get_packet</b>
(<i>cdk_kbnode_t</i> <b>node</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the key node
</dl>
<h3>Description</h3>
<ul>
Return the packet which is stored inside the node in @node.
</ul>
<hr>


<a name="cdk_kbnode_read_from_mem">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_kbnode_read_from_mem</b>
(<i>cdk_kbnode_t *</i> <b>ret_node</b>
, <i>const byte *</i> <b>buf</b>
, <i>size_t</i> <b>buflen</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t *</i> <b>ret_node</b>
<dd> the new key node
<dt><i>const byte *</i> <b>buf</b>
<dd> the buffer which stores the key sequence
<dt><i>size_t</i> <b>buflen</b>
<dd> the length of the buffer
</dl>
<h3>Description</h3>
<ul>
Try to read a key node from the memory buffer @buf.
</ul>
<hr>


<a name="cdk_kbnode_write_to_mem_alloc">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_kbnode_write_to_mem_alloc</b>
(<i>cdk_kbnode_t</i> <b>node</b>
, <i>byte **</i> <b>r_buf</b>
, <i>size_t *</i> <b>r_buflen</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the key node
<dt><i>byte **</i> <b>r_buf</b>
<dd> buffer to hold the raw data
<dt><i>size_t *</i> <b>r_buflen</b>
<dd> buffer length of the allocated raw data.
</dl>
<h3>Description</h3>
<ul>
The function acts similar to cdk_kbnode_write_to_mem but
it allocates the buffer to avoid the lengthy second run.
</ul>
<hr>


<a name="cdk_kbnode_write_to_mem">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_kbnode_write_to_mem</b>
(<i>cdk_kbnode_t</i> <b>node</b>
, <i>byte *</i> <b>buf</b>
, <i>size_t *</i> <b>r_nbytes</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the key node
<dt><i>byte *</i> <b>buf</b>
<dd> the buffer to store the node data
<dt><i>size_t *</i> <b>r_nbytes</b>
<dd> the new length of the buffer.
</dl>
<h3>Description</h3>
<ul>
Try to write the contents of the key node to the buffer @buf and
return the length of it in @r_nbytes. If buf is zero, only the
length of the node is calculated and returned in @r_nbytes.
Whenever it is possible, the cdk_kbnode_write_to_mem_alloc should be used.
</ul>
<hr>


<a name="cdk_kbnode_hash">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_kbnode_hash</b>
(<i>cdk_kbnode_t</i> <b>node</b>
, <i>gcry_md_hd_t</i> <b>md</b>
, <i>int</i> <b>is_v4</b>
, <i>int</i> <b>pkttype</b>
, <i>int</i> <b>flags</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>node</b>
<dd> the key node
<dt><i>gcry_md_hd_t</i> <b>md</b>
<dd><dt><i>int</i> <b>is_v4</b>
<dd> OpenPGP signature (yes=1, no=0)
<dt><i>int</i> <b>pkttype</b>
<dd> packet type to hash (if zero use the packet type from the node)
<dt><i>int</i> <b>flags</b>
<dd> flags which depend on the operation
</dl>
<h3>Description</h3>
<ul>
Hash the key node contents. Two modes are supported. If the packet
type is used (!= 0) then the function searches the first node with
this type. Otherwise the node is seen as a single node and the type
is extracted from it.
</ul>
<hr>


<a name="cdk_keydb_idx_rebuild">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keydb_idx_rebuild</b>
(<i>cdk_keydb_hd_t</i> <b>db</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keydb_hd_t</i> <b>db</b>
<dd></dl>
<h3>Description</h3>
<ul>
Rebuild the key index files for the given key database.
</ul>
<hr>


<a name="cdk_keydb_new_from_mem">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keydb_new_from_mem</b>
(<i>cdk_keydb_hd_t *</i> <b>r_db</b>
, <i>int</i> <b>secret</b>
, <i>const void *</i> <b>data</b>
, <i>size_t</i> <b>datlen</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keydb_hd_t *</i> <b>r_db</b>
<dd><dt><i>int</i> <b>secret</b>
<dd><dt><i>const void *</i> <b>data</b>
<dd> The raw key data.
<dt><i>size_t</i> <b>datlen</b>
<dd> The length of the raw data.
</dl>
<h3>Description</h3>
<ul>
Create a new keyring db handle from the contents of a buffer.
</ul>
<hr>


<a name="cdk_keydb_new_from_stream">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keydb_new_from_stream</b>
(<i>cdk_keydb_hd_t *</i> <b>r_hd</b>
, <i>int</i> <b>secret</b>
, <i>cdk_stream_t</i> <b>in</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keydb_hd_t *</i> <b>r_hd</b>
<dd> the output keydb handle
<dt><i>int</i> <b>secret</b>
<dd> does the stream contain secret key data
<dt><i>cdk_stream_t</i> <b>in</b>
<dd> the input stream to use
</dl>
<h3>Description</h3>
<ul>
This function creates a new keydb handle based on the given
stream. The stream is not closed in cdk_keydb_free() and it
is up to the caller to close it. No decoding is done.
</ul>
<hr>


<a name="cdk_keydb_new">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keydb_new</b>
(<i>cdk_keydb_hd_t *</i> <b>r_hd</b>
, <i>int</i> <b>type</b>
, <i>void *</i> <b>data</b>
, <i>size_t</i> <b>count</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keydb_hd_t *</i> <b>r_hd</b>
<dd> handle to store the new keydb object
<dt><i>int</i> <b>type</b>
<dd> type of the keyring
<dt><i>void *</i> <b>data</b>
<dd> data which depends on the keyring type
<dt><i>size_t</i> <b>count</b>
<dd> length of the data
</dl>
<h3>Description</h3>
<ul>
Create a new keydb object
</ul>
<hr>


<a name="cdk_keydb_free">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_keydb_free</b>
(<i>cdk_keydb_hd_t</i> <b>hd</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keydb_hd_t</i> <b>hd</b>
<dd> the keydb object
</dl>
<h3>Description</h3>
<ul>
Free the keydb object.
</ul>
<hr>


<a name="cdk_keydb_search_start">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keydb_search_start</b>
(<i>cdk_keydb_hd_t</i> <b>db</b>
, <i>int</i> <b>type</b>
, <i>void *</i> <b>desc</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keydb_hd_t</i> <b>db</b>
<dd> key database handle
<dt><i>int</i> <b>type</b>
<dd> specifies the search type
<dt><i>void *</i> <b>desc</b>
<dd> description which depends on the type
</dl>
<h3>Description</h3>
<ul>
Create a new keydb search object.
</ul>
<hr>


<a name="cdk_keydb_search">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keydb_search</b>
(<i>cdk_keydb_hd_t</i> <b>hd</b>
, <i>cdk_kbnode_t *</i> <b>ret_key</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keydb_hd_t</i> <b>hd</b>
<dd> the keydb object
<dt><i>cdk_kbnode_t *</i> <b>ret_key</b>
<dd> kbnode object to store the key
</dl>
<h3>Description</h3>
<ul>
Search for a key in the given keyring. The search mode is handled
via @ks. If the key was found, @ret_key contains the key data.
</ul>
<hr>


<a name="cdk_listkey_start">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_listkey_start</b>
(<i>cdk_listkey_t *</i> <b>r_ctx</b>
, <i>cdk_keydb_hd_t</i> <b>db</b>
, <i>const char *</i> <b>patt</b>
, <i>cdk_strlist_t</i> <b>fpatt</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_listkey_t *</i> <b>r_ctx</b>
<dd> pointer to store the new context
<dt><i>cdk_keydb_hd_t</i> <b>db</b>
<dd> the key database handle
<dt><i>const char *</i> <b>patt</b>
<dd> string pattern
<dt><i>cdk_strlist_t</i> <b>fpatt</b>
<dd> recipients from a stringlist to show
</dl>
<h3>Description</h3>
<ul>
Prepare a key listing with the given parameters. Two modes are supported.
The first mode uses string pattern to determine if the key should be
returned or not. The other mode uses a string list to request the key
which should be listed.
</ul>
<hr>


<a name="cdk_listkey_close">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_listkey_close</b>
(<i>cdk_listkey_t</i> <b>ctx</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_listkey_t</i> <b>ctx</b>
<dd> the list key context
</dl>
<h3>Description</h3>
<ul>
Free the list key context.
</ul>
<hr>


<a name="cdk_listkey_next">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_listkey_next</b>
(<i>cdk_listkey_t</i> <b>ctx</b>
, <i>cdk_kbnode_t *</i> <b>ret_key</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_listkey_t</i> <b>ctx</b>
<dd> list key context
<dt><i>cdk_kbnode_t *</i> <b>ret_key</b>
<dd></dl>
<h3>Description</h3>
<ul>
Retrieve the next key from the pattern of the key list context.
</ul>
<hr>


<a name="cdk_keygen_set_prefs">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keygen_set_prefs</b>
(<i>cdk_keygen_ctx_t</i> <b>hd</b>
, <i>enum cdk_pref_type_t</i> <b>type</b>
, <i>const byte *</i> <b>array</b>
, <i>size_t</i> <b>n</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keygen_ctx_t</i> <b>hd</b>
<dd> the preference type
<dt><i>enum cdk_pref_type_t</i> <b>type</b>
<dd><dt><i>const byte *</i> <b>array</b>
<dd> one-octet array with algorithm numers
<dt><i>size_t</i> <b>n</b>
<dd></dl>
<hr>


<a name="cdk_keygen_set_name">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_keygen_set_name</b>
(<i>cdk_keygen_ctx_t</i> <b>hd</b>
, <i>const char *</i> <b>name</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keygen_ctx_t</i> <b>hd</b>
<dd> the keygen object
<dt><i>const char *</i> <b>name</b>
<dd> the name to use
</dl>
<h3>Description</h3>
<ul>
It is suggested to use a name in the following format
'First Name' 'Last Name' <email-address.domain>'
To avoid charset conflicts, the name will be encoded in utf8.
</ul>
<hr>


<a name="cdk_keygen_set_algo_info">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keygen_set_algo_info</b>
(<i>cdk_keygen_ctx_t</i> <b>hd</b>
, <i>int</i> <b>type</b>
, <i>int</i> <b>usage</b>
, <i>enum cdk_pubkey_algo_t</i> <b>algo</b>
, <i>unsigned int</i> <b>bits</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keygen_ctx_t</i> <b>hd</b>
<dd> the keygen object.
<dt><i>int</i> <b>type</b>
<dd> key type (primary=0, subkey=1)
<dt><i>int</i> <b>usage</b>
<dd> key usage
<dt><i>enum cdk_pubkey_algo_t</i> <b>algo</b>
<dd> algorithm compliant with rfc2440
<dt><i>unsigned int</i> <b>bits</b>
<dd> lengt of the key in bits
</dl>
<h3>Description</h3>
<ul>
set the length and type of the key
</ul>
<hr>


<a name="cdk_keygen_set_keyserver_flags">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_keygen_set_keyserver_flags</b>
(<i>cdk_keygen_ctx_t</i> <b>hd</b>
, <i>int</i> <b>no_modify</b>
, <i>const char *</i> <b>pref_url</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keygen_ctx_t</i> <b>hd</b>
<dd> the handle
<dt><i>int</i> <b>no_modify</b>
<dd> set the keyserver no modify flag for the key
<dt><i>const char *</i> <b>pref_url</b>
<dd> set the preferred keyser URL.
</dl>
<h3>Description</h3>
<ul>
Set some keyserver specific options for the new key.
</ul>
<hr>


<a name="cdk_keygen_set_expire_date">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_keygen_set_expire_date</b>
(<i>cdk_keygen_ctx_t</i> <b>hd</b>
, <i>int</i> <b>type</b>
, <i>long</i> <b>timestamp</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keygen_ctx_t</i> <b>hd</b>
<dd> keygen object
<dt><i>int</i> <b>type</b>
<dd> key type( 0=primary, 1=seconardy)
<dt><i>long</i> <b>timestamp</b>
<dd> the date the key should expire
</dl>
<h3>Description</h3>
<ul>
set the expire date of the requested key
</ul>
<hr>


<a name="cdk_keygen_start">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keygen_start</b>
(<i>cdk_keygen_ctx_t</i> <b>hd</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keygen_ctx_t</i> <b>hd</b>
<dd> the keygen object
</dl>
<hr>


<a name="cdk_keygen_save">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keygen_save</b>
(<i>cdk_keygen_ctx_t</i> <b>hd</b>
, <i>const char *</i> <b>pubf</b>
, <i>const char *</i> <b>secf</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keygen_ctx_t</i> <b>hd</b>
<dd> the keygen object
<dt><i>const char *</i> <b>pubf</b>
<dd><dt><i>const char *</i> <b>secf</b>
<dd></dl>
<hr>


<a name="cdk_keygen_free">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_keygen_free</b>
(<i>cdk_keygen_ctx_t</i> <b>hd</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keygen_ctx_t</i> <b>hd</b>
<dd> the keygen object
</dl>
<hr>


<a name="cdk_keygen_new">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keygen_new</b>
(<i>cdk_keygen_ctx_t *</i> <b>r_hd</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keygen_ctx_t *</i> <b>r_hd</b>
<dd> the new object
</dl>
<h3>Description</h3>
<ul>
allocate a new key generation context.
</ul>
<hr>


<a name="cdk_pklist_select_algo">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_pklist_select_algo</b>
(<i>cdk_keylist_t</i> <b>pkl</b>
, <i>int</i> <b>preftype</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keylist_t</i> <b>pkl</b>
<dd> the keylist
<dt><i>int</i> <b>preftype</b>
<dd> preference type
</dl>
<h3>Description</h3>
<ul>
Select a symmetric cipher algorithm from a list of public keys.
This algorithm is present in all key preferences.
</ul>
<hr>


<a name="cdk_pklist_release">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_pklist_release</b>
(<i>cdk_keylist_t</i> <b>pkl</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keylist_t</i> <b>pkl</b>
<dd> the keylist
</dl>
<h3>Description</h3>
<ul>
Free the memory of the key list.
</ul>
<hr>


<a name="cdk_pklist_build">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pklist_build</b>
(<i>cdk_keylist_t *</i> <b>ret_pkl</b>
, <i>cdk_keydb_hd_t</i> <b>db</b>
, <i>cdk_strlist_t</i> <b>remusr</b>
, <i>int</i> <b>usage</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keylist_t *</i> <b>ret_pkl</b>
<dd> the new keylist
<dt><i>cdk_keydb_hd_t</i> <b>db</b>
<dd><dt><i>cdk_strlist_t</i> <b>remusr</b>
<dd> the string list of the recipients
<dt><i>int</i> <b>usage</b>
<dd> public key usage
</dl>
<h3>Description</h3>
<ul>
Create a public key list based on the recipient names in @remusr.
</ul>
<hr>


<a name="cdk_pklist_encrypt">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pklist_encrypt</b>
(<i>cdk_keylist_t</i> <b>pk_list</b>
, <i>cdk_dek_t</i> <b>dek</b>
, <i>cdk_stream_t</i> <b>outp</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keylist_t</i> <b>pk_list</b>
<dd><dt><i>cdk_dek_t</i> <b>dek</b>
<dd> the data encryption key
<dt><i>cdk_stream_t</i> <b>outp</b>
<dd> the stream to write in the data
</dl>
<h3>Description</h3>
<ul>
Encrypt the session key with each key of the list and wrap it
into a PUBKEY_ENC packet and write it to @outp.
</ul>
<hr>


<a name="cdk_sklist_release">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_sklist_release</b>
(<i>cdk_keylist_t</i> <b>sk_list</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keylist_t</i> <b>sk_list</b>
<dd></dl>
<h3>Description</h3>
<ul>
Free the memory of the secret keylist.
</ul>
<hr>


<a name="cdk_sklist_build">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_sklist_build</b>
(<i>cdk_keylist_t *</i> <b>ret_skl</b>
, <i>cdk_keydb_hd_t</i> <b>db</b>
, <i>cdk_ctx_t</i> <b>hd</b>
, <i>cdk_strlist_t</i> <b>locusr</b>
, <i>int</i> <b>unlock</b>
, <i>unsigned int</i> <b>usage</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keylist_t *</i> <b>ret_skl</b>
<dd> return the allocated sec key list.
<dt><i>cdk_keydb_hd_t</i> <b>db</b>
<dd> keydb handle
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> session handle
<dt><i>cdk_strlist_t</i> <b>locusr</b>
<dd> local user list
<dt><i>int</i> <b>unlock</b>
<dd> 1=unlock secret keys
<dt><i>unsigned int</i> <b>usage</b>
<dd> secret key usage.
</dl>
<hr>


<a name="cdk_sklist_write_onepass">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_sklist_write_onepass</b>
(<i>cdk_keylist_t</i> <b>skl</b>
, <i>cdk_stream_t</i> <b>outp</b>
, <i>int</i> <b>sigclass</b>
, <i>int</i> <b>mdalgo</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keylist_t</i> <b>skl</b>
<dd> secret keylist
<dt><i>cdk_stream_t</i> <b>outp</b>
<dd> the stream to write in the data
<dt><i>int</i> <b>sigclass</b>
<dd> the class of the sig to create
<dt><i>int</i> <b>mdalgo</b>
<dd> the message digest algorithm
</dl>
<h3>Description</h3>
<ul>
Write a one-pass signature for each key in the list into @outp.
</ul>
<hr>


<a name="cdk_sklist_write">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_sklist_write</b>
(<i>cdk_keylist_t</i> <b>skl</b>
, <i>cdk_stream_t</i> <b>outp</b>
, <i>gcry_md_hd_t</i> <b>hash</b>
, <i>int</i> <b>sigclass</b>
, <i>int</i> <b>sigver</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_keylist_t</i> <b>skl</b>
<dd> secret keylist
<dt><i>cdk_stream_t</i> <b>outp</b>
<dd> the stream to write in the data
<dt><i>gcry_md_hd_t</i> <b>hash</b>
<dd> opaque handle for the message digest operations
<dt><i>int</i> <b>sigclass</b>
<dd> the class of the sig
<dt><i>int</i> <b>sigver</b>
<dd> version of the sig
</dl>
<h3>Description</h3>
<ul>
Complete the sig based on @hash and write all signatures to @outp.
</ul>
<hr>


<a name="cdk_keyserver_recv_key">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_keyserver_recv_key</b>
(<i>const char *</i> <b>host</b>
, <i>int</i> <b>port</b>
, <i>const byte *</i> <b>keyid</b>
, <i>int</i> <b>kid_type</b>
, <i>cdk_kbnode_t *</i> <b>ret_key</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const char *</i> <b>host</b>
<dd> URL or hostname of the keyserver
<dt><i>int</i> <b>port</b>
<dd> The port to use for the connection
<dt><i>const byte *</i> <b>keyid</b>
<dd> KeyID of the key to retrieve
<dt><i>int</i> <b>kid_type</b>
<dd> KeyID type (long, short, fingerprint)
<dt><i>cdk_kbnode_t *</i> <b>ret_key</b>
<dd></dl>
<h3>Description</h3>
<ul>
Receive a key from a keyserver.
</ul>
<hr>


<a name="cdk_strerror">&nbsp</a><h2>Function</h2>
<i>const char*</i>
<b>cdk_strerror</b>
(<i>int</i> <b>ec</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>int</i> <b>ec</b>
<dd> the error number
</dl>
<h3>Description</h3>
<ul>
Return an error text for the given id.
</ul>
<hr>


<a name="cdk_set_malloc_hooks">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_set_malloc_hooks</b>
(<i>void *</i> <b>(*new_alloc_func</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>void *</i> <b>(*new_alloc_func</b>
<dd></dl>
<h3>Description</h3>
<ul>
Set private memory hooks for the library.
</ul>
<hr>


<a name="cdk_malloc_hook_initialized">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_malloc_hook_initialized</b>
(<i></i> <b>void</b>
)
<h3>Arguments</h3>
<dl>
<dt><i></i> <b>void</b>
<dd></dl>
<h3>Description</h3>
<ul>
<p>
Return if the malloc hooks are already initialized.
</ul>
<hr>


<a name="cdk_calloc">&nbsp</a><h2>Function</h2>
<i>void*</i>
<b>cdk_calloc</b>
(<i>size_t</i> <b>n</b>
, <i>size_t</i> <b>m</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>size_t</i> <b>n</b>
<dd> amount of elements
<dt><i>size_t</i> <b>m</b>
<dd> size of one element
</dl>
<h3>Description</h3>
<ul>
Safe wrapper around the c-function calloc.
</ul>
<hr>


<a name="cdk_lib_startup">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_lib_startup</b>
(<i></i> <b>void</b>
)
<h3>Arguments</h3>
<dl>
<dt><i></i> <b>void</b>
<dd></dl>
<h3>Description</h3>
<ul>
<p>
Prepare the internal structures of the library.
This function should be called before any other CDK function.
</ul>
<hr>


<a name="cdk_lib_shutdown">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_lib_shutdown</b>
(<i></i> <b>void</b>
)
<h3>Arguments</h3>
<dl>
<dt><i></i> <b>void</b>
<dd></dl>
<h3>Description</h3>
<ul>
<p>
Shutdown the library and free all internal and globally used
memory and structures. This function should be called in the
exit handler of the calling program.
</ul>
<hr>


<a name="cdk_salloc">&nbsp</a><h2>Function</h2>
<i>void*</i>
<b>cdk_salloc</b>
(<i>size_t</i> <b>size</b>
, <i>int</i> <b>clear</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>size_t</i> <b>size</b>
<dd> how much bytes should be allocated.
<dt><i>int</i> <b>clear</b>
<dd> shall the buffer cleared after the allocation?
</dl>
<h3>Description</h3>
<ul>
Allocated the requested amount of bytes in 'secure' memory.
</ul>
<hr>


<a name="cdk_set_log_handler">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_set_log_handler</b>
(<i>cdk_log_fnc_t</i> <b>logfnc</b>
, <i>void *</i> <b>opaque</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_log_fnc_t</i> <b>logfnc</b>
<dd> the function pointer
<dt><i>void *</i> <b>opaque</b>
<dd> a private values for the function
</dl>
<h3>Description</h3>
<ul>
Set a custom handler for logging.
</ul>
<hr>


<a name="cdk_set_log_level">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_set_log_level</b>
(<i>int</i> <b>level</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>int</i> <b>level</b>
<dd></dl>
<h3>Description</h3>
<ul>
Set the verbosity level.
</ul>
<hr>


<a name="cdk_handle_control">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_handle_control</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>int</i> <b>action</b>
, <i>int</i> <b>cmd</b>
, <i></i> <b>...</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> session handle
<dt><i>int</i> <b>action</b>
<dd> flag which indicates whether put or get is requested
<dt><i>int</i> <b>cmd</b>
<dd> command id
<dt><i></i> <b>...</b>
<dd></dl>
<h3>Description</h3>
<ul>
Perform various control operations for the current session.
</ul>
<hr>


<a name="cdk_handle_new">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_handle_new</b>
(<i>cdk_ctx_t *</i> <b>r_ctx</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t *</i> <b>r_ctx</b>
<dd> context to store the handle
</dl>
<h3>Description</h3>
<ul>
create a new session handle.
</ul>
<hr>


<a name="cdk_handle_set_keyring">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_handle_set_keyring</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>int</i> <b>type</b>
, <i>const char *</i> <b>kringname</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> session handle
<dt><i>int</i> <b>type</b>
<dd> public=0 or secret=1 keyring type
<dt><i>const char *</i> <b>kringname</b>
<dd> file name of the keyring which shall be used.
</dl>
<h3>Description</h3>
<ul>
Convenient function to set the keyring for the current session.
</ul>
<hr>


<a name="cdk_handle_set_keydb">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_handle_set_keydb</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>cdk_keydb_hd_t</i> <b>db</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> session handle
<dt><i>cdk_keydb_hd_t</i> <b>db</b>
<dd> the database handle
</dl>
<h3>Description</h3>
<ul>
set the key database handle.
the function automatically detects whether this is a public or
secret keyring and the right handle is set.
</ul>
<hr>


<a name="cdk_handle_get_keydb">&nbsp</a><h2>Function</h2>
<i>cdk_keydb_hd_t</i>
<b>cdk_handle_get_keydb</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>int</i> <b>type</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> session handle
<dt><i>int</i> <b>type</b>
<dd> type of the keyring
</dl>
<h3>Description</h3>
<ul>
Return the keydb handle from the session handle.
The caller should not free these handles.
</ul>
<hr>


<a name="cdk_handle_set_passphrase_cb">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_handle_set_passphrase_cb</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>char *</i> <b>(*cb</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> session handle
<dt><i>char *</i> <b>(*cb</b>
<dd></dl>
<h3>Description</h3>
<ul>
set the passphrase callback.
</ul>
<hr>


<a name="cdk_handle_verify_get_result">&nbsp</a><h2>Function</h2>
<i>cdk_verify_result_t</i>
<b>cdk_handle_verify_get_result</b>
(<i>cdk_ctx_t</i> <b>hd</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> the session handle
</dl>
<h3>Description</h3>
<ul>
Return the verify result for the current session.
Do not free the pointer.
</ul>
<hr>


<a name="cdk_handle_free">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_handle_free</b>
(<i>cdk_ctx_t</i> <b>hd</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> the handle
</dl>
<h3>Description</h3>
<ul>
Release the main handle.
</ul>
<hr>


<a name="cdk_check_version">&nbsp</a><h2>Function</h2>
<i>const char *</i>
<b>cdk_check_version</b>
(<i>const char *</i> <b>req_version</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const char *</i> <b>req_version</b>
<dd> The requested version
</dl>
<h3>Description</h3>
<ul>
Check that the the version of the library is at minimum the requested
one and return the version string; return NULL if the condition is
not satisfied.  If a NULL is passed to this function, no check is done,
but the version string is simply returned.
</ul>
<hr>


<a name="cdk_strlist_free">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_strlist_free</b>
(<i>cdk_strlist_t</i> <b>sl</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_strlist_t</i> <b>sl</b>
<dd> the string list
</dl>
<h3>Description</h3>
<ul>
Release the string list object.
</ul>
<hr>


<a name="cdk_strlist_add">&nbsp</a><h2>Function</h2>
<i>cdk_strlist_t</i>
<b>cdk_strlist_add</b>
(<i>cdk_strlist_t *</i> <b>list</b>
, <i>const char *</i> <b>string</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_strlist_t *</i> <b>list</b>
<dd> destination string list
<dt><i>const char *</i> <b>string</b>
<dd> the string to add
</dl>
<h3>Description</h3>
<ul>
Add the given list to the string list.
</ul>
<hr>


<a name="cdk_strlist_next">&nbsp</a><h2>Function</h2>
<i>cdk_strlist_t</i>
<b>cdk_strlist_next</b>
(<i>cdk_strlist_t</i> <b>root</b>
, <i>const char **</i> <b>r_str</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_strlist_t</i> <b>root</b>
<dd> the opaque string list.
<dt><i>const char **</i> <b>r_str</b>
<dd> optional argument to store the string data.
</dl>
<h3>Description</h3>
<ul>
Return the next string list node from @root. The optional
argument @r_str return the data of the current (!) node.
</ul>
<hr>


<a name="cdk_utf8_encode">&nbsp</a><h2>Function</h2>
<i>char*</i>
<b>cdk_utf8_encode</b>
(<i>const char *</i> <b>string</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const char *</i> <b>string</b>
<dd></dl>
<h3>Description</h3>
<ul>
Encode the given string in utf8 and return it.
</ul>
<hr>


<a name="cdk_utf8_decode">&nbsp</a><h2>Function</h2>
<i>char *</i>
<b>cdk_utf8_decode</b>
(<i>const char *</i> <b>string</b>
, <i>size_t</i> <b>length</b>
, <i>int</i> <b>delim</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const char *</i> <b>string</b>
<dd> the string to decode
<dt><i>size_t</i> <b>length</b>
<dd> the length of the string
<dt><i>int</i> <b>delim</b>
<dd> the delimiter
</dl>
<h3>Description</h3>
<ul>
Decode the given utf8 string and return the native representation.
</ul>
<hr>


<a name="cdk_pkt_release">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_pkt_release</b>
(<i>cdk_packet_t</i> <b>pkt</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_packet_t</i> <b>pkt</b>
<dd> the packet
</dl>
<h3>Description</h3>
<ul>
Free the contents of the given package and
release the memory of the structure.
</ul>
<hr>


<a name="cdk_pkt_alloc">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pkt_alloc</b>
(<i>cdk_packet_t *</i> <b>r_pkt</b>
, <i>int</i> <b>pkttype</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_packet_t *</i> <b>r_pkt</b>
<dd> output is the new packet
<dt><i>int</i> <b>pkttype</b>
<dd> the requested packet type
</dl>
<h3>Description</h3>
<ul>
Allocate a new packet structure with the given packet type.
</ul>
<hr>


<a name="cdk_subpkt_free">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_subpkt_free</b>
(<i>cdk_subpkt_t</i> <b>ctx</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_subpkt_t</i> <b>ctx</b>
<dd> the sub packet node to free
</dl>
<h3>Description</h3>
<ul>
Release the context.
</ul>
<hr>


<a name="cdk_subpkt_find">&nbsp</a><h2>Function</h2>
<i>cdk_subpkt_t</i>
<b>cdk_subpkt_find</b>
(<i>cdk_subpkt_t</i> <b>ctx</b>
, <i>size_t</i> <b>type</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_subpkt_t</i> <b>ctx</b>
<dd> the sub packet node
<dt><i>size_t</i> <b>type</b>
<dd> the packet type to find
</dl>
<h3>Description</h3>
<ul>
Find the given packet type in the node. If no packet with this
type was found, return null otherwise pointer to the node.
</ul>
<hr>


<a name="cdk_subpkt_type_count">&nbsp</a><h2>Function</h2>
<i>size_t</i>
<b>cdk_subpkt_type_count</b>
(<i>cdk_subpkt_t</i> <b>ctx</b>
, <i>size_t</i> <b>type</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_subpkt_t</i> <b>ctx</b>
<dd> The sub packet context
<dt><i>size_t</i> <b>type</b>
<dd> The sub packet type.
</dl>
<h3>Description</h3>
<ul>
Return the amount of sub packets with this type.
</ul>
<hr>


<a name="cdk_subpkt_find_nth">&nbsp</a><h2>Function</h2>
<i>cdk_subpkt_t</i>
<b>cdk_subpkt_find_nth</b>
(<i>cdk_subpkt_t</i> <b>ctx</b>
, <i>size_t</i> <b>type</b>
, <i>size_t</i> <b>idx</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_subpkt_t</i> <b>ctx</b>
<dd> The sub packet context
<dt><i>size_t</i> <b>type</b>
<dd> The sub packet type
<dt><i>size_t</i> <b>idx</b>
<dd></dl>
<h3>Description</h3>
<ul>
Return the nth sub packet of the given type.
</ul>
<hr>


<a name="cdk_subpkt_new">&nbsp</a><h2>Function</h2>
<i>cdk_subpkt_t</i>
<b>cdk_subpkt_new</b>
(<i>size_t</i> <b>size</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>size_t</i> <b>size</b>
<dd> the size of the new context
</dl>
<h3>Description</h3>
<ul>
Create a new sub packet node with the size of @size.
</ul>
<hr>


<a name="cdk_subpkt_get_data">&nbsp</a><h2>Function</h2>
<i>const byte*</i>
<b>cdk_subpkt_get_data</b>
(<i>cdk_subpkt_t</i> <b>ctx</b>
, <i>size_t *</i> <b>r_type</b>
, <i>size_t *</i> <b>r_nbytes</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_subpkt_t</i> <b>ctx</b>
<dd> the sub packet node
<dt><i>size_t *</i> <b>r_type</b>
<dd> pointer store the packet type
<dt><i>size_t *</i> <b>r_nbytes</b>
<dd> pointer to store the packet size
</dl>
<h3>Description</h3>
<ul>
Extract the data from the given sub packet. The type is returned
in @r_type and the size in @r_nbytes.
</ul>
<hr>


<a name="cdk_subpkt_add">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_subpkt_add</b>
(<i>cdk_subpkt_t</i> <b>root</b>
, <i>cdk_subpkt_t</i> <b>node</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_subpkt_t</i> <b>root</b>
<dd> the root node
<dt><i>cdk_subpkt_t</i> <b>node</b>
<dd> the node to add
</dl>
<h3>Description</h3>
<ul>
Add the node in @node to the root node @root.
</ul>
<hr>


<a name="cdk_subpkt_init">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_subpkt_init</b>
(<i>cdk_subpkt_t</i> <b>node</b>
, <i>size_t</i> <b>type</b>
, <i>const void *</i> <b>buf</b>
, <i>size_t</i> <b>buflen</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_subpkt_t</i> <b>node</b>
<dd> the sub packet node
<dt><i>size_t</i> <b>type</b>
<dd> type of the packet which data should be initialized
<dt><i>const void *</i> <b>buf</b>
<dd> the buffer with the actual data
<dt><i>size_t</i> <b>buflen</b>
<dd> the size of the data
</dl>
<h3>Description</h3>
<ul>
Set the packet data of the given root and set the type of it.
</ul>
<hr>


<a name="cdk_subpkt_find_next">&nbsp</a><h2>Function</h2>
<i>cdk_subpkt_t</i>
<b>cdk_subpkt_find_next</b>
(<i>cdk_subpkt_t</i> <b>root</b>
, <i>size_t</i> <b>type</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_subpkt_t</i> <b>root</b>
<dd> the base where to begin the iteration
<dt><i>size_t</i> <b>type</b>
<dd> the type to find or 0 for the next node.
</dl>
<h3>Description</h3>
<ul>
Try to find the next node after @root with type.
If type is 0, the next node will be returned.
</ul>
<hr>


<a name="cdk_pk_encrypt">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pk_encrypt</b>
(<i>cdk_pubkey_t</i> <b>pk</b>
, <i>cdk_pkt_pubkey_enc_t</i> <b>pke</b>
, <i>gcry_mpi_t</i> <b>esk</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pubkey_t</i> <b>pk</b>
<dd> the public key
<dt><i>cdk_pkt_pubkey_enc_t</i> <b>pke</b>
<dd> the public key encrypted packet
<dt><i>gcry_mpi_t</i> <b>esk</b>
<dd> the actual session key
</dl>
<h3>Description</h3>
<ul>
Encrypt the session key in @esk and write its encrypted content
into the @pke struct.
</ul>
<hr>


<a name="cdk_pk_decrypt">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pk_decrypt</b>
(<i>cdk_seckey_t</i> <b>sk</b>
, <i>cdk_pkt_pubkey_enc_t</i> <b>pke</b>
, <i>gcry_mpi_t *</i> <b>r_sk</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_seckey_t</i> <b>sk</b>
<dd> the secret key
<dt><i>cdk_pkt_pubkey_enc_t</i> <b>pke</b>
<dd> public key encrypted packet
<dt><i>gcry_mpi_t *</i> <b>r_sk</b>
<dd> the object to store the plain session key
</dl>
<h3>Description</h3>
<ul>
Decrypt the encrypted session key from @pke into @r_sk.
</ul>
<hr>


<a name="cdk_pk_sign">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pk_sign</b>
(<i>cdk_seckey_t</i> <b>sk</b>
, <i>cdk_pkt_signature_t</i> <b>sig</b>
, <i>const byte *</i> <b>md</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_seckey_t</i> <b>sk</b>
<dd> secret key
<dt><i>cdk_pkt_signature_t</i> <b>sig</b>
<dd> signature
<dt><i>const byte *</i> <b>md</b>
<dd> the message digest
</dl>
<h3>Description</h3>
<ul>
Sign the message digest from @md and write the result into @sig.
</ul>
<hr>


<a name="cdk_pk_verify">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pk_verify</b>
(<i>cdk_pubkey_t</i> <b>pk</b>
, <i>cdk_pkt_signature_t</i> <b>sig</b>
, <i>const byte *</i> <b>md</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pubkey_t</i> <b>pk</b>
<dd> the public key
<dt><i>cdk_pkt_signature_t</i> <b>sig</b>
<dd> signature
<dt><i>const byte *</i> <b>md</b>
<dd> the message digest
</dl>
<h3>Description</h3>
<ul>
Verify the signature in @sig and compare it with the message digest in @md.
</ul>
<hr>


<a name="cdk_pk_get_nbits">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_pk_get_nbits</b>
(<i>cdk_pubkey_t</i> <b>pk</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pubkey_t</i> <b>pk</b>
<dd> the public key
</dl>
<h3>Description</h3>
<ul>
Return the length of the public key in bits.
The meaning of length is actually the size of the 'prime'
object in the key. For RSA keys the modulus, for ElG/DSA
the size of the public prime.
</ul>
<hr>


<a name="cdk_pk_get_npkey">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_pk_get_npkey</b>
(<i>int</i> <b>algo</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>int</i> <b>algo</b>
<dd> The public key algorithm.
</dl>
<h3>Description</h3>
<ul>
Return the number of multiprecison integer forming an public
key with the given algorithm.
</ul>
<hr>


<a name="cdk_pk_get_nskey">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_pk_get_nskey</b>
(<i>int</i> <b>algo</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>int</i> <b>algo</b>
<dd> the public key algorithm
</dl>
<h3>Description</h3>
<ul>
Return the number of multiprecision integers forming an
secret key with the given algorithm.
</ul>
<hr>


<a name="cdk_pk_get_nsig">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_pk_get_nsig</b>
(<i>int</i> <b>algo</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>int</i> <b>algo</b>
<dd> the public key algorithm
</dl>
<h3>Description</h3>
<ul>
Return the number of MPIs a signature consists of.
</ul>
<hr>


<a name="cdk_pk_get_nenc">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_pk_get_nenc</b>
(<i>int</i> <b>algo</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>int</i> <b>algo</b>
<dd> the public key algorithm
</dl>
<h3>Description</h3>
<ul>
Return the number of MPI's the encrypted data consists of.
</ul>
<hr>


<a name="cdk_pk_get_mpi">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pk_get_mpi</b>
(<i>cdk_pubkey_t</i> <b>pk</b>
, <i>size_t</i> <b>idx</b>
, <i>byte *</i> <b>buf</b>
, <i>size_t</i> <b>buflen</b>
, <i>size_t *</i> <b>r_nwritten</b>
, <i>size_t *</i> <b>r_nbits</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pubkey_t</i> <b>pk</b>
<dd> public key
<dt><i>size_t</i> <b>idx</b>
<dd> index of the MPI to retrieve
<dt><i>byte *</i> <b>buf</b>
<dd> buffer to hold the raw data
<dt><i>size_t</i> <b>buflen</b>
<dd><dt><i>size_t *</i> <b>r_nwritten</b>
<dd> output how large the raw data is
<dt><i>size_t *</i> <b>r_nbits</b>
<dd> size of the MPI in bits.
</dl>
<h3>Description</h3>
<ul>
Return the MPI with the given index of the public key.
</ul>
<hr>


<a name="cdk_sk_get_mpi">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_sk_get_mpi</b>
(<i>cdk_pkt_seckey_t</i> <b>sk</b>
, <i>size_t</i> <b>idx</b>
, <i>byte *</i> <b>buf</b>
, <i>size_t</i> <b>buflen</b>
, <i>size_t *</i> <b>r_nwritten</b>
, <i>size_t *</i> <b>r_nbits</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pkt_seckey_t</i> <b>sk</b>
<dd> secret key
<dt><i>size_t</i> <b>idx</b>
<dd> index of the MPI to retrieve
<dt><i>byte *</i> <b>buf</b>
<dd> buffer to hold the raw data
<dt><i>size_t</i> <b>buflen</b>
<dd><dt><i>size_t *</i> <b>r_nwritten</b>
<dd> output length of the raw data
<dt><i>size_t *</i> <b>r_nbits</b>
<dd> length of the MPI data in bits.
</dl>
<h3>Description</h3>
<ul>
Return the MPI of the given secret key with the
index @idx. It is important to check if the key
is protected and thus no real MPI data will be returned then.
</ul>
<hr>


<a name="cdk_sk_unprotect">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_sk_unprotect</b>
(<i>cdk_pkt_seckey_t</i> <b>sk</b>
, <i>const char *</i> <b>pw</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pkt_seckey_t</i> <b>sk</b>
<dd> the secret key
<dt><i>const char *</i> <b>pw</b>
<dd> the passphrase
</dl>
<h3>Description</h3>
<ul>
Unprotect the given secret key with the passphrase.
</ul>
<hr>


<a name="cdk_sk_protect">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_sk_protect</b>
(<i>cdk_pkt_seckey_t</i> <b>sk</b>
, <i>const char *</i> <b>pw</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pkt_seckey_t</i> <b>sk</b>
<dd> the secret key
<dt><i>const char *</i> <b>pw</b>
<dd> the passphrase to use
</dl>
<h3>Description</h3>
<ul>
Protect the given secret key with a passphrase.
</ul>
<hr>


<a name="cdk_pk_from_secret_key">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pk_from_secret_key</b>
(<i>cdk_pkt_seckey_t</i> <b>sk</b>
, <i>cdk_pubkey_t *</i> <b>ret_pk</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pkt_seckey_t</i> <b>sk</b>
<dd> the secret key
<dt><i>cdk_pubkey_t *</i> <b>ret_pk</b>
<dd> the new public key
</dl>
<h3>Description</h3>
<ul>
Create a new public key from a secret key.
</ul>
<hr>


<a name="cdk_pk_get_fingerprint">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pk_get_fingerprint</b>
(<i>cdk_pubkey_t</i> <b>pk</b>
, <i>byte *</i> <b>fpr</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pubkey_t</i> <b>pk</b>
<dd> the public key
<dt><i>byte *</i> <b>fpr</b>
<dd> the buffer to hold the fingerprint
</dl>
<h3>Description</h3>
<ul>
Return the fingerprint of the given public key.
The buffer must be at least 20 octets.
This function should be considered deprecated and
the new cdk_pk_to_fingerprint() should be used whenever
possible to avoid overflows.
</ul>
<hr>


<a name="cdk_pk_to_fingerprint">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pk_to_fingerprint</b>
(<i>cdk_pubkey_t</i> <b>pk</b>
, <i>byte *</i> <b>fprbuf</b>
, <i>size_t</i> <b>fprbuflen</b>
, <i>size_t *</i> <b>r_nout</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pubkey_t</i> <b>pk</b>
<dd> the public key
<dt><i>byte *</i> <b>fprbuf</b>
<dd> buffer to save the fingerprint
<dt><i>size_t</i> <b>fprbuflen</b>
<dd> buffer size
<dt><i>size_t *</i> <b>r_nout</b>
<dd> actual length of the fingerprint.
</dl>
<h3>Description</h3>
<ul>
Calculate a fingerprint of the given key and
return it in the given byte array.
</ul>
<hr>


<a name="cdk_pk_fingerprint_get_keyid">&nbsp</a><h2>Function</h2>
<i>u32</i>
<b>cdk_pk_fingerprint_get_keyid</b>
(<i>const byte *</i> <b>fpr</b>
, <i>size_t</i> <b>fprlen</b>
, <i>u32 *</i> <b>keyid</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const byte *</i> <b>fpr</b>
<dd> the key fingerprint
<dt><i>size_t</i> <b>fprlen</b>
<dd> the length of the fingerprint
<dt><i>u32 *</i> <b>keyid</b>
<dd></dl>
<h3>Description</h3>
<ul>
Derive the key ID from the key fingerprint.
For version 3 keys, this is not working.
</ul>
<hr>


<a name="cdk_pk_get_keyid">&nbsp</a><h2>Function</h2>
<i>u32</i>
<b>cdk_pk_get_keyid</b>
(<i>cdk_pubkey_t</i> <b>pk</b>
, <i>u32 *</i> <b>keyid</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pubkey_t</i> <b>pk</b>
<dd> the public key
<dt><i>u32 *</i> <b>keyid</b>
<dd> buffer to store the key ID
</dl>
<h3>Description</h3>
<ul>
Calculate the key ID of the given public key.
</ul>
<hr>


<a name="cdk_sk_get_keyid">&nbsp</a><h2>Function</h2>
<i>u32</i>
<b>cdk_sk_get_keyid</b>
(<i>cdk_pkt_seckey_t</i> <b>sk</b>
, <i>u32 *</i> <b>keyid</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pkt_seckey_t</i> <b>sk</b>
<dd> the secret key
<dt><i>u32 *</i> <b>keyid</b>
<dd> buffer to hold the key ID
</dl>
<h3>Description</h3>
<ul>
Calculate the key ID of the secret key, actually the public key.
</ul>
<hr>


<a name="cdk_sig_get_keyid">&nbsp</a><h2>Function</h2>
<i>u32</i>
<b>cdk_sig_get_keyid</b>
(<i>cdk_pkt_signature_t</i> <b>sig</b>
, <i>u32 *</i> <b>keyid</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pkt_signature_t</i> <b>sig</b>
<dd> the signature
<dt><i>u32 *</i> <b>keyid</b>
<dd> buffer to hold the key ID
</dl>
<h3>Description</h3>
<ul>
Retrieve the key ID from the given signature.
</ul>
<hr>


<a name="cdk_pubkey_to_sexp">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pubkey_to_sexp</b>
(<i>cdk_pubkey_t</i> <b>pk</b>
, <i>char **</i> <b>sexp</b>
, <i>size_t *</i> <b>len</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pubkey_t</i> <b>pk</b>
<dd> the public key
<dt><i>char **</i> <b>sexp</b>
<dd> where to store the S-expression
<dt><i>size_t *</i> <b>len</b>
<dd> the length of sexp
</dl>
<h3>Description</h3>
<ul>
Convert a public key to an S-expression. sexp is allocated by this
function, but you have to cdk_free() it yourself.  The S-expression
is stored in canonical format as used by libgcrypt
(GCRYSEXP_FMT_CANON).
</ul>
<hr>


<a name="cdk_seckey_to_sexp">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_seckey_to_sexp</b>
(<i>cdk_pkt_seckey_t</i> <b>sk</b>
, <i>char **</i> <b>sexp</b>
, <i>size_t *</i> <b>len</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_pkt_seckey_t</i> <b>sk</b>
<dd> the secret key
<dt><i>char **</i> <b>sexp</b>
<dd> where to store the S-expression
<dt><i>size_t *</i> <b>len</b>
<dd> the length of sexp
</dl>
<h3>Description</h3>
<ul>
Convert a public key to an S-expression. sexp is allocated by this
function, but you have to cdk_free() it yourself.  The S-expression
is stored in canonical format as used by libgcrypt
(GCRYSEXP_FMT_CANON).
</ul>
<hr>


<a name="cdk_pkt_read">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pkt_read</b>
(<i>cdk_stream_t</i> <b>inp</b>
, <i>cdk_packet_t</i> <b>pkt</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>inp</b>
<dd> the input stream
<dt><i>cdk_packet_t</i> <b>pkt</b>
<dd> allocated packet handle to store the packet
</dl>
<h3>Description</h3>
<ul>
Parse the next packet on the @inp stream and return its contents in @pkt.
</ul>
<hr>


<a name="cdk_dek_encode_pkcs1">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_dek_encode_pkcs1</b>
(<i>cdk_dek_t</i> <b>dek</b>
, <i>size_t</i> <b>nbits</b>
, <i>gcry_mpi_t *</i> <b>r_enc</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_dek_t</i> <b>dek</b>
<dd> DEK object
<dt><i>size_t</i> <b>nbits</b>
<dd> size of the multi precision integer frame
<dt><i>gcry_mpi_t *</i> <b>r_enc</b>
<dd> output of the encoded multiprecision integer
</dl>
<h3>Description</h3>
<ul>
Encode the given random session key in the DEK object
into a multiprecision integer.
</ul>
<hr>


<a name="cdk_dek_decode_pkcs1">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_dek_decode_pkcs1</b>
(<i>cdk_dek_t *</i> <b>ret_dek</b>
, <i>gcry_mpi_t</i> <b>esk</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_dek_t *</i> <b>ret_dek</b>
<dd> the decoded DEK object
<dt><i>gcry_mpi_t</i> <b>esk</b>
<dd> the pkcs#1 encoded session key.
</dl>
<h3>Description</h3>
<ul>
Decode the given multi precision integer in pkcs#1 and
store it into the DEK object.
</ul>
<hr>


<a name="cdk_dek_extract">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_dek_extract</b>
(<i>cdk_dek_t *</i> <b>ret_dek</b>
, <i>cdk_ctx_t</i> <b>hd</b>
, <i>cdk_pkt_pubkey_enc_t</i> <b>enc</b>
, <i>cdk_pkt_seckey_t</i> <b>sk</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_dek_t *</i> <b>ret_dek</b>
<dd><dt><i>cdk_ctx_t</i> <b>hd</b>
<dd><dt><i>cdk_pkt_pubkey_enc_t</i> <b>enc</b>
<dd> the public key encrypted packet
<dt><i>cdk_pkt_seckey_t</i> <b>sk</b>
<dd> the secret key.
</dl>
<h3>ret_dek</h3>
<ul>
 the raw DEK object
</ul>
<h3>hd</h3>
<ul>
 the session handle
</ul>
<h3>Description</h3>
<ul>
Try to extract the DEK from the public key encrypted packet. 
</ul>
<hr>


<a name="cdk_dek_new">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_dek_new</b>
(<i>cdk_dek_t *</i> <b>r_dek</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_dek_t *</i> <b>r_dek</b>
<dd> the new DEK object
</dl>
<h3>Description</h3>
<ul>
Create a new DEK object.
</ul>
<hr>


<a name="cdk_dek_set_cipher">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_dek_set_cipher</b>
(<i>cdk_dek_t</i> <b>dek</b>
, <i>int</i> <b>algo</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_dek_t</i> <b>dek</b>
<dd> the DEK object
<dt><i>int</i> <b>algo</b>
<dd> the cipher algorithm to use
</dl>
<h3>Description</h3>
<ul>
Set the cipher for the given DEK object.
</ul>
<hr>


<a name="cdk_dek_set_key">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_dek_set_key</b>
(<i>cdk_dek_t</i> <b>dek</b>
, <i>const byte *</i> <b>key</b>
, <i>size_t</i> <b>keylen</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_dek_t</i> <b>dek</b>
<dd> the DEK object
<dt><i>const byte *</i> <b>key</b>
<dd> the random session key
<dt><i>size_t</i> <b>keylen</b>
<dd> the length of the session key.
</dl>
<h3>Description</h3>
<ul>
Set the random session key for the given DEK object.
If @key and @keylen is NULL (0) a random key will be generated.
In any case, cdk_dek_set_cipher must be called first. 
</ul>
<hr>


<a name="cdk_dek_set_mdc_flag">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_dek_set_mdc_flag</b>
(<i>cdk_dek_t</i> <b>dek</b>
, <i>int</i> <b>val</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_dek_t</i> <b>dek</b>
<dd> the DEK object
<dt><i>int</i> <b>val</b>
<dd> value to enable or disable the use
</dl>
<h3>Description</h3>
<ul>
Enable or disable the MDC flag for the given DEK object.
</ul>
<hr>


<a name="cdk_dek_free">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_dek_free</b>
(<i>cdk_dek_t</i> <b>dek</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_dek_t</i> <b>dek</b>
<dd> the DEK object
</dl>
<h3>Description</h3>
<ul>
Release the DEK object.
</ul>
<hr>


<a name="cdk_dek_from_passphrase">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_dek_from_passphrase</b>
(<i>cdk_dek_t *</i> <b>ret_dek</b>
, <i>int</i> <b>cipher_algo</b>
, <i>cdk_s2k_t</i> <b>s2k</b>
, <i>int</i> <b>rndsalt</b>
, <i>const char *</i> <b>pw</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_dek_t *</i> <b>ret_dek</b>
<dd> the new DEK.
<dt><i>int</i> <b>cipher_algo</b>
<dd> symmetric key algorithm to use
<dt><i>cdk_s2k_t</i> <b>s2k</b>
<dd> the S2K to use
<dt><i>int</i> <b>rndsalt</b>
<dd> 1=create random salt
<dt><i>const char *</i> <b>pw</b>
<dd> the passphrase.
</dl>
<h3>Description</h3>
<ul>
Transform a passphrase into a DEK object.
</ul>
<hr>


<a name="cdk_s2k_new">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_s2k_new</b>
(<i>cdk_s2k_t *</i> <b>ret_s2k</b>
, <i>int</i> <b>mode</b>
, <i>int</i> <b>digest_algo</b>
, <i>const byte *</i> <b>salt</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_s2k_t *</i> <b>ret_s2k</b>
<dd> output for the new S2K object
<dt><i>int</i> <b>mode</b>
<dd> the S2K mode (simple, salted, iter+salted)
<dt><i>int</i> <b>digest_algo</b>
<dd> the hash algorithm
<dt><i>const byte *</i> <b>salt</b>
<dd> random salt
</dl>
<h3>Description</h3>
<ul>
Create a new S2K object with the given parameter.
The @salt parameter must be always 8 octets.
</ul>
<hr>


<a name="cdk_s2k_free">&nbsp</a><h2>Function</h2>
<i>void</i>
<b>cdk_s2k_free</b>
(<i>cdk_s2k_t</i> <b>s2k</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_s2k_t</i> <b>s2k</b>
<dd> the S2K object
</dl>
<h3>Description</h3>
<ul>
Release the given S2K object.
</ul>
<hr>


<a name="cdk_pk_check_sigs">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pk_check_sigs</b>
(<i>cdk_kbnode_t</i> <b>knode</b>
, <i>cdk_keydb_hd_t</i> <b>keydb</b>
, <i>int *</i> <b>r_status</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>knode</b>
<dd> the key node
<dt><i>cdk_keydb_hd_t</i> <b>keydb</b>
<dd><dt><i>int *</i> <b>r_status</b>
<dd> variable to store the status of the key
</dl>
<h3>Description</h3>
<ul>
Check all signatures. When no key is available for checking, the
sigstat is marked as 'NOKEY'. The @r_status contains the key flags
which are or-ed or zero when there are no flags.
</ul>
<hr>


<a name="cdk_pk_check_self_sig">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pk_check_self_sig</b>
(<i>cdk_kbnode_t</i> <b>knode</b>
, <i>int *</i> <b>r_status</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_kbnode_t</i> <b>knode</b>
<dd> the key node
<dt><i>int *</i> <b>r_status</b>
<dd> output the status of the key.
</dl>
<h3>Description</h3>
<ul>
A convenient function to make sure the key is valid.
Valid means the self signature is ok.
</ul>
<hr>


<a name="cdk_stream_sign">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_sign</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>cdk_stream_t</i> <b>inp</b>
, <i>cdk_stream_t</i> <b>out</b>
, <i>cdk_strlist_t</i> <b>locusr</b>
, <i>cdk_strlist_t</i> <b>remusr</b>
, <i>int</i> <b>encryptflag</b>
, <i>int</i> <b>sigmode</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> session handle
<dt><i>cdk_stream_t</i> <b>inp</b>
<dd> input stream
<dt><i>cdk_stream_t</i> <b>out</b>
<dd> output stream
<dt><i>cdk_strlist_t</i> <b>locusr</b>
<dd> local user list for signing
<dt><i>cdk_strlist_t</i> <b>remusr</b>
<dd><dt><i>int</i> <b>encryptflag</b>
<dd> shall the output be encrypted? (1/0)
<dt><i>int</i> <b>sigmode</b>
<dd> signature mode
</dl>
<h3>Description</h3>
<ul>
Sign the data from the STREAM @inp.
</ul>
<hr>


<a name="cdk_file_sign">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_file_sign</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>cdk_strlist_t</i> <b>locusr</b>
, <i>cdk_strlist_t</i> <b>remusr</b>
, <i>const char *</i> <b>file</b>
, <i>const char *</i> <b>output</b>
, <i>int</i> <b>sigmode</b>
, <i>int</i> <b>encryptflag</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd><dt><i>cdk_strlist_t</i> <b>locusr</b>
<dd> List of userid which should be used for signing
<dt><i>cdk_strlist_t</i> <b>remusr</b>
<dd> If encrypt is valid, the list of recipients
<dt><i>const char *</i> <b>file</b>
<dd> Name of the input file
<dt><i>const char *</i> <b>output</b>
<dd> Name of the output file
<dt><i>int</i> <b>sigmode</b>
<dd> Signature mode
<dt><i>int</i> <b>encryptflag</b>
<dd></dl>
<h3>Description</h3>
<ul>
Sign a file.
</ul>
<hr>


<a name="cdk_stream_open">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_open</b>
(<i>const char *</i> <b>file</b>
, <i>cdk_stream_t *</i> <b>ret_s</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const char *</i> <b>file</b>
<dd> The file to open
<dt><i>cdk_stream_t *</i> <b>ret_s</b>
<dd> The new STREAM object
</dl>
<h3>Description</h3>
<ul>
Create a new stream based on an existing file. The stream is
opened in read-only mode.
</ul>
<hr>


<a name="cdk_stream_new_from_cbs">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_new_from_cbs</b>
(<i>cdk_stream_cbs_t</i> <b>cbs</b>
, <i>void *</i> <b>opa</b>
, <i>cdk_stream_t *</i> <b>ret_s</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_cbs_t</i> <b>cbs</b>
<dd> the callback context with all user callback functions
<dt><i>void *</i> <b>opa</b>
<dd> opaque handle which is passed to all callbacks.
<dt><i>cdk_stream_t *</i> <b>ret_s</b>
<dd> the allocated stream
</dl>
<h3>Description</h3>
<ul>
This function creates a stream which uses user callback
for the core operations (open, close, read, write, seek).
</ul>
<hr>


<a name="cdk_stream_new">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_new</b>
(<i>const char *</i> <b>file</b>
, <i>cdk_stream_t *</i> <b>ret_s</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const char *</i> <b>file</b>
<dd> The name of the new file
<dt><i>cdk_stream_t *</i> <b>ret_s</b>
<dd> The new STREAM object
</dl>
<hr>


<a name="cdk_stream_create">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_create</b>
(<i>const char *</i> <b>file</b>
, <i>cdk_stream_t *</i> <b>ret_s</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const char *</i> <b>file</b>
<dd> the filename
<dt><i>cdk_stream_t *</i> <b>ret_s</b>
<dd> the object
</dl>
<h3>Description</h3>
<ul>
The difference to cdk_stream_new is, that no filtering can be used with
this kind of stream and everything is written directly to the stream.
</ul>
<hr>


<a name="cdk_stream_tmp_new">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_tmp_new</b>
(<i>cdk_stream_t *</i> <b>r_out</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t *</i> <b>r_out</b>
<dd> the new temp stream.
</dl>
<h3>Description</h3>
<ul>
Allocate a new tempory stream which is not associated with a file.
</ul>
<hr>


<a name="cdk_stream_tmp_from_mem">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_tmp_from_mem</b>
(<i>const void *</i> <b>buf</b>
, <i>size_t</i> <b>buflen</b>
, <i>cdk_stream_t *</i> <b>r_out</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const void *</i> <b>buf</b>
<dd> the buffer which shall be written to the temp stream.
<dt><i>size_t</i> <b>buflen</b>
<dd> how large the buffer is
<dt><i>cdk_stream_t *</i> <b>r_out</b>
<dd> the new stream with the given contents.
</dl>
<h3>Description</h3>
<ul>
Create a new tempory stream with the given contests.
</ul>
<hr>


<a name="cdk_stream_is_compressed">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_stream_is_compressed</b>
(<i>cdk_stream_t</i> <b>s</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> the stream
</dl>
<h3>Description</h3>
<ul>
Return 0 if the stream is uncompressed, otherwise the
compression algorithm.
</ul>
<hr>


<a name="cdk_stream_close">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_close</b>
(<i>cdk_stream_t</i> <b>s</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> The STREAM object.
</dl>
<h3>Description</h3>
<ul>
This function work different for read or write streams. When the
stream is for reading, the filtering is already done and we can
simply close the file and all buffers.
But for the case it's a write stream, we need to apply all registered
filters now. The file is closed in the filter function and not here.
</ul>
<hr>


<a name="cdk_stream_eof">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_stream_eof</b>
(<i>cdk_stream_t</i> <b>s</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> The STREAM object.
</dl>
<h3>Description</h3>
<ul>
This function will only work with read streams.
</ul>
<hr>


<a name="cdk_stream_get_length">&nbsp</a><h2>Function</h2>
<i>off_t</i>
<b>cdk_stream_get_length</b>
(<i>cdk_stream_t</i> <b>s</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> The STREAM object.
</dl>
<h3>Description</h3>
<ul>
This function should work for both read and write streams. For write
streams an additional flush is used to write possible pending data.
</ul>
<hr>


<a name="cdk_stream_filter_disable">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_filter_disable</b>
(<i>cdk_stream_t</i> <b>s</b>
, <i>int</i> <b>type</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> The STREAM object
<dt><i>int</i> <b>type</b>
<dd> The numberic filter ID.
</dl>
<hr>


<a name="cdk_stream_read">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_stream_read</b>
(<i>cdk_stream_t</i> <b>s</b>
, <i>void *</i> <b>buf</b>
, <i>size_t</i> <b>buflen</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> The STREAM object.
<dt><i>void *</i> <b>buf</b>
<dd> The buffer to insert the readed bytes.
<dt><i>size_t</i> <b>buflen</b>
<dd></dl>
<h3>Description</h3>
<ul>
When this function is called the first time, it can take a while
because all filters need to be processed. Please remember that you
need to add the filters in reserved order.
</ul>
<hr>


<a name="cdk_stream_write">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_stream_write</b>
(<i>cdk_stream_t</i> <b>s</b>
, <i>const void *</i> <b>buf</b>
, <i>size_t</i> <b>count</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> The STREAM object
<dt><i>const void *</i> <b>buf</b>
<dd> The buffer with the values to write.
<dt><i>size_t</i> <b>count</b>
<dd> The size of the buffer.
</dl>
<h3>Description</h3>
<ul>
In this function we simply write the bytes to the stream. We can't
use the filters here because it would mean they have to support
partial flushing.
</ul>
<hr>


<a name="cdk_stream_set_armor_flag">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_set_armor_flag</b>
(<i>cdk_stream_t</i> <b>s</b>
, <i>int</i> <b>armor_type</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> the stream object
<dt><i>int</i> <b>armor_type</b>
<dd></dl>
<h3>Description</h3>
<ul>
If the file is in read-mode, no armor type needs to be
defined (armor_type=0) because the armor filter will be
used for decoding existing armor data.
For the write mode, @armor_type can be set to any valid
armor type (message, key, sig).
</ul>
<hr>


<a name="cdk_stream_set_literal_flag">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_set_literal_flag</b>
(<i>cdk_stream_t</i> <b>s</b>
, <i>cdk_lit_format_t</i> <b>mode</b>
, <i>const char *</i> <b>fname</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> the stream object
<dt><i>cdk_lit_format_t</i> <b>mode</b>
<dd> the mode to use (binary, text, unicode)
<dt><i>const char *</i> <b>fname</b>
<dd> the file name to store in the packet.
</dl>
<h3>Description</h3>
<ul>
In read mode it kicks off the literal decoding routine to
unwrap the data from the packet. The @mode parameter is ignored.
In write mode the function can be used to wrap the stream data
into a literal packet with the given mode and file name.
</ul>
<hr>


<a name="cdk_stream_set_cipher_flag">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_set_cipher_flag</b>
(<i>cdk_stream_t</i> <b>s</b>
, <i>cdk_dek_t</i> <b>dek</b>
, <i>int</i> <b>use_mdc</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> the stream object
<dt><i>cdk_dek_t</i> <b>dek</b>
<dd> the data encryption key
<dt><i>int</i> <b>use_mdc</b>
<dd> 1 means to use the MDC mode
</dl>
<h3>Description</h3>
<ul>
In read mode it kicks off the cipher filter to decrypt the data
from the stream with the key given in @dek.
In write mode the stream data will be encrypted with the DEK object
and optionally, the @use_mdc parameter can be used to enable the MDC mode.
</ul>
<hr>


<a name="cdk_stream_set_compress_flag">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_set_compress_flag</b>
(<i>cdk_stream_t</i> <b>s</b>
, <i>int</i> <b>algo</b>
, <i>int</i> <b>level</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> the stream object
<dt><i>int</i> <b>algo</b>
<dd> the compression algo
<dt><i>int</i> <b>level</b>
<dd> level of compression (0..9)
</dl>
<h3>Description</h3>
<ul>
In read mode it kicks off the decompression filter to retrieve
the uncompressed data.
In write mode the stream data will be compressed with the
given algorithm at the given level.
</ul>
<hr>


<a name="cdk_stream_set_text_flag">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_set_text_flag</b>
(<i>cdk_stream_t</i> <b>s</b>
, <i>const char *</i> <b>lf</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> the stream object
<dt><i>const char *</i> <b>lf</b>
<dd> line ending
</dl>
<h3>Description</h3>
<ul>
Pushes the text filter to store the stream data in cannoncial format.
</ul>
<hr>


<a name="cdk_stream_set_hash_flag">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_set_hash_flag</b>
(<i>cdk_stream_t</i> <b>s</b>
, <i>int</i> <b>digest_algo</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> the stream object
<dt><i>int</i> <b>digest_algo</b>
<dd> the digest algorithm to use
</dl>
<h3>Description</h3>
<ul>
This is for read-only streams. It pushes a digest filter to
calculate the digest of the given stream data.
</ul>
<hr>


<a name="cdk_stream_enable_cache">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_enable_cache</b>
(<i>cdk_stream_t</i> <b>s</b>
, <i>int</i> <b>val</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> the stream object
<dt><i>int</i> <b>val</b>
<dd> 1=on, 0=off
</dl>
<h3>Description</h3>
<ul>
Enable or disable the cache section of a stream object.
</ul>
<hr>


<a name="cdk_stream_kick_off">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_kick_off</b>
(<i>cdk_stream_t</i> <b>inp</b>
, <i>cdk_stream_t</i> <b>out</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>inp</b>
<dd> the input stream
<dt><i>cdk_stream_t</i> <b>out</b>
<dd> the output stream.
</dl>
<h3>Description</h3>
<ul>
Passes the entire data from @inp into the output stream @out
with all the activated filters.
</ul>
<hr>


<a name="cdk_stream_mmap_part">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_mmap_part</b>
(<i>cdk_stream_t</i> <b>s</b>
, <i>off_t</i> <b>off</b>
, <i>size_t</i> <b>len</b>
, <i>byte **</i> <b>ret_buf</b>
, <i>size_t *</i> <b>ret_buflen</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>s</b>
<dd> the stream
<dt><i>off_t</i> <b>off</b>
<dd> the offset where to start
<dt><i>size_t</i> <b>len</b>
<dd> how much bytes shall be mapped
<dt><i>byte **</i> <b>ret_buf</b>
<dd> the buffer to store the content
<dt><i>size_t *</i> <b>ret_buflen</b>
<dd> length of the buffer
</dl>
<h3>Description</h3>
<ul>
Map the data of the given stream into a memory section. @ret_count
contains the length of the buffer.
</ul>
<hr>


<a name="cdk_stream_peek">&nbsp</a><h2>Function</h2>
<i>int</i>
<b>cdk_stream_peek</b>
(<i>cdk_stream_t</i> <b>inp</b>
, <i>byte *</i> <b>buf</b>
, <i>size_t</i> <b>buflen</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>inp</b>
<dd> the input stream handle
<dt><i>byte *</i> <b>buf</b>
<dd><dt><i>size_t</i> <b>buflen</b>
<dd></dl>
<h3>Description</h3>
<ul>
The function acts like cdk_stream_read with the difference that
the file pointer is moved to the old position after the bytes were read.
</ul>
<hr>


<a name="cdk_stream_sockopen">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_sockopen</b>
(<i>const char *</i> <b>host</b>
, <i>unsigned short</i> <b>port</b>
, <i>cdk_stream_t *</i> <b>ret_out</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>const char *</i> <b>host</b>
<dd> the host to connect to
<dt><i>unsigned short</i> <b>port</b>
<dd> the port to use
<dt><i>cdk_stream_t *</i> <b>ret_out</b>
<dd> contains the connect stream.
</dl>
<h3>Connect a stream to the given host</h3>
<ul>
port pair.
</ul>
<hr>


<a name="cdk_stream_verify">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_stream_verify</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>cdk_stream_t</i> <b>inp</b>
, <i>cdk_stream_t</i> <b>data</b>
, <i>cdk_stream_t</i> <b>out</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> session handle
<dt><i>cdk_stream_t</i> <b>inp</b>
<dd> the input stream
<dt><i>cdk_stream_t</i> <b>data</b>
<dd> for detached signatures, this is the data stream @inp is the sig
<dt><i>cdk_stream_t</i> <b>out</b>
<dd> where the output shall be written.
</dl>
<hr>


<a name="cdk_file_verify">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_file_verify</b>
(<i>cdk_ctx_t</i> <b>hd</b>
, <i>const char *</i> <b>file</b>
, <i>const char *</i> <b>data_file</b>
, <i>const char *</i> <b>output</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_ctx_t</i> <b>hd</b>
<dd> the session handle
<dt><i>const char *</i> <b>file</b>
<dd> the input file
<dt><i>const char *</i> <b>data_file</b>
<dd> for detached signature this is the data file and @file is the sig.
<dt><i>const char *</i> <b>output</b>
<dd> the output file
</dl>
<h3>Description</h3>
<ul>
Verify a signature.
</ul>
<hr>


<a name="cdk_pkt_write">&nbsp</a><h2>Function</h2>
<i>cdk_error_t</i>
<b>cdk_pkt_write</b>
(<i>cdk_stream_t</i> <b>out</b>
, <i>cdk_packet_t</i> <b>pkt</b>
)
<h3>Arguments</h3>
<dl>
<dt><i>cdk_stream_t</i> <b>out</b>
<dd> the output stream handle
<dt><i>cdk_packet_t</i> <b>pkt</b>
<dd> the packet itself
</dl>
<h3>Description</h3>
<ul>
Write the contents of @pkt into the @out stream.
Return 0 on success.
</ul>
<hr>