opencdk

opencdk

Synopsis




#define             OPENCDK_VERSION
#define             OPENCDK_VERSION_MAJOR
#define             OPENCDK_VERSION_MINOR
#define             OPENCDK_VERSION_PATCH
struct              cdk_ctx_s;
typedef             cdk_ctx_t;
struct              cdk_strlist_s;
typedef             cdk_strlist_t;
struct              cdk_listkey_s;
typedef             cdk_listkey_t;
struct              cdk_dek_s;
typedef             cdk_dek_t;
struct              cdk_s2k_s;
typedef             cdk_s2k_t;
struct              cdk_stream_s;
typedef             cdk_stream_t;
struct              cdk_prefitem_s;
typedef             cdk_prefitem_t;
struct              cdk_kbnode_s;
typedef             cdk_kbnode_t;
struct              cdk_keydb_hd_s;
typedef             cdk_keydb_hd_t;
struct              cdk_keylist_s;
typedef             cdk_keylist_t;
struct              cdk_subpkt_s;
typedef             cdk_subpkt_t;
struct              cdk_keygen_ctx_s;
typedef             cdk_keygen_ctx_t;
struct              cdk_desig_revoker_s;
typedef             cdk_desig_revoker_t;
typedef             cdk_mpi_t;
enum                cdk_error_t;
enum                cdk_key_flags_t;
enum                cdk_lit_format_t;
enum                cdk_packet_type_t;
#define             MAX_CDK_PK_PARTS
#define             MAX_CDK_DATA_PARTS
typedef             cdk_pkt_signature_t;
typedef             cdk_pkt_userid_t;
typedef             cdk_pkt_pubkey_t;
typedef             cdk_pubkey_t;
typedef             cdk_pkt_seckey_t;
typedef             cdk_seckey_t;
typedef             cdk_pkt_onepass_sig_t;
typedef             cdk_pkt_pubkey_enc_t;
typedef             cdk_pkt_symkey_enc_t;
typedef             cdk_pkt_encrypted_t;
typedef             cdk_pkt_mdc_t;
typedef             cdk_pkt_literal_t;
typedef             cdk_pkt_compressed_t;
typedef             cdk_packet_t;
void                (*cdk_log_fnc_t)                    (void *,
                                                         ...,
                                                         const char *,
                                                         va_list );
void                cdk_set_log_level                   (int lvl);
void                cdk_set_log_handler                 (cdk_log_fnc_t logfnc,
                                                         void *opaque);
const char*         cdk_strerror                        (int ec);
void                cdk_set_malloc_hooks                (void* (new_alloc_funcsize_t n) (),
                                                         void* (new_alloc_secure_funcsize_t n) (),
                                                         void* (new_realloc_funcvoid *p, size_t n) (),
                                                         void* (new_calloc_funcsize_t m, size_t n) (),
                                                         void (new_free_funcvoid *) ());
int                 cdk_malloc_hook_initialized         (void);
void*               cdk_malloc                          (size_t size);
void*               cdk_calloc                          (size_t n,
                                                         size_t m);
void*               cdk_realloc                         (void *ptr,
                                                         size_t size);
void*               cdk_salloc                          (size_t size,
                                                         int clear);
char*               cdk_strdup                          (const char *ptr);
void                cdk_free                            (void *ptr);
void                cdk_lib_startup                     (void);
void                cdk_lib_shutdown                    (void);
cdk_error_t         cdk_handle_new                      (cdk_ctx_t *r_ctx);
void                cdk_handle_free                     (cdk_ctx_t c);
void                cdk_handle_set_keydb                (cdk_ctx_t hd,
                                                         cdk_keydb_hd_t db);
cdk_error_t         cdk_handle_set_keyring              (cdk_ctx_t hd,
                                                         int type,
                                                         const char *kringname);
cdk_keydb_hd_t      cdk_handle_get_keydb                (cdk_ctx_t hd,
                                                         int type);
int                 cdk_handle_control                  (cdk_ctx_t hd,
                                                         int action,
                                                         int cmd,
                                                         ...);
void                cdk_handle_set_passphrase_cb        (cdk_ctx_t hd,
                                                         char* (cbvoid *opa, const char *prompt) (),
                                                         void *cb_value);
#define             cdk_handle_set_armor                (a, val)
#define             cdk_handle_set_compress             (a, algo, level)
#define             cdk_handle_set_blockmode            (a, val)
#define             cdk_handle_set_cipher               (a, val)
#define             cdk_handle_set_digest               (a, val)
#define             cdk_handle_set_s2k                  (a, val1, val2)
typedef             cdk_verify_result_t;
cdk_verify_result_t cdk_handle_verify_get_result        (cdk_ctx_t hd);
cdk_error_t         cdk_pkt_new                         (cdk_packet_t *r_pkt);
cdk_error_t         cdk_pkt_alloc                       (cdk_packet_t *r_pkt,
                                                         int pkttype);
void                cdk_pkt_free                        (cdk_packet_t pkt);
void                cdk_pkt_release                     (cdk_packet_t pkt);
cdk_error_t         cdk_pkt_read                        (cdk_stream_t inp,
                                                         cdk_packet_t pkt);
cdk_error_t         cdk_pkt_write                       (cdk_stream_t out,
                                                         cdk_packet_t pkt);
cdk_subpkt_t        cdk_subpkt_new                      (size_t size);
void                cdk_subpkt_free                     (cdk_subpkt_t ctx);
cdk_subpkt_t        cdk_subpkt_find                     (cdk_subpkt_t ctx,
                                                         size_t type);
cdk_subpkt_t        cdk_subpkt_find_next                (cdk_subpkt_t root,
                                                         size_t type);
size_t              cdk_subpkt_type_count               (cdk_subpkt_t ctx,
                                                         size_t type);
cdk_subpkt_t        cdk_subpkt_find_nth                 (cdk_subpkt_t ctx,
                                                         size_t type,
                                                         size_t index);
cdk_error_t         cdk_subpkt_add                      (cdk_subpkt_t root,
                                                         cdk_subpkt_t node);
const unsigned char* cdk_subpkt_get_data                (cdk_subpkt_t ctx,
                                                         size_t *r_type,
                                                         size_t *r_nbytes);
void                cdk_subpkt_init                     (cdk_subpkt_t node,
                                                         size_t type,
                                                         const void *buf,
                                                         size_t buflen);
const unsigned char* cdk_key_desig_revoker_walk         (cdk_desig_revoker_t root,
                                                         cdk_desig_revoker_t *ctx,
                                                         int *r_class,
                                                         int *r_algid);
#define             is_RSA                              (a)
#define             is_ELG                              (a)
#define             is_DSA                              (a)
cdk_error_t         cdk_pk_encrypt                      (cdk_pubkey_t pk,
                                                         cdk_pkt_pubkey_enc_t pke,
                                                         gcry_mpi_t sk);
cdk_error_t         cdk_pk_decrypt                      (cdk_seckey_t sk,
                                                         cdk_pkt_pubkey_enc_t pke,
                                                         gcry_mpi_t *r_sk);
cdk_error_t         cdk_pk_sign                         (cdk_seckey_t sk,
                                                         cdk_pkt_signature_t sig,
                                                         unsigned char *md);
cdk_error_t         cdk_pk_verify                       (cdk_pubkey_t pk,
                                                         cdk_pkt_signature_t sig,
                                                         unsigned char *md);
cdk_error_t         cdk_pk_get_mpi                      (cdk_pubkey_t pk,
                                                         size_t idx,
                                                         unsigned char *buf,
                                                         size_t buflen,
                                                         size_t *r_nwritten,
                                                         size_t *r_nbits);
cdk_error_t         cdk_sk_get_mpi                      (cdk_seckey_t sk,
                                                         size_t idx,
                                                         unsigned char *buf,
                                                         size_t buflen,
                                                         size_t *r_nwritten,
                                                         size_t *r_nbits);
int                 cdk_pk_get_nbits                    (cdk_pubkey_t pk);
int                 cdk_pk_get_npkey                    (int algo);
int                 cdk_pk_get_nskey                    (int algo);
int                 cdk_pk_get_nsig                     (int algo);
int                 cdk_pk_get_nenc                     (int algo);
cdk_error_t         cdk_pk_get_fingerprint              (cdk_pubkey_t pk,
                                                         unsigned char *fpr);
cdk_error_t         cdk_pk_to_fingerprint               (cdk_pubkey_t pk,
                                                         unsigned char *fpr,
                                                         size_t fprlen,
                                                         size_t *r_nout);
unsigned int        cdk_pk_fingerprint_get_keyid        (unsigned char *fpr,
                                                         size_t fprlen,
                                                         unsigned int *keyid);
unsigned int        cdk_pk_get_keyid                    (cdk_pubkey_t pk,
                                                         unsigned int *keyid);
unsigned int        cdk_sk_get_keyid                    (cdk_seckey_t sk,
                                                         unsigned int *keyid);
unsigned int        cdk_sig_get_keyid                   (cdk_pkt_signature_t sig,
                                                         unsigned int *keyid);
void                cdk_pk_release                      (cdk_pubkey_t pk);
void                cdk_sk_release                      (cdk_seckey_t sk);
cdk_error_t         cdk_sk_unprotect                    (cdk_seckey_t sk,
                                                         const char *pw);
cdk_error_t         cdk_sk_protect                      (cdk_seckey_t sk,
                                                         const char *pw);
cdk_error_t         cdk_pk_from_secret_key              (cdk_seckey_t sk,
                                                         cdk_pubkey_t *ret_pk);
cdk_error_t         cdk_pubkey_to_sexp                  (cdk_pubkey_t pk,
                                                         char **sexp,
                                                         size_t *len);
cdk_error_t         cdk_seckey_to_sexp                  (cdk_seckey_t sk,
                                                         char **sexp,
                                                         size_t *len);
cdk_error_t         cdk_dek_new                         (cdk_dek_t *r_dek);
void                cdk_dek_free                        (cdk_dek_t dek);
cdk_error_t         cdk_dek_set_cipher                  (cdk_dek_t dek,
                                                         int cipher_algo);
