Function
int
cdk_file_armor
(CDK_HD hd
, const char * file
, const char * output
)
Arguments
- CDK_HD hd
- Handle
- const char * file
- Name of the file to protect.
- const char * output
- Output filename.
 Function
int
cdk_file_dearmor
(const char * file
, const char * output
)
Arguments
- const char * file
- Name of the file to unprotect.
- const char * output
- Output filename.
 Function
int
cdk_stream_encrypt
(CDK_HD hd
, CDK_STRLIST remusr
, CDK_STREAM inp
, CDK_STREAM out
)
Arguments
- CDK_HD hd
- Handle
- CDK_STRLIST remusr
- List of recipients
- CDK_STREAM inp
- Input stream handle
- CDK_STREAM out
- Output stream handle
Description
If remusr is NULL, then symmetric encryption is used. Via the
handle the caller can set or unset multiple options.
 Function
int
cdk_file_encrypt
(CDK_HD hd
, CDK_STRLIST remusr
, const char * file
, const char * output
)
Arguments
- CDK_HD hd
- Handle
- CDK_STRLIST remusr
- List of recipient
- const char * file
- Input file
- const char * output
- Output file
 Function
int
cdk_file_decrypt
(CDK_HD hd
, const char * file
, const char * output
)
Arguments
- CDK_HD hd
- Handle.
- const char * file
- Name of the file to decrypt.
- const char * output
- Output filename.
Description
When the operation was successfull, hd can contain information about
the signature (when present) and more.
 Function
int
cdk_keygen_set_prefs
(CDK_KEYGEN_CTX hd
, int type
, const byte * array
, size_t n
)
Arguments
- CDK_KEYGEN_CTX hd
- the preference type
- int type
- const byte * array
- one-octet array with algorithm numers
- size_t n
 Function
void
cdk_keygen_set_name
(CDK_KEYGEN_CTX hd
, const char * name
)
Arguments
- CDK_KEYGEN_CTX hd
- the keygen object
- const char * name
- name
Description
The name will be encoded in UTF8 to avoid problems.
 Function
int
cdk_keygen_set_algo_info
(CDK_KEYGEN_CTX hd
, int type
, int algo
, int bits
)
Arguments
- CDK_KEYGEN_CTX hd
- the keygen object.
- int type
- key type (primary=0, subkey=1)
- int algo
- algorithm compliant with rfc2440
- int bits
- lengt of the key in bits
 Function
void
cdk_keygen_set_mdc_feature
(CDK_KEYGEN_CTX hd
, int val
)
Arguments
- CDK_KEYGEN_CTX hd
- keygen object
- int val
- boolean( yes=1, no=0)
Description
if you want a RFC2440 compliant key, you've to disable this feature
until the rfc2440-bis6 becomes the next standard.
 Function
void
cdk_keygen_set_expire_date
(CDK_KEYGEN_CTX hd
, int type
, long timestamp
)
Arguments
- CDK_KEYGEN_CTX hd
- keygen object
- int type
- key type( 0=primary, 1=seconardy)
- long timestamp
- the date the key should expire
 Function
int
cdk_keygen_start
(CDK_KEYGEN_CTX hd
)
Arguments
- CDK_KEYGEN_CTX hd
- the keygen object
 Function
int
cdk_keygen_save
(CDK_KEYGEN_CTX hd
, const char * pub
, const char * sec
)
Arguments
- CDK_KEYGEN_CTX hd
- the keygen object
- const char * pub
- name of the file to store the public key
- const char * sec
- name of the file to store the secret key
 Function
void
cdk_keygen_free
(CDK_KEYGEN_CTX hd
)
Arguments
- CDK_KEYGEN_CTX hd
- the keygen object
 Function
int
cdk_keygen_new
(CDK_KEYGEN_CTX * r_hd
)
Arguments
- CDK_KEYGEN_CTX * r_hd
- the new object
 Function