cdk_error_t         cdk_dek_get_cipher                  (cdk_dek_t dek,
                                                         int *r_cipher_algo);
cdk_error_t         cdk_dek_set_key                     (cdk_dek_t dek,
                                                         unsigned char *key,
                                                         size_t keylen);
void                cdk_dek_set_mdc_flag                (cdk_dek_t dek,
                                                         int val);
int                 cdk_dek_get_mdc_flag                (cdk_dek_t dek);
cdk_error_t         cdk_dek_from_passphrase             (cdk_dek_t *ret_dek,
                                                         int cipher_algo,
                                                         cdk_s2k_t s2k,
                                                         int rndsalt,
                                                         const char *passphrase);
cdk_error_t         cdk_s2k_new                         (cdk_s2k_t *ret_s2k,
                                                         int mode,
                                                         int digest_algo,
                                                         unsigned char *salt);
void                cdk_s2k_free                        (cdk_s2k_t s2k);
cdk_error_t         cdk_file_armor                      (cdk_ctx_t hd,
                                                         const char *file,
                                                         const char *output);
cdk_error_t         cdk_file_dearmor                    (const char *file,
                                                         const char *output);
int                 cdk_armor_filter_use                (cdk_stream_t inp);
cdk_error_t         cdk_armor_encode_buffer             (unsigned char *inbuf,
                                                         size_t inlen,
                                                         char *outbuf,
                                                         size_t outlen,
                                                         size_t *nwritten,
                                                         int type);
cdk_error_t         open                                (void *);
cdk_error_t         release                             (void *);
int                 read                                (void *,
                                                         void *buf,
                                                         size_t );
int                 write                               (void *,
                                                         const void *buf,
                                                         size_t );
int                 seek                                (void *,
                                                         off_t );
typedef             cdk_stream_cbs_t;
int                 cdk_stream_is_compressed            (cdk_stream_t s);
cdk_error_t         cdk_stream_sockopen                 (const char *host,
                                                         unsigned short  port,
                                                         cdk_stream_t *ret_out);
cdk_error_t         cdk_stream_open                     (const char *file,
                                                         cdk_stream_t *ret_s);
cdk_error_t         cdk_stream_new                      (const char *file,
                                                         cdk_stream_t *ret_s);
cdk_error_t         cdk_stream_new_from_cbs             (cdk_stream_cbs_t cbs,
                                                         void *opa,
                                                         cdk_stream_t *ret_s);
cdk_error_t         cdk_stream_create                   (const char *file,
                                                         cdk_stream_t *ret_s);
cdk_error_t         cdk_stream_tmp_new                  (cdk_stream_t *r_out);
cdk_error_t         cdk_stream_tmp_from_mem             (const void *buf,
                                                         size_t buflen,
                                                         cdk_stream_t *r_out);
void                cdk_stream_tmp_set_mode             (cdk_stream_t s,
                                                         int val);
cdk_error_t         cdk_stream_flush                    (cdk_stream_t s);
cdk_error_t         cdk_stream_enable_cache             (cdk_stream_t s,
                                                         int val);
cdk_error_t         cdk_stream_filter_disable           (cdk_stream_t s,
                                                         int type);
cdk_error_t         cdk_stream_close                    (cdk_stream_t s);
off_t               cdk_stream_get_length               (cdk_stream_t s);
int                 cdk_stream_read                     (cdk_stream_t s,
                                                         void *buf,
                                                         size_t count);
int                 cdk_stream_write                    (cdk_stream_t s,
                                                         const void *buf,
                                                         size_t count);
int                 cdk_stream_putc                     (cdk_stream_t s,
                                                         int c);
int                 cdk_stream_getc                     (cdk_stream_t s);
int                 cdk_stream_eof                      (cdk_stream_t s);
off_t               cdk_stream_tell                     (cdk_stream_t s);
cdk_error_t         cdk_stream_seek                     (cdk_stream_t s,
                                                         off_t offset);
cdk_error_t         cdk_stream_set_armor_flag           (cdk_stream_t s,
                                                         int type);
cdk_error_t         cdk_stream_set_literal_flag         (cdk_stream_t s,
                                                         cdk_lit_format_t mode,
                                                         const char *fname);
cdk_error_t         cdk_stream_set_cipher_flag          (cdk_stream_t s,
                                                         cdk_dek_t dek,
                                                         int use_mdc);
cdk_error_t         cdk_stream_set_compress_flag        (cdk_stream_t s,
                                                         int algo,
                                                         int level);
cdk_error_t         cdk_stream_set_hash_flag            (cdk_stream_t s,
                                                         int algo);
cdk_error_t         cdk_stream_set_text_flag            (cdk_stream_t s,
                                                         const char *lf);
cdk_error_t         cdk_stream_kick_off                 (cdk_stream_t inp,
                                                         cdk_stream_t out);
cdk_error_t         cdk_stream_mmap                     (cdk_stream_t s,
                                                         unsigned char **ret_buf,
                                                         size_t *ret_buflen);
cdk_error_t         cdk_stream_mmap_part                (cdk_stream_t s,
                                                         off_t off,
                                                         size_t len,
                                                         unsigned char **ret_buf,
                                                         size_t *ret_buflen);
int                 cdk_stream_peek                     (cdk_stream_t inp,
                                                         unsigned char *buf,
                                                         size_t buflen);
cdk_error_t         cdk_keydb_new                       (cdk_keydb_hd_t *r_hd,
                                                         int type,
                                                         void *data,
                                                         size_t count);
cdk_error_t         cdk_keydb_new_from_mem              (cdk_keydb_hd_t *r_hd,
                                                         int secret,
                                                         const void *data,
                                                         size_t datlen);
cdk_error_t         cdk_keydb_new_from_file             (cdk_keydb_hd_t *r_hd,
                                                         int secret,
                                                         const char *fname);
cdk_error_t         cdk_keydb_new_from_stream           (cdk_keydb_hd_t *r_hd,
                                                         int secret,
                                                         cdk_stream_t in);
cdk_error_t         cdk_keydb_check_sk                  (cdk_keydb_hd_t hd,
                                                         unsigned int *keyid);
cdk_error_t         cdk_keydb_search_start              (cdk_keydb_hd_t hd,
                                                         int type,
                                                         void *desc);
cdk_error_t         cdk_keydb_search                    (cdk_keydb_hd_t hd,
                                                         cdk_kbnode_t *ret_key);
void                cdk_keydb_free                      (cdk_keydb_hd_t hd);
cdk_error_t         cdk_keydb_get_bykeyid               (cdk_keydb_hd_t hd,
                                                         unsigned int *keyid,
                                                         cdk_kbnode_t *ret_pk);
cdk_error_t         cdk_keydb_get_byfpr                 (cdk_keydb_hd_t hd,
                                                         unsigned char *fpr,
                                                         cdk_kbnode_t *ret_pk);
cdk_error_t         cdk_keydb_get_bypattern             (cdk_keydb_hd_t hd,
                                                         const char *patt,
                                                         cdk_kbnode_t *ret_pk);
cdk_error_t         cdk_keydb_get_pk                    (cdk_keydb_hd_t khd,
                                                         unsigned int *keyid,
                                                         cdk_pubkey_t *ret_pk);
cdk_error_t         cdk_keydb_get_sk                    (cdk_keydb_hd_t khd,
                                                         unsigned int *keyid,
                                                         cdk_seckey_t *ret_sk);
cdk_error_t         cdk_keydb_get_keyblock              (cdk_stream_t inp,
                                                         cdk_kbnode_t *ret_key);
cdk_error_t         cdk_keydb_idx_rebuild               (cdk_keydb_hd_t hd);
cdk_error_t         cdk_keydb_export                    (cdk_keydb_hd_t hd,
                                                         cdk_stream_t out,
                                                         cdk_strlist_t remusr);
cdk_error_t         cdk_keydb_import                    (cdk_keydb_hd_t hd,
                                                         cdk_kbnode_t knode);
cdk_error_t         cdk_listkey_start                   (cdk_listkey_t *r_ctx,
                                                         cdk_keydb_hd_t db,
                                                         const char *patt,
                                                         cdk_strlist_t fpatt);
void                cdk_listkey_close                   (cdk_listkey_t ctx);
cdk_error_t         cdk_listkey_next                    (cdk_listkey_t ctx,
                                                         cdk_kbnode_t *ret_key);
cdk_kbnode_t        cdk_kbnode_new                      (cdk_packet_t pkt);
cdk_error_t         cdk_kbnode_read_from_mem            (cdk_kbnode_t *ret_node,
                                                         unsigned char *buf,
                                                         size_t buflen);
cdk_error_t         cdk_kbnode_write_to_mem             (cdk_kbnode_t node,
                                                         unsigned char *buf,
                                                         size_t *r_nbytes);
cdk_error_t         cdk_kbnode_write_to_mem_alloc       (cdk_kbnode_t node,
                                                         unsigned char **r_buf,
                                                         size_t *r_buflen);
void                cdk_kbnode_release                  (cdk_kbnode_t node);
cdk_kbnode_t        cdk_kbnode_walk                     (cdk_kbnode_t root,
                                                         cdk_kbnode_t *ctx,
                                                         int all);
cdk_packet_t        cdk_kbnode_find_packet              (cdk_kbnode_t node,
                                                         int pkttype);
cdk_packet_t        cdk_kbnode_get_packet               (cdk_kbnode_t node);
cdk_kbnode_t        cdk_kbnode_find                     (cdk_kbnode_t node,
                                                         int pkttype);
cdk_kbnode_t        cdk_kbnode_find_prev                (cdk_kbnode_t root,
                                                         cdk_kbnode_t node,
                                                         int pkttype);
cdk_kbnode_t        cdk_kbnode_find_next                (cdk_kbnode_t node,
                                                         int pkttype);
cdk_error_t         cdk_kbnode_hash                     (cdk_kbnode_t node,
                                                         gcry_md_hd_t md,
                                                         int is_v4,
                                                         int pkttype,
                                                         int flags);
cdk_error_t         cdk_pk_check_sigs                   (cdk_kbnode_t knode,
                                                         cdk_keydb_hd_t hd,
                                                         int *r_status);
cdk_error_t         cdk_pk_check_self_sig               (cdk_kbnode_t knode,
                                                         int *r_status);
int                 cdk_pklist_select_algo              (cdk_keylist_t pkl,
                                                         int preftype);
int                 cdk_pklist_use_mdc                  (cdk_keylist_t pkl);
cdk_error_t         cdk_pklist_build                    (cdk_keylist_t *ret_pkl,
                                                         cdk_keydb_hd_t hd,
                                                         cdk_strlist_t remusr,
                                                         int use);
void                cdk_pklist_release                  (cdk_keylist_t pkl);
cdk_error_t         cdk_pklist_encrypt                  (cdk_keylist_t pkl,
                                                         cdk_dek_t dek,
                                                         cdk_stream_t out);
cdk_error_t         cdk_sklist_build                    (cdk_keylist_t *ret_skl,
                                                         cdk_keydb_hd_t db,
                                                         cdk_ctx_t hd,
                                                         cdk_strlist_t locusr,
                                                         int unlock,
                                                         unsigned int use);
void                cdk_sklist_release                  (cdk_keylist_t skl);
cdk_error_t         cdk_sklist_write                    (cdk_keylist_t skl,
                                                         cdk_stream_t outp,
                                                         gcry_md_hd_t mdctx,
                                                         int sigclass,
                                                         int sigver);
cdk_error_t         cdk_sklist_write_onepass            (cdk_keylist_t skl,
                                                         cdk_stream_t outp,
                                                         int sigclass,
                                                         int mdalgo);
cdk_error_t         cdk_stream_encrypt                  (cdk_ctx_t hd,
                                                         cdk_strlist_t remusr,
                                                         cdk_stream_t inp,
                                                         cdk_stream_t out);
cdk_error_t         cdk_stream_decrypt                  (cdk_ctx_t hd,
                                                         cdk_stream_t inp,
                                                         cdk_stream_t out);
cdk_error_t         cdk_file_encrypt                    (cdk_ctx_t hd,
                                                         cdk_strlist_t remusr,
                                                         const char *file,
                                                         const char *output);
cdk_error_t         cdk_file_decrypt                    (cdk_ctx_t hd,
                                                         const char *file,
                                                         const char *output);
cdk_error_t         cdk_data_transform                  (cdk_ctx_t hd,
                                                         enum cdk_crypto_mode_t mode,
                                                         cdk_strlist_t locusr,
                                                         cdk_strlist_t remusr,
                                                         const void *inbuf,
                                                         size_t insize,
                                                         unsigned char **outbuf,
                                                         size_t *outsize,
                                                         int modval);
cdk_error_t         cdk_stream_sign                     (cdk_ctx_t hd,
                                                         cdk_stream_t inp,
                                                         cdk_stream_t out,
                                                         cdk_strlist_t locusr,
                                                         cdk_strlist_t remusr,
                                                         int encryptflag,
                                                         int sigmode);
cdk_error_t         cdk_file_sign                       (cdk_ctx_t hd,
                                                         cdk_strlist_t locusr,
                                                         cdk_strlist_t remusr,
                                                         const char *file,
                                                         const char *output,
                                                         int sigmode,
                                                         int encryptflag);
cdk_error_t         cdk_stream_verify                   (cdk_ctx_t hd,
                                                         cdk_stream_t inp,
                                                         cdk_stream_t data,
                                                         cdk_stream_t out);
cdk_error_t         cdk_file_verify                     (cdk_ctx_t hd,
                                                         const char *file,
                                                         const char *data_file,
                                                         const char *output);
int                 cdk_trustdb_get_validity            (cdk_stream_t inp,
                                                         cdk_pkt_userid_t id,
                                                         int *r_val);
int                 cdk_trustdb_get_ownertrust          (cdk_stream_t inp,
                                                         cdk_pubkey_t pk,
                                                         int *r_val,
                                                         int *r_flags);
void                cdk_strlist_free                    (cdk_strlist_t sl);
cdk_strlist_t       cdk_strlist_add                     (cdk_strlist_t *list,
                                                         const char *string);
cdk_strlist_t       cdk_strlist_next                    (cdk_strlist_t root,
                                                         const char **r_str);
const char*         cdk_check_version                   (const char *req_version);
char*               cdk_utf8_encode                     (const char *string);
char*               cdk_utf8_decode                     (const char *string,
                                                         size_t length,
                                                         int delim);
cdk_error_t         cdk_keyserver_recv_key              (const char *host,
                                                         int port,
                                                         unsigned char *keyid,
                                                         int kid_type,
                                                         cdk_kbnode_t *r_key);
cdk_error_t         cdk_keygen_new                      (cdk_keygen_ctx_t *r_hd);
void                cdk_keygen_free                     (cdk_keygen_ctx_t hd);
cdk_error_t         cdk_keygen_set_prefs                (cdk_keygen_ctx_t hd,
                                                         enum cdk_pref_type_t type,
                                                         unsigned char *array,
                                                         size_t n);
cdk_error_t         cdk_keygen_set_algo_info            (cdk_keygen_ctx_t hd,
                                                         int type,
                                                         int usage,
                                                         enum cdk_pubkey_algo_t algo,
                                                         unsigned int bits);
int                 cdk_keygen_set_keyserver_flags      (cdk_keygen_ctx_t hd,
                                                         int no_modify,
                                                         const char *pref_url);
int                 cdk_keygen_set_expire_date          (cdk_keygen_ctx_t hd,
                                                         int type,
                                                         long timestamp );
void                cdk_keygen_set_name                 (cdk_keygen_ctx_t hd,
                                                         const char *name);
void                cdk_keygen_set_passphrase           (cdk_keygen_ctx_t hd,
                                                         const char *pass);
cdk_error_t         cdk_keygen_start                    (cdk_keygen_ctx_t hd);
cdk_error_t         cdk_keygen_save                     (cdk_keygen_ctx_t hd,
                                                         const char *pubf,
                                                         const char *secf);

Description

Details

OPENCDK_VERSION

#define OPENCDK_VERSION "0.6.4"


OPENCDK_VERSION_MAJOR

#define OPENCDK_VERSION_MAJOR 0


OPENCDK_VERSION_MINOR

#define OPENCDK_VERSION_MINOR 6


OPENCDK_VERSION_PATCH

#define OPENCDK_VERSION_PATCH 4


struct cdk_ctx_s

struct cdk_ctx_s;


cdk_ctx_t

typedef struct cdk_ctx_s *cdk_ctx_t;


struct cdk_strlist_s

struct cdk_strlist_s;


cdk_strlist_t

typedef struct cdk_strlist_s *cdk_strlist_t;


struct cdk_listkey_s

struct cdk_listkey_s;


cdk_listkey_t

typedef struct cdk_listkey_s *cdk_listkey_t;


struct cdk_dek_s

struct cdk_dek_s;


cdk_dek_t

typedef struct cdk_dek_s *cdk_dek_t;


struct cdk_s2k_s

struct cdk_s2k_s;


cdk_s2k_t

typedef struct cdk_s2k_s *cdk_s2k_t;


struct cdk_stream_s

struct cdk_stream_s;


cdk_stream_t

typedef struct cdk_stream_s *cdk_stream_t;


struct cdk_prefitem_s

struct cdk_prefitem_s;


cdk_prefitem_t

typedef struct cdk_prefitem_s *cdk_prefitem_t;


struct cdk_kbnode_s

struct cdk_kbnode_s;


cdk_kbnode_t

typedef struct cdk_kbnode_s *cdk_kbnode_t;


struct cdk_keydb_hd_s

struct cdk_keydb_hd_s;


cdk_keydb_hd_t

typedef struct cdk_keydb_hd_s *cdk_keydb_hd_t;


struct cdk_keylist_s

struct cdk_keylist_s;


cdk_keylist_t

typedef struct cdk_keylist_s *cdk_keylist_t;


struct cdk_subpkt_s

struct cdk_subpkt_s;


cdk_subpkt_t

typedef struct cdk_subpkt_s *cdk_subpkt_t;


struct cdk_keygen_ctx_s

struct cdk_keygen_ctx_s;


cdk_keygen_ctx_t

typedef struct cdk_keygen_ctx_s *cdk_keygen_ctx_t;


struct cdk_desig_revoker_s

struct cdk_desig_revoker_s;


cdk_desig_revoker_t

typedef struct cdk_desig_revoker_s *cdk_desig_revoker_t;


cdk_mpi_t

typedef gcry_mpi_t cdk_mpi_t;


enum cdk_error_t

typedef enum {
    CDK_EOF = -1,
    CDK_Success = 0,
    CDK_General_Error = 1,
    CDK_File_Error = 2,
    CDK_Bad_Sig = 3,
    CDK_Inv_Packet = 4,
    CDK_Inv_Algo = 5,
    CDK_Not_Implemented = 6,
    CDK_Armor_Error = 8,
    CDK_Armor_CRC_Error = 9,
    CDK_MPI_Error = 10,
    CDK_Inv_Value = 11,
    CDK_Error_No_Key = 12,
    CDK_Chksum_Error = 13,
    CDK_Time_Conflict = 14,
    CDK_Zlib_Error = 15,
    CDK_Weak_Key = 16,
    CDK_Out_Of_Core = 17,
    CDK_Wrong_Seckey = 18,
    CDK_Bad_MDC = 19,
    CDK_Inv_Mode = 20,
    CDK_Error_No_Keyring = 21,
    CDK_Wrong_Format = 22,
    CDK_Inv_Packet_Ver = 23,
    CDK_Too_Short = 24,
    CDK_Unusable_Key = 25,
    CDK_No_Data = 26,
    CDK_No_Passphrase = 27,
    CDK_Network_Error = 28
} cdk_error_t;


enum cdk_key_flags_t

typedef enum {
    CDK_FLAG_KEY_REVOKED = 256,
    CDK_FLAG_KEY_EXPIRED = 512,
    CDK_FLAG_SIG_EXPIRED = 1024
} cdk_key_flags_t;