int
cdk_keyserver_recv_key
(const char * host
, int port
, const byte * keyid
, int kid_type
, CDK_KBNODE * r_knode
)
Arguments
- const char * host
- URL or hostname of the keyserver
- int port
- The used port
- const byte * keyid
- KeyID of the key to retrieve
- int kid_type
- KeyID type( long, short, fingerprint)
- CDK_KBNODE * r_knode
- The key that was found wrapped in a KBNODE struct
 Function
const char *
cdk_strerror
(int ec
)
Arguments
- int ec
- the error number
 Function
void
cdk_set_malloc_hooks
(void * (*new_alloc_func
)
Arguments
- void * (*new_alloc_func
 Function
void
cdk_set_log_handler
(CDK_LOG_FNC logfnc
, void * opaque
)
Arguments
- CDK_LOG_FNC logfnc
- the function pointer
- void * opaque
- a private values for the function
 Function
void
cdk_set_log_level
(int lvl
)
Arguments
- int lvl
- the level
 Function
int
cdk_handle_new
(CDK_HD * r_ctx
)
Arguments
- CDK_HD * r_ctx
- context to store the handle
 Function
void
cdk_handle_set_keydb
(CDK_HD hd
, CDK_KEYDB_HD db
)
Arguments
- CDK_HD hd
- session handle
- CDK_KEYDB_HD db
- the database handle
Description
the function automatically detects whether this is a public or
secret keyring and the right handle is set.
 Function
void
cdk_handle_set_callback
(CDK_HD hd
, void (*cb
)
Arguments
- CDK_HD hd
- the handle
- void (*cb
 Function
void
cdk_handle_free
(CDK_HD hd
)
Arguments
- CDK_HD hd
- the handle
 Function
const char *
cdk_check_version
(const char * req_version
)
Arguments
- const char * req_version
- The requested version
Description
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.
 Function
int
cdk_file_sign
(CDK_HD hd
, CDK_STRLIST locusr
, CDK_STRLIST remusr
, const char * file
, const char * output
, int sigmode
, int encryptflag
)
Arguments
- CDK_HD hd
- CDK_STRLIST locusr
- List of userid which should be used for signing
- CDK_STRLIST remusr
- If encrypt is valid, the list of recipients
- const char * file
- Name of the input file
- const char * output
- Name of the output file
- int sigmode
- Signature mode
- int encryptflag
 Function
int
cdk_stream_open
(const char * file
, CDK_STREAM * ret_s
)
Arguments
- const char * file
- The file to open
- CDK_STREAM * ret_s
- The new STREAM object
 Function
int
cdk_stream_new
(const char * file
, CDK_STREAM * ret_s
)
Arguments
- const char * file
- The name of the new file
- CDK_STREAM * ret_s
- The new STREAM object
 Function
int
cdk_stream_create
(const char * file
, CDK_STREAM * ret_s
)
Arguments
- const char * file
- the filename
- CDK_STREAM * ret_s
- the object
Description
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.
 Function
int
cdk_stream_close
(CDK_STREAM s
)
Arguments
- CDK_STREAM s
- The STREAM object.
Description
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.
 Function
int
cdk_stream_eof
(CDK_STREAM s
)
Arguments
- CDK_STREAM s
- The STREAM object.
Description
This function will only work with read streams.
 Function
unsigned
cdk_stream_get_length
(CDK_STREAM s
)
Arguments
- CDK_STREAM s
- The STREAM object.
Description
This file only works for read stream because it's likely that the
write stream is not flushed or even no data was inserted.
 Function
int
cdk_stream_filter_disable
(CDK_STREAM s
, int type
)
Arguments
- CDK_STREAM s
- The STREAM object
- int type
- The numberic filter ID.
 Function
int
cdk_stream_read
(CDK_STREAM s
, void * buf
, size_t count
)
Arguments
- CDK_STREAM s
- The STREAM object.
- void * buf
- The buffer to insert the readed bytes.
- size_t count
- Request so much bytes.
Description
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.
 Function
int
cdk_stream_write
(CDK_STREAM s
, const void * buf
, size_t count
)
Arguments
- CDK_STREAM s
- The STREAM object
- const void * buf
- The buffer with the values to write.
- size_t count
- The size of the buffer.
Description
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.