enum cdk_lit_format_t

typedef enum {
  CDK_LITFMT_BINARY = 0,
  CDK_LITFMT_TEXT   = 1,
  CDK_LITFMT_UNICODE= 2
} cdk_lit_format_t;	


enum cdk_packet_type_t

typedef enum {
    CDK_PKT_RESERVED      =  0,
    CDK_PKT_PUBKEY_ENC    =  1,
    CDK_PKT_SIGNATURE     =  2,
    CDK_PKT_SYMKEY_ENC    =  3,
    CDK_PKT_ONEPASS_SIG   =  4,
    CDK_PKT_SECRET_KEY    =  5,
    CDK_PKT_PUBLIC_KEY    =  6,
    CDK_PKT_SECRET_SUBKEY =  7,
    CDK_PKT_COMPRESSED    =  8,
    CDK_PKT_ENCRYPTED     =  9,
    CDK_PKT_MARKER        = 10,
    CDK_PKT_LITERAL       = 11,
    CDK_PKT_RING_TRUST    = 12,
    CDK_PKT_USER_ID       = 13,
    CDK_PKT_PUBLIC_SUBKEY = 14,
    CDK_PKT_OLD_COMMENT   = 16,
    CDK_PKT_ATTRIBUTE     = 17,
    CDK_PKT_ENCRYPTED_MDC = 18,
    CDK_PKT_MDC           = 19
} cdk_packet_type_t;


MAX_CDK_PK_PARTS

#define MAX_CDK_PK_PARTS 4


MAX_CDK_DATA_PARTS

#define MAX_CDK_DATA_PARTS 2


cdk_pkt_signature_t

typedef struct cdk_pkt_signature_s *cdk_pkt_signature_t;


cdk_pkt_userid_t

typedef struct cdk_pkt_userid_s *cdk_pkt_userid_t;


cdk_pkt_pubkey_t

typedef struct cdk_pkt_pubkey_s *cdk_pkt_pubkey_t;


cdk_pubkey_t

typedef cdk_pkt_pubkey_t cdk_pubkey_t;


cdk_pkt_seckey_t

typedef struct cdk_pkt_seckey_s *cdk_pkt_seckey_t;


cdk_seckey_t

typedef cdk_pkt_seckey_t cdk_seckey_t;


cdk_pkt_onepass_sig_t

typedef struct cdk_pkt_onepass_sig_s * cdk_pkt_onepass_sig_t;


cdk_pkt_pubkey_enc_t

typedef struct cdk_pkt_pubkey_enc_s * cdk_pkt_pubkey_enc_t;


cdk_pkt_symkey_enc_t

typedef struct cdk_pkt_symkey_enc_s *cdk_pkt_symkey_enc_t;


cdk_pkt_encrypted_t

typedef struct cdk_pkt_encrypted_s *cdk_pkt_encrypted_t;


cdk_pkt_mdc_t

typedef struct cdk_pkt_mdc_s *cdk_pkt_mdc_t;


cdk_pkt_literal_t

typedef struct cdk_pkt_literal_s *cdk_pkt_literal_t;


cdk_pkt_compressed_t

typedef struct cdk_pkt_compressed_s *cdk_pkt_compressed_t;


cdk_packet_t

typedef struct cdk_packet_s *cdk_packet_t;


cdk_log_fnc_t ()

void                (*cdk_log_fnc_t)                    (void *,
                                                         ...,
                                                         const char *,
                                                         va_list );

Param1 :

... :

Param3 :

Param4 :


cdk_set_log_level ()

void                cdk_set_log_level                   (int lvl);

Set the verbosity level.

lvl :

the level

cdk_set_log_handler ()

void                cdk_set_log_handler                 (cdk_log_fnc_t logfnc,
                                                         void *opaque);

Set a custom handler for logging.

logfnc :

the function pointer

opaque :

a private values for the function

cdk_strerror ()

const char*         cdk_strerror                        (int ec);

Return an error text for the given id.

ec :

the error number

Returns :


cdk_set_malloc_hooks ()

void                cdk_set_malloc_hooks                (void* (new_alloc_funcsize_t n) (),
                                                         void* (new_alloc_secure_funcsize_t n) (),
                                                         void* (new_realloc_funcvoid *p, size_t n) (),
                                                         void* (new_calloc_funcsize_t m, size_t n) (),
                                                         void (new_free_funcvoid *) ());

Set private memory hooks for the library.

new_alloc_func :

malloc replacement

new_alloc_secure_func :

secure malloc replacement

new_realloc_func :

realloc replacement

new_calloc_func :

calloc replacement

new_free_func :

free replacement

cdk_malloc_hook_initialized ()

int                 cdk_malloc_hook_initialized         (void);

Return if the malloc hooks are already initialized.

Returns :


cdk_malloc ()

void*               cdk_malloc                          (size_t size);

size :

Returns :


cdk_calloc ()

void*               cdk_calloc                          (size_t n,
                                                         size_t m);

Safe wrapper around the c-function calloc.

n :

amount of elements

m :

size of one element

Returns :


cdk_realloc ()

void*               cdk_realloc                         (void *ptr,
                                                         size_t size);

ptr :

size :

Returns :


cdk_salloc ()

void*               cdk_salloc                          (size_t size,
                                                         int clear);

Allocated the requested amount of bytes in 'secure' memory.

size :

how much bytes should be allocated.

clear :

shall the buffer cleared after the allocation?

Returns :


cdk_strdup ()

char*               cdk_strdup                          (const char *ptr);

ptr :

Returns :


cdk_free ()

void                cdk_free                            (void *ptr);

ptr :


cdk_lib_startup ()

void                cdk_lib_startup                     (void);

Prepare the internal structures of the library. This function should be called before any other CDK function.


cdk_lib_shutdown ()

void                cdk_lib_shutdown                    (void);

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.


cdk_handle_new ()

cdk_error_t         cdk_handle_new                      (cdk_ctx_t *r_ctx);

create a new session handle.

r_ctx :

context to store the handle

Returns :


cdk_handle_free ()

void                cdk_handle_free                     (cdk_ctx_t c);

Release the main handle.

c :


cdk_handle_set_keydb ()

void                cdk_handle_set_keydb                (cdk_ctx_t hd,
                                                         cdk_keydb_hd_t db);

set the key database handle. the function automatically detects whether this is a public or secret keyring and the right handle is set.

hd :

session handle

db :

the database handle

cdk_handle_set_keyring ()

cdk_error_t         cdk_handle_set_keyring              (cdk_ctx_t hd,
                                                         int type,
                                                         const char *kringname);

Convenient function to set the keyring for the current session.

hd :

session handle

type :

public=0 or secret=1 keyring type

kringname :

file name of the keyring which shall be used.

Returns :


cdk_handle_get_keydb ()

cdk_keydb_hd_t      cdk_handle_get_keydb                (cdk_ctx_t hd,
                                                         int type);

Return the keydb handle from the session handle. The caller should not free these handles.

hd :

session handle

type :

type of the keyring

Returns :


cdk_handle_control ()

int                 cdk_handle_control                  (cdk_ctx_t hd,
                                                         int action,
                                                         int cmd,
                                                         ...);

Perform various control operations for the current session.

hd :

session handle

action :

flag which indicates whether put or get is requested

cmd :

command id

... :

Returns :


cdk_handle_set_passphrase_cb ()

void                cdk_handle_set_passphrase_cb        (cdk_ctx_t hd,
                                                         char* (cbvoid *opa, const char *prompt) (),
                                                         void *cb_value);

set the passphrase callback.

hd :

session handle

cb :

callback function

cb_value :

the opaque value for the cb function

cdk_handle_set_armor()

#define             cdk_handle_set_armor(a, val)

a :

val :


cdk_handle_set_compress()

#define             cdk_handle_set_compress(a, algo, level)

a :

algo :

level :


cdk_handle_set_blockmode()

#define             cdk_handle_set_blockmode(a, val)

a :

val :


cdk_handle_set_cipher()

#define             cdk_handle_set_cipher(a, val)

a :

val :


cdk_handle_set_digest()

#define             cdk_handle_set_digest(a, val)

a :

val :


cdk_handle_set_s2k()

#define             cdk_handle_set_s2k(a, val1, val2)

a :

val1 :

val2 :


cdk_verify_result_t

typedef struct cdk_verify_result_s *cdk_verify_result_t;


cdk_handle_verify_get_result ()

cdk_verify_result_t cdk_handle_verify_get_result        (cdk_ctx_t hd);

Return the verify result for the current session. Do not free the pointer.

hd :

the session handle

Returns :


cdk_pkt_new ()

cdk_error_t         cdk_pkt_new                         (cdk_packet_t *r_pkt);

r_pkt :

Returns :


cdk_pkt_alloc ()

cdk_error_t         cdk_pkt_alloc                       (cdk_packet_t *r_pkt,
                                                         int pkttype);

Allocate a new packet structure with the given packet type.

r_pkt :

output is the new packet

pkttype :

the requested packet type

Returns :


cdk_pkt_free ()

void                cdk_pkt_free                        (cdk_packet_t pkt);

pkt :


cdk_pkt_release ()

void                cdk_pkt_release                     (cdk_packet_t pkt);

Free the contents of the given package and release the memory of the structure.

pkt :

the packet

cdk_pkt_read ()

cdk_error_t         cdk_pkt_read                        (cdk_stream_t inp,
                                                         cdk_packet_t pkt);

Parse the next packet on the inp stream and return its contents in pkt.

inp :

the input stream

pkt :

allocated packet handle to store the packet

Returns :


cdk_pkt_write ()

cdk_error_t         cdk_pkt_write                       (cdk_stream_t out,
                                                         cdk_packet_t pkt);

Write the contents of pkt into the out stream. Return 0 on success.

out :

the output stream handle

pkt :

the packet itself

Returns :


cdk_subpkt_new ()

cdk_subpkt_t        cdk_subpkt_new                      (size_t size);

Create a new sub packet node with the size of size.

size :

the size of the new context

Returns :


cdk_subpkt_free ()

void                cdk_subpkt_free                     (cdk_subpkt_t ctx);

Release the context.

ctx :

the sub packet node to free

cdk_subpkt_find ()

cdk_subpkt_t        cdk_subpkt_find                     (cdk_subpkt_t ctx,
                                                         size_t type);

Find the given packet type in the node. If no packet with this type was found, return null otherwise pointer to the node.

ctx :

the sub packet node

type :

the packet type to find

Returns :


cdk_subpkt_find_next ()

cdk_subpkt_t        cdk_subpkt_find_next                (cdk_subpkt_t root,
                                                         size_t type);

Try to find the next node after root with type. If type is 0, the next node will be returned.

root :

the base where to begin the iteration

type :

the type to find or 0 for the next node.

Returns :


cdk_subpkt_type_count ()

size_t              cdk_subpkt_type_count               (cdk_subpkt_t ctx,
                                                         size_t type);

Return the amount of sub packets with this type.

ctx :

The sub packet context

type :

The sub packet type.

Returns :


cdk_subpkt_find_nth ()

cdk_subpkt_t        cdk_subpkt_find_nth                 (cdk_subpkt_t ctx,
                                                         size_t type,
                                                         size_t index);

Return the nth sub packet of the given type.

ctx :

The sub packet context

type :

The sub packet type

index :

The nth packet to retrieve, 0 means the first

Returns :


cdk_subpkt_add ()

cdk_error_t         cdk_subpkt_add                      (cdk_subpkt_t root,
                                                         cdk_subpkt_t node);

Add the node in node to the root node root.

root :

the root node

node :

the node to add

Returns :


cdk_subpkt_get_data ()

const unsigned char* cdk_subpkt_get_data                (cdk_subpkt_t ctx,
                                                         size_t *r_type,
                                                         size_t *r_nbytes);

Extract the data from the given sub packet. The type is returned in r_type and the size in r_nbytes.

ctx :

the sub packet node

r_type :

pointer store the packet type

r_nbytes :

pointer to store the packet size

Returns :


cdk_subpkt_init ()

void                cdk_subpkt_init                     (cdk_subpkt_t node,
                                                         size_t type,
                                                         const void *buf,
                                                         size_t buflen);

Set the packet data of the given root and set the type of it.

node :

the sub packet node

type :

type of the packet which data should be initialized

buf :

the buffer with the actual data

buflen :

the size of the data

cdk_key_desig_revoker_walk ()

const unsigned char* cdk_key_desig_revoker_walk         (cdk_desig_revoker_t root,
                                                         cdk_desig_revoker_t *ctx,
                                                         int *r_class,
                                                         int *r_algid);

root :

ctx :

r_class :

r_algid :

Returns :


is_RSA()

#define             is_RSA(a)

a :


is_ELG()

#define is_ELG(a) ((a) == CDK_PK_ELG_E)

a :


is_DSA()

#define is_DSA(a) ((a) == CDK_PK_DSA)

a :


cdk_pk_encrypt ()

cdk_error_t         cdk_pk_encrypt                      (cdk_pubkey_t pk,
                                                         cdk_pkt_pubkey_enc_t pke,
                                                         gcry_mpi_t sk);

Encrypt the session key in esk and write its encrypted content into the pke struct.

pk :

the public key

pke :

the public key encrypted packet

sk :

Returns :


cdk_pk_decrypt ()

cdk_error_t         cdk_pk_decrypt                      (cdk_seckey_t sk,
                                                         cdk_pkt_pubkey_enc_t pke,
                                                         gcry_mpi_t *r_sk);

Decrypt the encrypted session key from pke into r_sk.

sk :

the secret key

pke :

public key encrypted packet

r_sk :

the object to store the plain session key

Returns :


cdk_pk_sign ()

cdk_error_t         cdk_pk_sign                         (cdk_seckey_t sk,
                                                         cdk_pkt_signature_t sig,
                                                         unsigned char *md);

Sign the message digest from md and write the result into sig.

sk :

secret key

sig :

signature

md :

the message digest

Returns :


cdk_pk_verify ()

cdk_error_t         cdk_pk_verify                       (cdk_pubkey_t pk,
                                                         cdk_pkt_signature_t sig,
                                                         unsigned char *md);

Verify the signature in sig and compare it with the message digest in md.

pk :

the public key

sig :

signature

md :

the message digest

Returns :


cdk_pk_get_mpi ()

cdk_error_t         cdk_pk_get_mpi                      (cdk_pubkey_t pk,
                                                         size_t idx,
                                                         unsigned char *buf,
                                                         size_t buflen,
                                                         size_t *r_nwritten,
                                                         size_t *r_nbits);

Return the MPI with the given index of the public key.

pk :

public key

idx :

index of the MPI to retrieve

buf :

buffer to hold the raw data

buflen :

r_nwritten :

output how large the raw data is

r_nbits :

size of the MPI in bits.

Returns :


cdk_sk_get_mpi ()

cdk_error_t         cdk_sk_get_mpi                      (cdk_seckey_t sk,
                                                         size_t idx,
                                                         unsigned char *buf,
                                                         size_t buflen,
                                                         size_t *r_nwritten,
                                                         size_t *r_nbits);

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.

sk :

secret key

idx :

index of the MPI to retrieve

buf :

buffer to hold the raw data

buflen :

r_nwritten :

output length of the raw data

r_nbits :

length of the MPI data in bits.

Returns :


cdk_pk_get_nbits ()

int                 cdk_pk_get_nbits                    (cdk_pubkey_t pk);

Return the number of MPIs a signature consists of.

pk :

Returns :


cdk_pk_get_npkey ()

int                 cdk_pk_get_npkey                    (int algo);

Return the number of multiprecison integer forming an public key with the given algorithm.

algo :

The public key algorithm.

Returns :


cdk_pk_get_nskey ()

int                 cdk_pk_get_nskey                    (int algo);

Return the number of multiprecision integers forming an secret key with the given algorithm.

algo :

the public key algorithm

Returns :


cdk_pk_get_nsig ()

int                 cdk_pk_get_nsig                     (int algo);

algo :

Returns :


cdk_pk_get_nenc ()

int                 cdk_pk_get_nenc                     (int algo);

Return the number of MPI's the encrypted data consists of.

algo :

the public key algorithm

Returns :


cdk_pk_get_fingerprint ()

cdk_error_t         cdk_pk_get_fingerprint              (cdk_pubkey_t pk,
                                                         unsigned char *fpr);

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.

pk :

the public key

fpr :

the buffer to hold the fingerprint

Returns :


cdk_pk_to_fingerprint ()

cdk_error_t         cdk_pk_to_fingerprint               (cdk_pubkey_t pk,
                                                         unsigned char *fpr,
                                                         size_t fprlen,
                                                         size_t *r_nout);

Calculate a fingerprint of the given key and return it in the given byte array.

pk :

the public key

fpr :

fprlen :

r_nout :

actual length of the fingerprint.

Returns :


cdk_pk_fingerprint_get_keyid ()

unsigned int        cdk_pk_fingerprint_get_keyid        (unsigned char *fpr,
                                                         size_t fprlen,
                                                         unsigned int *keyid);

Derive the key ID from the key fingerprint. For version 3 keys, this is not working.

fpr :

the key fingerprint

fprlen :

the length of the fingerprint

keyid :

Returns :


cdk_pk_get_keyid ()

unsigned int        cdk_pk_get_keyid                    (cdk_pubkey_t pk,
                                                         unsigned int *keyid);

Calculate the key ID of the given public key.

pk :

the public key

keyid :

buffer to store the key ID

Returns :


cdk_sk_get_keyid ()

unsigned int        cdk_sk_get_keyid                    (cdk_seckey_t sk,
                                                         unsigned int *keyid);

Calculate the key ID of the secret key, actually the public key.

sk :

the secret key

keyid :

buffer to hold the key ID

Returns :


cdk_sig_get_keyid ()

unsigned int        cdk_sig_get_keyid                   (cdk_pkt_signature_t sig,
                                                         unsigned int *keyid);

Retrieve the key ID from the given signature.

sig :

the signature

keyid :

buffer to hold the key ID

Returns :


cdk_pk_release ()

void                cdk_pk_release                      (cdk_pubkey_t pk);

pk :


cdk_sk_release ()

void                cdk_sk_release                      (cdk_seckey_t sk);

sk :


cdk_sk_unprotect ()

cdk_error_t         cdk_sk_unprotect                    (cdk_seckey_t sk,
                                                         const char *pw);

Unprotect the given secret key with the passphrase.

sk :

the secret key

pw :

the passphrase

Returns :


cdk_sk_protect ()

cdk_error_t         cdk_sk_protect                      (cdk_seckey_t sk,
                                                         const char *pw);

Protect the given secret key with a passphrase.

sk :

the secret key

pw :

the passphrase to use

Returns :


cdk_pk_from_secret_key ()

cdk_error_t         cdk_pk_from_secret_key              (cdk_seckey_t sk,
                                                         cdk_pubkey_t *ret_pk);

Create a new public key from a secret key.

sk :

the secret key

ret_pk :

the new public key

Returns :


cdk_pubkey_to_sexp ()

cdk_error_t         cdk_pubkey_to_sexp                  (cdk_pubkey_t pk,
                                                         char **sexp,
                                                         size_t *len);

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).

pk :

the public key

sexp :

where to store the S-expression

len :

the length of sexp

Returns :


cdk_seckey_to_sexp ()

cdk_error_t         cdk_seckey_to_sexp                  (cdk_seckey_t sk,
                                                         char **sexp,
                                                         size_t *len);

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).

sk :

the secret key

sexp :

where to store the S-expression

len :

the length of sexp

Returns :


cdk_dek_new ()

cdk_error_t         cdk_dek_new                         (cdk_dek_t *r_dek);

Create a new DEK object.

r_dek :

the new DEK object

Returns :


cdk_dek_free ()

void                cdk_dek_free                        (cdk_dek_t dek);

Release the DEK object.

dek :

the DEK object

cdk_dek_set_cipher ()

cdk_error_t         cdk_dek_set_cipher                  (cdk_dek_t dek,
                                                         int cipher_algo);

Set the cipher for the given DEK object.

dek :

the DEK object

cipher_algo :

Returns :


cdk_dek_get_cipher ()

cdk_error_t         cdk_dek_get_cipher                  (cdk_dek_t dek,
                                                         int *r_cipher_algo);

dek :

r_cipher_algo :

Returns :


cdk_dek_set_key ()

cdk_error_t         cdk_dek_set_key                     (cdk_dek_t dek,
                                                         unsigned char *key,
                                                         size_t keylen);

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.

dek :

the DEK object

key :

the random session key

keylen :

the length of the session key.

Returns :


cdk_dek_set_mdc_flag ()

void                cdk_dek_set_mdc_flag                (cdk_dek_t dek,
                                                         int val);

Enable or disable the MDC flag for the given DEK object.

dek :

the DEK object

val :

value to enable or disable the use

cdk_dek_get_mdc_flag ()

int                 cdk_dek_get_mdc_flag                (cdk_dek_t dek);

dek :

Returns :


cdk_dek_from_passphrase ()

cdk_error_t         cdk_dek_from_passphrase             (cdk_dek_t *ret_dek,
                                                         int cipher_algo,
                                                         cdk_s2k_t s2k,
                                                         int rndsalt,
                                                         const char *passphrase);

Transform a passphrase into a DEK object.

ret_dek :

the new DEK.

cipher_algo :

symmetric key algorithm to use

s2k :

the S2K to use

rndsalt :

1=create random salt

passphrase :

Returns :


cdk_s2k_new ()

cdk_error_t         cdk_s2k_new                         (cdk_s2k_t *ret_s2k,
                                                         int mode,
                                                         int digest_algo,
                                                         unsigned char *salt);

Create a new S2K object with the given parameter. The salt parameter must be always 8 octets.

ret_s2k :

output for the new S2K object

mode :

the S2K mode (simple, salted, iter+salted)

digest_algo :

the hash algorithm

salt :

random salt

Returns :


cdk_s2k_free ()

void                cdk_s2k_free                        (cdk_s2k_t s2k);

Release the given S2K object.

s2k :

the S2K object

cdk_file_armor ()

cdk_error_t         cdk_file_armor                      (cdk_ctx_t hd,
                                                         const char *file,
                                                         const char *output);

Protect a file with ASCII armor.

hd :

Handle

file :

Name of the file to protect.

output :

Output filename.

Returns :


cdk_file_dearmor ()

cdk_error_t         cdk_file_dearmor                    (const char *file,
                                                         const char *output);

Remove ASCII armor from a file.

file :

Name of the file to unprotect.

output :

Output filename.

Returns :


cdk_armor_filter_use ()

int                 cdk_armor_filter_use                (cdk_stream_t inp);

Check if the stream contains armored data.

inp :

the stream to check

Returns :


cdk_armor_encode_buffer ()

cdk_error_t         cdk_armor_encode_buffer             (unsigned char *inbuf,
                                                         size_t inlen,
                                                         char *outbuf,
                                                         size_t outlen,
                                                         size_t *nwritten,
                                                         int type);

Encode the given buffer into base64 format.

inbuf :

the raw input buffer

inlen :

raw buffer len

outbuf :

the destination buffer for the base64 output

outlen :

destination buffer len

nwritten :

actual length of the base64 data

type :

the base64 file type.

Returns :


open ()

cdk_error_t         open                                (void *);

Param1 :

Returns :


release ()

cdk_error_t         release                             (void *);

Param1 :

Returns :


read ()

int                 read                                (void *,
                                                         void *buf,
                                                         size_t );

Param1 :

buf :

Param3 :

Returns :


write ()

int                 write                               (void *,
                                                         const void *buf,
                                                         size_t );

Param1 :

buf :

Param3 :

Returns :


seek ()

int                 seek                                (void *,
                                                         off_t );

Param1 :

Param2 :

Returns :


cdk_stream_cbs_t

typedef struct cdk_stream_cbs_s *cdk_stream_cbs_t;


cdk_stream_is_compressed ()

int                 cdk_stream_is_compressed            (cdk_stream_t s);

Return 0 if the stream is uncompressed, otherwise the compression algorithm.

s :

the stream

Returns :


cdk_stream_sockopen ()

cdk_error_t         cdk_stream_sockopen                 (const char *host,
                                                         unsigned short  port,
                                                         cdk_stream_t *ret_out);

host :

port :

ret_out :

Returns :


cdk_stream_open ()

cdk_error_t         cdk_stream_open                     (const char *file,
                                                         cdk_stream_t *ret_s);

Create a new stream based on an existing file. The stream is opened in read-only mode.

file :

The file to open

ret_s :

The new STREAM object

Returns :


cdk_stream_new ()

cdk_error_t         cdk_stream_new                      (const char *file,
                                                         cdk_stream_t *ret_s);

file :

The name of the new file

ret_s :

The new STREAM object

Returns :


cdk_stream_new_from_cbs ()

cdk_error_t         cdk_stream_new_from_cbs             (cdk_stream_cbs_t cbs,
                                                         void *opa,
                                                         cdk_stream_t *ret_s);

This function creates a stream which uses user callback for the core operations (open, close, read, write, seek).

cbs :

the callback context with all user callback functions

opa :

opaque handle which is passed to all callbacks.

ret_s :

the allocated stream

Returns :


cdk_stream_create ()

cdk_error_t         cdk_stream_create                   (const char *file,
                                                         cdk_stream_t *ret_s);

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.

file :

the filename

ret_s :

the object

Returns :


cdk_stream_tmp_new ()

cdk_error_t         cdk_stream_tmp_new                  (cdk_stream_t *r_out);

Allocate a new tempory stream which is not associated with a file.

r_out :

the new temp stream.

Returns :


cdk_stream_tmp_from_mem ()

cdk_error_t         cdk_stream_tmp_from_mem             (const void *buf,
                                                         size_t buflen,
                                                         cdk_stream_t *r_out);

Create a new tempory stream with the given contests.

buf :

the buffer which shall be written to the temp stream.

buflen :

how large the buffer is

r_out :

the new stream with the given contents.

Returns :


cdk_stream_tmp_set_mode ()

void                cdk_stream_tmp_set_mode             (cdk_stream_t s,
                                                         int val);

s :

val :


cdk_stream_flush ()

cdk_error_t         cdk_stream_flush                    (cdk_stream_t s);

s :

Returns :


cdk_stream_enable_cache ()

cdk_error_t         cdk_stream_enable_cache             (cdk_stream_t s,
                                                         int val);

Enable or disable the cache section of a stream object.

s :

the stream object

val :

1=on, 0=off

Returns :


cdk_stream_filter_disable ()

cdk_error_t         cdk_stream_filter_disable           (cdk_stream_t s,
                                                         int type);

s :

The STREAM object

type :

The numberic filter ID.

Returns :


cdk_stream_close ()

cdk_error_t         cdk_stream_close                    (cdk_stream_t s);

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.

s :

The STREAM object.

Returns :


cdk_stream_get_length ()

off_t               cdk_stream_get_length               (cdk_stream_t s);

This function should work for both read and write streams. For write streams an additional flush is used to write possible pending data.

s :

The STREAM object.

Returns :


cdk_stream_read ()

int                 cdk_stream_read                     (cdk_stream_t s,
                                                         void *buf,
                                                         size_t count);

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.

s :

The STREAM object.

buf :

The buffer to insert the readed bytes.

count :

Request so much bytes.

Returns :


cdk_stream_write ()

int                 cdk_stream_write                    (cdk_stream_t s,
                                                         const void *buf,
                                                         size_t count);

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.

s :

The STREAM object

buf :

The buffer with the values to write.

count :

The size of the buffer.

Returns :


cdk_stream_putc ()

int                 cdk_stream_putc                     (cdk_stream_t s,
                                                         int c);

s :

c :

Returns :


cdk_stream_getc ()

int                 cdk_stream_getc                     (cdk_stream_t s);

s :

Returns :


cdk_stream_eof ()

int                 cdk_stream_eof                      (cdk_stream_t s);

This function will only work with read streams.

s :

The STREAM object.

Returns :


cdk_stream_tell ()

off_t               cdk_stream_tell                     (cdk_stream_t s);

s :

Returns :


cdk_stream_seek ()

cdk_error_t         cdk_stream_seek                     (cdk_stream_t s,
                                                         off_t offset);

s :

offset :

Returns :


cdk_stream_set_armor_flag ()

cdk_error_t         cdk_stream_set_armor_flag           (cdk_stream_t s,
                                                         int type);

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).

s :

the stream object

type :

the type of armor to use

Returns :


cdk_stream_set_literal_flag ()

cdk_error_t         cdk_stream_set_literal_flag         (cdk_stream_t s,
                                                         cdk_lit_format_t mode,
                                                         const char *fname);

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.

s :

the stream object

mode :

the mode to use (binary, text, unicode)

fname :

the file name to store in the packet.

Returns :


cdk_stream_set_cipher_flag ()

cdk_error_t         cdk_stream_set_cipher_flag          (cdk_stream_t s,
                                                         cdk_dek_t dek,
                                                         int use_mdc);

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.

s :

the stream object

dek :

the data encryption key

use_mdc :

1 means to use the MDC mode

Returns :


cdk_stream_set_compress_flag ()

cdk_error_t         cdk_stream_set_compress_flag        (cdk_stream_t s,
                                                         int algo,
                                                         int level);

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.

s :

the stream object

algo :

the compression algo

level :

level of compression (0..9)

Returns :


cdk_stream_set_hash_flag ()

cdk_error_t         cdk_stream_set_hash_flag            (cdk_stream_t s,
                                                         int algo);

This is for read-only streams. It pushes a digest filter to calculate the digest of the given stream data.

s :

the stream object

algo :

Returns :


cdk_stream_set_text_flag ()

cdk_error_t         cdk_stream_set_text_flag            (cdk_stream_t s,
                                                         const char *lf);

Pushes the text filter to store the stream data in cannoncial format.

s :

the stream object

lf :

line ending

Returns :


cdk_stream_kick_off ()

cdk_error_t         cdk_stream_kick_off                 (cdk_stream_t inp,
                                                         cdk_stream_t out);

Passes the entire data from inp into the output stream out with all the activated filters.

inp :

the input stream

out :

the output stream.

Returns :


cdk_stream_mmap ()

cdk_error_t         cdk_stream_mmap                     (cdk_stream_t s,
                                                         unsigned char **ret_buf,
                                                         size_t *ret_buflen);

s :

ret_buf :

ret_buflen :

Returns :


cdk_stream_mmap_part ()

cdk_error_t         cdk_stream_mmap_part                (cdk_stream_t s,
                                                         off_t off,
                                                         size_t len,
                                                         unsigned char **ret_buf,
                                                         size_t *ret_buflen);

Map the data of the given stream into a memory section. ret_count contains the length of the buffer.

s :

the stream

off :

the offset where to start

len :

how much bytes shall be mapped

ret_buf :

the buffer to store the content

ret_buflen :

length of the buffer

Returns :


cdk_stream_peek ()

int                 cdk_stream_peek                     (cdk_stream_t inp,
                                                         unsigned char *buf,
                                                         size_t buflen);

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.

inp :

the input stream handle

buf :

buflen :

Returns :


cdk_keydb_new ()

cdk_error_t         cdk_keydb_new                       (cdk_keydb_hd_t *r_hd,
                                                         int type,
                                                         void *data,
                                                         size_t count);

Create a new keydb object

r_hd :

handle to store the new keydb object

type :

type of the keyring

data :

data which depends on the keyring type

count :

length of the data

Returns :


cdk_keydb_new_from_mem ()

cdk_error_t         cdk_keydb_new_from_mem              (cdk_keydb_hd_t *r_hd,
                                                         int secret,
                                                         const void *data,
                                                         size_t datlen);

Create a new keyring db handle from the contents of a buffer.

r_hd :

The keydb output handle.

secret :

data :

The raw key data.

datlen :

The length of the raw data.

Returns :


cdk_keydb_new_from_file ()

cdk_error_t         cdk_keydb_new_from_file             (cdk_keydb_hd_t *r_hd,
                                                         int secret,
                                                         const char *fname);

r_hd :

secret :

fname :

Returns :


cdk_keydb_new_from_stream ()

cdk_error_t         cdk_keydb_new_from_stream           (cdk_keydb_hd_t *r_hd,
                                                         int secret,
                                                         cdk_stream_t in);

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.

r_hd :

the output keydb handle

secret :

does the stream contain secret key data

in :

the input stream to use

Returns :


cdk_keydb_check_sk ()

cdk_error_t         cdk_keydb_check_sk                  (cdk_keydb_hd_t hd,
                                                         unsigned int *keyid);

hd :

keyid :

Returns :


cdk_keydb_search_start ()

cdk_error_t         cdk_keydb_search_start              (cdk_keydb_hd_t hd,
                                                         int type,
                                                         void *desc);

Create a new keydb search object.

hd :

type :

specifies the search type

desc :

description which depends on the type

Returns :


cdk_keydb_search ()

cdk_error_t         cdk_keydb_search                    (cdk_keydb_hd_t hd,
                                                         cdk_kbnode_t *ret_key);

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.

hd :

the keydb object

ret_key :

kbnode object to store the key

Returns :


cdk_keydb_free ()

void                cdk_keydb_free                      (cdk_keydb_hd_t hd);

Free the keydb object.

hd :

the keydb object

cdk_keydb_get_bykeyid ()

cdk_error_t         cdk_keydb_get_bykeyid               (cdk_keydb_hd_t hd,
                                                         unsigned int *keyid,
                                                         cdk_kbnode_t *ret_pk);

hd :

keyid :

ret_pk :

Returns :


cdk_keydb_get_byfpr ()

cdk_error_t         cdk_keydb_get_byfpr                 (cdk_keydb_hd_t hd,
                                                         unsigned char *fpr,
                                                         cdk_kbnode_t *ret_pk);

hd :

fpr :

ret_pk :

Returns :


cdk_keydb_get_bypattern ()

cdk_error_t         cdk_keydb_get_bypattern             (cdk_keydb_hd_t hd,
                                                         const char *patt,
                                                         cdk_kbnode_t *ret_pk);

hd :

patt :

ret_pk :

Returns :


cdk_keydb_get_pk ()

cdk_error_t         cdk_keydb_get_pk                    (cdk_keydb_hd_t khd,
                                                         unsigned int *keyid,
                                                         cdk_pubkey_t *ret_pk);

khd :

keyid :

ret_pk :

Returns :


cdk_keydb_get_sk ()

cdk_error_t         cdk_keydb_get_sk                    (cdk_keydb_hd_t khd,
                                                         unsigned int *keyid,
                                                         cdk_seckey_t *ret_sk);

khd :

keyid :

ret_sk :

Returns :


cdk_keydb_get_keyblock ()

cdk_error_t         cdk_keydb_get_keyblock              (cdk_stream_t inp,
                                                         cdk_kbnode_t *ret_key);

inp :

ret_key :

Returns :


cdk_keydb_idx_rebuild ()

cdk_error_t         cdk_keydb_idx_rebuild               (cdk_keydb_hd_t hd);

Rebuild the key index files for the given key database.

hd :

key database handle

Returns :


cdk_keydb_export ()

cdk_error_t         cdk_keydb_export                    (cdk_keydb_hd_t hd,
                                                         cdk_stream_t out,
                                                         cdk_strlist_t remusr);

hd :

out :

remusr :

Returns :


cdk_keydb_import ()

cdk_error_t         cdk_keydb_import                    (cdk_keydb_hd_t hd,
                                                         cdk_kbnode_t knode);

hd :

knode :

Returns :


cdk_listkey_start ()

cdk_error_t         cdk_listkey_start                   (cdk_listkey_t *r_ctx,
                                                         cdk_keydb_hd_t db,
                                                         const char *patt,
                                                         cdk_strlist_t fpatt);

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.

r_ctx :

pointer to store the new context

db :

the key database handle

patt :

string pattern

fpatt :

recipients from a stringlist to show

Returns :


cdk_listkey_close ()

void                cdk_listkey_close                   (cdk_listkey_t ctx);

Free the list key context.

ctx :

the list key context

cdk_listkey_next ()

cdk_error_t         cdk_listkey_next                    (cdk_listkey_t ctx,
                                                         cdk_kbnode_t *ret_key);

Retrieve the next key from the pattern of the key list context.

ctx :

list key context

ret_key :

Returns :


cdk_kbnode_new ()

cdk_kbnode_t        cdk_kbnode_new                      (cdk_packet_t pkt);

Allocate a new key node and add the packet.

pkt :

the packet to add

Returns :


cdk_kbnode_read_from_mem ()

cdk_error_t         cdk_kbnode_read_from_mem            (cdk_kbnode_t *ret_node,
                                                         unsigned char *buf,
                                                         size_t buflen);

Try to read a key node from the memory buffer buf.

ret_node :

the new key node

buf :

the buffer which stores the key sequence

buflen :

the length of the buffer

Returns :


cdk_kbnode_write_to_mem ()

cdk_error_t         cdk_kbnode_write_to_mem             (cdk_kbnode_t node,
                                                         unsigned char *buf,
                                                         size_t *r_nbytes);

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.

node :

the key node

buf :

the buffer to store the node data

r_nbytes :

the new length of the buffer.

Returns :


cdk_kbnode_write_to_mem_alloc ()

cdk_error_t         cdk_kbnode_write_to_mem_alloc       (cdk_kbnode_t node,
                                                         unsigned char **r_buf,
                                                         size_t *r_buflen);

The function acts similar to cdk_kbnode_write_to_mem but it allocates the buffer to avoid the lengthy second run.

node :

the key node

r_buf :

buffer to hold the raw data

r_buflen :

buffer length of the allocated raw data.

Returns :


cdk_kbnode_release ()

void                cdk_kbnode_release                  (cdk_kbnode_t node);

Release the memory of the node.

node :


cdk_kbnode_walk ()

cdk_kbnode_t        cdk_kbnode_walk                     (cdk_kbnode_t root,
                                                         cdk_kbnode_t *ctx,
                                                         int all);

root :

ctx :

all :

Returns :


cdk_kbnode_find_packet ()

cdk_packet_t        cdk_kbnode_find_packet              (cdk_kbnode_t node,
                                                         int pkttype);

Same as cdk_kbnode_find but it returns the packet instead of the node.

node :

the key node

pkttype :

packet type

Returns :


cdk_kbnode_get_packet ()

cdk_packet_t        cdk_kbnode_get_packet               (cdk_kbnode_t node);

Return the packet which is stored inside the node in node.

node :

the key node

Returns :


cdk_kbnode_find ()

cdk_kbnode_t        cdk_kbnode_find                     (cdk_kbnode_t node,
                                                         int pkttype);

Try to find the next node with the packettype pkttype.

node :

the key node

pkttype :

packet type

Returns :


cdk_kbnode_find_prev ()

cdk_kbnode_t        cdk_kbnode_find_prev                (cdk_kbnode_t root,
                                                         cdk_kbnode_t node,
                                                         int pkttype);

Find the previous node (if pkttype = 0) or the previous node with pkttype pkttype in the list starting with root of node.

root :

the root key node

node :

the key node

pkttype :

packet type

Returns :


cdk_kbnode_find_next ()

cdk_kbnode_t        cdk_kbnode_find_next                (cdk_kbnode_t node,
                                                         int pkttype);

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 the valid ordering of packets: e.g. if the next signature packet is requested, the function will not return one if it encounters a user-id.

node :

the key node

pkttype :

packet type

Returns :


cdk_kbnode_hash ()

cdk_error_t         cdk_kbnode_hash                     (cdk_kbnode_t node,
                                                         gcry_md_hd_t md,
                                                         int is_v4,
                                                         int pkttype,
                                                         int flags);

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.

node :

the key node

md :

is_v4 :

OpenPGP signature (yes=1, no=0)

pkttype :

packet type to hash (if zero use the packet type from the node)

flags :

flags which depend on the operation

Returns :


cdk_pk_check_sigs ()

cdk_error_t         cdk_pk_check_sigs                   (cdk_kbnode_t knode,
                                                         cdk_keydb_hd_t hd,
                                                         int *r_status);

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.

knode :

the key node

hd :

an optinal key database handle

r_status :

variable to store the status of the key

Returns :


cdk_pk_check_self_sig ()

cdk_error_t         cdk_pk_check_self_sig               (cdk_kbnode_t knode,
                                                         int *r_status);

A convenient function to make sure the key is valid. Valid means the self signature is ok.

knode :

the key node

r_status :

output the status of the key.

Returns :


cdk_pklist_select_algo ()

int                 cdk_pklist_select_algo              (cdk_keylist_t pkl,
                                                         int preftype);

pkl :

preftype :

Returns :


cdk_pklist_use_mdc ()

int                 cdk_pklist_use_mdc                  (cdk_keylist_t pkl);

pkl :

Returns :


cdk_pklist_build ()

cdk_error_t         cdk_pklist_build                    (cdk_keylist_t *ret_pkl,
                                                         cdk_keydb_hd_t hd,
                                                         cdk_strlist_t remusr,
                                                         int use);

ret_pkl :

hd :

remusr :

use :

Returns :


cdk_pklist_release ()

void                cdk_pklist_release                  (cdk_keylist_t pkl);

pkl :


cdk_pklist_encrypt ()

cdk_error_t         cdk_pklist_encrypt                  (cdk_keylist_t pkl,
                                                         cdk_dek_t dek,
                                                         cdk_stream_t out);

pkl :

dek :

out :

Returns :


cdk_sklist_build ()

cdk_error_t         cdk_sklist_build                    (cdk_keylist_t *ret_skl,
                                                         cdk_keydb_hd_t db,
                                                         cdk_ctx_t hd,
                                                         cdk_strlist_t locusr,
                                                         int unlock,
                                                         unsigned int use);

ret_skl :

db :

hd :

locusr :

unlock :

use :

Returns :


cdk_sklist_release ()

void                cdk_sklist_release                  (cdk_keylist_t skl);

skl :


cdk_sklist_write ()

cdk_error_t         cdk_sklist_write                    (cdk_keylist_t skl,
                                                         cdk_stream_t outp,
                                                         gcry_md_hd_t mdctx,
                                                         int sigclass,
                                                         int sigver);

skl :

outp :

mdctx :

sigclass :

sigver :

Returns :


cdk_sklist_write_onepass ()

cdk_error_t         cdk_sklist_write_onepass            (cdk_keylist_t skl,
                                                         cdk_stream_t outp,
                                                         int sigclass,
                                                         int mdalgo);

skl :

outp :

sigclass :

mdalgo :

Returns :


cdk_stream_encrypt ()

cdk_error_t         cdk_stream_encrypt                  (cdk_ctx_t hd,
                                                         cdk_strlist_t remusr,
                                                         cdk_stream_t inp,
                                                         cdk_stream_t out);

hd :

remusr :

inp :

out :

Returns :


cdk_stream_decrypt ()

cdk_error_t         cdk_stream_decrypt                  (cdk_ctx_t hd,
                                                         cdk_stream_t inp,
                                                         cdk_stream_t out);

hd :

inp :

out :

Returns :


cdk_file_encrypt ()

cdk_error_t         cdk_file_encrypt                    (cdk_ctx_t hd,
                                                         cdk_strlist_t remusr,
                                                         const char *file,
                                                         const char *output);

hd :

remusr :

file :

output :

Returns :


cdk_file_decrypt ()

cdk_error_t         cdk_file_decrypt                    (cdk_ctx_t hd,
                                                         const char *file,
                                                         const char *output);

hd :

file :

output :

Returns :


cdk_data_transform ()

cdk_error_t         cdk_data_transform                  (cdk_ctx_t hd,
                                                         enum cdk_crypto_mode_t mode,
                                                         cdk_strlist_t locusr,
                                                         cdk_strlist_t remusr,
                                                         const void *inbuf,
                                                         size_t insize,
                                                         unsigned char **outbuf,
                                                         size_t *outsize,
                                                         int modval);

hd :

mode :

locusr :

remusr :

inbuf :

insize :

outbuf :

outsize :

modval :

Returns :


cdk_stream_sign ()

cdk_error_t         cdk_stream_sign                     (cdk_ctx_t hd,
                                                         cdk_stream_t inp,
                                                         cdk_stream_t out,
                                                         cdk_strlist_t locusr,
                                                         cdk_strlist_t remusr,
                                                         int encryptflag,
                                                         int sigmode);

hd :

inp :

out :

locusr :

remusr :

encryptflag :

sigmode :

Returns :


cdk_file_sign ()

cdk_error_t         cdk_file_sign                       (cdk_ctx_t hd,
                                                         cdk_strlist_t locusr,
                                                         cdk_strlist_t remusr,
                                                         const char *file,
                                                         const char *output,
                                                         int sigmode,
                                                         int encryptflag);

hd :

locusr :

remusr :

file :

output :

sigmode :

encryptflag :

Returns :


cdk_stream_verify ()

cdk_error_t         cdk_stream_verify                   (cdk_ctx_t hd,
                                                         cdk_stream_t inp,
                                                         cdk_stream_t data,
                                                         cdk_stream_t out);

hd :

session handle

inp :

the input stream

data :

for detached signatures, this is the data stream inp is the sig

out :

where the output shall be written.

Returns :


cdk_file_verify ()

cdk_error_t         cdk_file_verify                     (cdk_ctx_t hd,
                                                         const char *file,
                                                         const char *data_file,
                                                         const char *output);

Verify a signature.

hd :

the session handle

file :

the input file

data_file :

for detached signature this is the data file and file is the sig.

output :

the output file

Returns :


cdk_trustdb_get_validity ()

int                 cdk_trustdb_get_validity            (cdk_stream_t inp,
                                                         cdk_pkt_userid_t id,
                                                         int *r_val);

inp :

id :

r_val :

Returns :


cdk_trustdb_get_ownertrust ()

int                 cdk_trustdb_get_ownertrust          (cdk_stream_t inp,
                                                         cdk_pubkey_t pk,
                                                         int *r_val,
                                                         int *r_flags);

inp :

pk :

r_val :

r_flags :

Returns :


cdk_strlist_free ()

void                cdk_strlist_free                    (cdk_strlist_t sl);

Release the string list object.

sl :

the string list

cdk_strlist_add ()

cdk_strlist_t       cdk_strlist_add                     (cdk_strlist_t *list,
                                                         const char *string);

Add the given list to the string list.

list :

destination string list

string :

the string to add

Returns :


cdk_strlist_next ()

cdk_strlist_t       cdk_strlist_next                    (cdk_strlist_t root,
                                                         const char **r_str);

Return the next string list node from root. The optional argument r_str return the data of the current (!) node.

root :

the opaque string list.

r_str :

optional argument to store the string data.

Returns :


cdk_check_version ()

const char*         cdk_check_version                   (const char *req_version);

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.

req_version :

The requested version

Returns :


cdk_utf8_encode ()

char*               cdk_utf8_encode                     (const char *string);

Encode the given string in utf8 and return it.

string :

Returns :


cdk_utf8_decode ()

char*               cdk_utf8_decode                     (const char *string,
                                                         size_t length,
                                                         int delim);

Decode the given utf8 string and return the native representation.

string :

the string to decode

length :

the length of the string

delim :

the delimiter

Returns :


cdk_keyserver_recv_key ()

cdk_error_t         cdk_keyserver_recv_key              (const char *host,
                                                         int port,
                                                         unsigned char *keyid,
                                                         int kid_type,
                                                         cdk_kbnode_t *r_key);

host :

port :

keyid :

kid_type :

r_key :

Returns :


cdk_keygen_new ()

cdk_error_t         cdk_keygen_new                      (cdk_keygen_ctx_t *r_hd);

r_hd :

Returns :


cdk_keygen_free ()

void                cdk_keygen_free                     (cdk_keygen_ctx_t hd);

hd :


cdk_keygen_set_prefs ()

cdk_error_t         cdk_keygen_set_prefs                (cdk_keygen_ctx_t hd,
                                                         enum cdk_pref_type_t type,
                                                         unsigned char *array,
                                                         size_t n);

hd :

type :

array :

n :

Returns :


cdk_keygen_set_algo_info ()

cdk_error_t         cdk_keygen_set_algo_info            (cdk_keygen_ctx_t hd,
                                                         int type,
                                                         int usage,
                                                         enum cdk_pubkey_algo_t algo,
                                                         unsigned int bits);

hd :

type :

usage :

algo :

bits :

Returns :


cdk_keygen_set_keyserver_flags ()

int                 cdk_keygen_set_keyserver_flags      (cdk_keygen_ctx_t hd,
                                                         int no_modify,
                                                         const char *pref_url);

hd :

no_modify :

pref_url :

Returns :


cdk_keygen_set_expire_date ()

int                 cdk_keygen_set_expire_date          (cdk_keygen_ctx_t hd,
                                                         int type,
                                                         long timestamp );

hd :

type :

Param3 :

Returns :


cdk_keygen_set_name ()

void                cdk_keygen_set_name                 (cdk_keygen_ctx_t hd,
                                                         const char *name);

hd :

name :


cdk_keygen_set_passphrase ()

void                cdk_keygen_set_passphrase           (cdk_keygen_ctx_t hd,
                                                         const char *pass);

hd :

pass :


cdk_keygen_start ()

cdk_error_t         cdk_keygen_start                    (cdk_keygen_ctx_t hd);

hd :

Returns :


cdk_keygen_save ()

cdk_error_t         cdk_keygen_save                     (cdk_keygen_ctx_t hd,
                                                         const char *pubf,
                                                         const char *secf);

hd :

pubf :

secf :

Returns :