opencdk

opencdk

Synopsis




#define     OPENCDK_VERSION
struct      cdk_ctx_s;
typedef     cdk_ctx_t;
struct      cdk_strlist_s;
typedef     cdk_strlist_t;
struct      cdk_sesskey_s;
typedef     cdk_sesskey_t;
struct      cdk_listkey_s;
typedef     cdk_listkey_t;
struct      cdk_mpi_s;
typedef     cdk_mpi_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;
struct      cdk_md_hd_s;
typedef     cdk_md_hd_t;
struct      cdk_cipher_hd_s;
typedef     cdk_cipher_hd_t;
enum        cdk_error_t;
enum        cdk_packet_type_t;
struct      cdk_pkt_userid_s;
typedef     cdk_pkt_userid_t;
struct      cdk_pkt_pubkey_s;
typedef     cdk_pkt_pubkey_t;
struct      cdk_pkt_seckey_s;
typedef     cdk_pkt_seckey_t;
struct      cdk_pkt_signature_s;
typedef     cdk_pkt_signature_t;
struct      cdk_pkt_onepass_sig_s;
typedef     cdk_pkt_onepass_sig_t;
struct      cdk_pkt_pubkey_enc_s;
typedef     cdk_pkt_pubkey_enc_t;
struct      cdk_pkt_symkey_enc_s;
typedef     cdk_pkt_symkey_enc_t;
struct      cdk_pkt_encrypted_s;
typedef     cdk_pkt_encrypted_t;
struct      cdk_pkt_mdc_s;
typedef     cdk_pkt_mdc_t;
struct      cdk_pkt_literal_s;
typedef     cdk_pkt_literal_t;
struct      cdk_pkt_compressed_s;
typedef     cdk_pkt_compressed_t;
struct      cdk_packet_s;
typedef     CDK_PACKET;
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_func) (size_t n),
                                             void* (*new_alloc_secure_func) (size_t n),
                                             void* (*new_realloc_func) (void * p, size_t n),
                                             void* (*new_calloc_func) (size_t m, size_t n),
                                             void (*new_free_func) (void *));
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);
int         cdk_handle_new                  (cdk_ctx_t *r_ctx);
void        cdk_handle_free                 (cdk_ctx_t hd);
void        cdk_handle_set_keydb            (cdk_ctx_t hd,
                                             cdk_keydb_hd_t db);
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_callback         (cdk_ctx_t hd,
                                             void (*cb) (void *opa, int type, const char * s),
                                             void *cb_value);
void        cdk_handle_set_passphrase_cb    (cdk_ctx_t hd,
                                             char* (*cb) (void *opa, const char *prompt),
                                             void *cb_value);
#define     cdk_handle_set_armor            ( a, val )
#define     cdk_handle_set_compress         ( a, algo, level )
void        cdk_set_progress_handler        (void (*cb) (void * hd, unsigned off,unsigned size),
                                             void *cb_value);
cdk_error_t cdk_pkt_new                     (cdk_packet_t *r_pkt);
void        cdk_pkt_init                    (cdk_packet_t 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,
                                             int type);
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,
                                             int *r_type,
                                             size_t *r_nbytes);
void        cdk_subpkt_init                 (cdk_subpkt_t node,
                                             int type,
                                             const void *buf,
                                             size_t buflen);
unsigned char* cdk_userid_pref_get_array    (cdk_pkt_userid_t id,
                                             int type,
                                             size_t *ret_len);
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_pkt_pubkey_t pk,
                                             cdk_pkt_pubkey_enc_t pke,
                                             cdk_sesskey_t esk);
cdk_error_t cdk_pk_decrypt                  (cdk_pkt_seckey_t sk,
                                             cdk_pkt_pubkey_enc_t pke,
                                             cdk_sesskey_t *r_sk);
cdk_error_t cdk_pk_sign                     (cdk_pkt_seckey_t sk,
                                             cdk_pkt_signature_t sig,
                                             unsigned char *md);
cdk_error_t cdk_pk_verify                   (cdk_pkt_pubkey_t pk,
                                             cdk_pkt_signature_t sig,
                                             unsigned char *md);
cdk_error_t cdk_pk_get_mpi                  (cdk_pkt_pubkey_t pk,
                                             int idx,
                                             unsigned char *buf,
                                             size_t *r_count,
                                             size_t *r_nbits);
cdk_error_t cdk_sk_get_mpi                  (cdk_pkt_seckey_t sk,
                                             int idx,
                                             unsigned char *buf,
                                             size_t *r_count,
                                             size_t *r_nbits);
int         cdk_pk_get_nbits                (cdk_pkt_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);
int         cdk_pk_get_fingerprint          (cdk_pkt_pubkey_t pk,
                                             unsigned char *fpr);
unsigned int cdk_pk_fingerprint_get_keyid   (unsigned char *fpr,
                                             size_t fprlen,
                                             unsigned int *keyid);
unsigned int cdk_pk_get_keyid               (cdk_pkt_pubkey_t pk,
                                             unsigned int *keyid);
unsigned int cdk_sk_get_keyid               (cdk_pkt_seckey_t sk,
                                             unsigned int *keyid);
unsigned int cdk_sig_get_keyid              (cdk_pkt_signature_t sig,
                                             unsigned int *keyid);
cdk_error_t cdk_sk_unprotect                (cdk_pkt_seckey_t sk,
                                             const char *pw);
cdk_error_t cdk_sk_protect                  (cdk_pkt_seckey_t sk,
                                             const char *pw);
cdk_error_t cdk_pk_from_secret_key          (cdk_pkt_seckey_t sk,
                                             cdk_pkt_pubkey_t *ret_pk);
cdk_error_t cdk_pubkey_to_sexp              (cdk_pkt_pubkey_t pk,
                                             char **sexp,
                                             size_t *len);
cdk_error_t cdk_seckey_to_sexp              (cdk_pkt_seckey_t sk,
                                             char **sexp,
                                             size_t *len);
cdk_error_t cdk_sesskey_new                 (cdk_sesskey_t *r_sk);
void        cdk_sesskey_free                (cdk_sesskey_t sk);
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 algo);
cdk_error_t cdk_dek_set_key                 (cdk_dek_t dek,
                                             unsigned char *key,
                                             size_t keylen);
cdk_error_t cdk_dek_from_passphrase         (cdk_dek_t *ret_dek,
                                             int cipher_algo,
                                             cdk_s2k_t s2k,
                                             int mode,
                                             const char *pw);
cdk_error_t cdk_dek_encode_pkcs1            (cdk_dek_t dek,
                                             int nbits,
                                             cdk_sesskey_t *r_esk);
cdk_error_t cdk_dek_decode_pkcs1            (cdk_dek_t *ret_dek,
                                             cdk_sesskey_t esk);
cdk_error_t cdk_dek_extract                 (cdk_dek_t *ret_dek,
                                             cdk_ctx_t hd,
                                             cdk_pkt_pubkey_enc_t enc,
                                             cdk_pkt_seckey_t sk);
void        cdk_dek_set_mdc_flag            (cdk_dek_t dek,
                                             int val);
cdk_error_t cdk_s2k_new                     (cdk_s2k_t *ret_s2k,
                                             int mode,
                                             int 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);
cdk_error_t cdk_armor_filter_use            (cdk_stream_t inp);
int         cdk_stream_control              (cdk_stream_t s,
                                             int ctl,
                                             int val);
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_create               (const char *file,
                                             cdk_stream_t *ret_s);
cdk_stream_t cdk_stream_tmp                 (void);
cdk_stream_t cdk_stream_tmp_from_mem        (const void *buf,
                                             size_t count);
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_set_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);
unsigned    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);
long        cdk_stream_tell                 (cdk_stream_t s);
cdk_error_t cdk_stream_seek                 (cdk_stream_t s,
                                             long 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,
                                             int 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_count);
int         cdk_stream_peek                 (cdk_stream_t inp,
                                             unsigned char *s,
                                             size_t count);
cdk_error_t cdk_keydb_new                   (cdk_keydb_hd_t *r_hd,
                                             int type,
                                             void *data,
                                             size_t count);
cdk_error_t cdk_keydb_open                  (cdk_keydb_hd_t hd,
                                             cdk_stream_t *ret_kr);
int         cdk_keydb_check_sk              (cdk_keydb_hd_t hd,
                                             unsigned int *keyid);
cdk_error_t cdk_keydb_search_start          (cdk_keydb_hd_t db,
                                             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_pkt_pubkey_t *ret_pk);
cdk_error_t cdk_keydb_get_sk                (cdk_keydb_hd_t khd,
                                             unsigned int *keyid,
                                             cdk_pkt_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,
                                             int *result);
cdk_error_t cdk_keydb_pk_cache_sigs         (cdk_kbnode_t pk,
                                             cdk_keydb_hd_t hd);
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);
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);
void*       cdk_kbnode_get_attr             (cdk_kbnode_t node,
                                             int pkttype,
                                             int attr);
cdk_error_t cdk_kbnode_hash                 (cdk_kbnode_t node,
                                             cdk_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);
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 pk_list,
                                             cdk_dek_t dek,
                                             cdk_stream_t outp);
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,
                                             cdk_md_hd_t hash,
                                             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 out);
cdk_error_t cdk_file_verify                 (cdk_ctx_t hd,
                                             const char *file,
                                             const char *output);
unsigned long cdk_sig_get_ulong_attr        (cdk_ctx_t hd,
                                             int idx,
                                             int what);
const void* cdk_sig_get_data_attr           (cdk_ctx_t hd,
                                             int idx,
                                             int what);
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_pkt_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);
const char* cdk_strlist_walk                (cdk_strlist_t root,
                                             cdk_strlist_t *context);
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 *ret_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,
                                             enum cdk_pk_algo_t algo,
                                             int bits);
void        cdk_keygen_set_mdc_feature      (cdk_keygen_ctx_t hd,
                                             int val);
void        cdk_keygen_set_keyserver_flags  (cdk_keygen_ctx_t hd,
                                             int no_modify,
                                             const char *pref_url);
void        cdk_keygen_set_expire_date      (cdk_keygen_ctx_t hd,
                                             int type,
                                             long int 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.5.11"


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_sesskey_s

struct cdk_sesskey_s;


cdk_sesskey_t

typedef struct cdk_sesskey_s *cdk_sesskey_t;


struct cdk_listkey_s

struct cdk_listkey_s;


cdk_listkey_t

typedef struct cdk_listkey_s *cdk_listkey_t;


struct cdk_mpi_s

struct cdk_mpi_s;


cdk_mpi_t

typedef struct cdk_mpi_s *cdk_mpi_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;


struct cdk_md_hd_s

struct cdk_md_hd_s;


cdk_md_hd_t

typedef struct cdk_md_hd_s *cdk_md_hd_t;


struct cdk_cipher_hd_s

struct cdk_cipher_hd_s;


cdk_cipher_hd_t

typedef struct cdk_cipher_hd_s *cdk_cipher_hd_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_Gcry_Error = 7,
    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_error_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;


struct cdk_pkt_userid_s

struct cdk_pkt_userid_s {
    unsigned int len;
    unsigned is_primary:1;
    unsigned is_revoked:1;
    unsigned mdc_feature:1;
    cdk_prefitem_t prefs;
    unsigned char * attrib_img; /* Tag 17 if not null */
    size_t attrib_len;
    size_t prefs_size;
    unsigned int created;
    char name[1];
};


cdk_pkt_userid_t

typedef struct cdk_pkt_userid_s *cdk_pkt_userid_t;


struct cdk_pkt_pubkey_s

struct cdk_pkt_pubkey_s {
    unsigned char version;
    unsigned char pubkey_algo;
    unsigned char fpr[20];
    unsigned int keyid[2];
    unsigned int main_keyid[2];
    unsigned int timestamp;
    unsigned int expiredate;
    cdk_mpi_t mpi[4];
    unsigned is_revoked:1;
    unsigned is_invalid:1;
    unsigned has_expired:1;
    int pubkey_usage;
    cdk_pkt_userid_t uid;
    cdk_prefitem_t prefs;
    size_t prefs_size;
    cdk_desig_revoker_t revkeys;
};


cdk_pkt_pubkey_t

typedef struct cdk_pkt_pubkey_s *cdk_pkt_pubkey_t;


struct cdk_pkt_seckey_s

struct cdk_pkt_seckey_s {
    cdk_pkt_pubkey_t pk;
    unsigned int expiredate;
    int version;
    int pubkey_algo;
    unsigned int keyid[2];
    unsigned int main_keyid[2];
    unsigned char s2k_usage;
    struct {
        unsigned char algo;
        unsigned char sha1chk; /* SHA1 is used instead of a 16 bit checksum */
        cdk_s2k_t s2k;
        unsigned char iv[16];
        unsigned char ivlen;
    } protect;
    unsigned short csum;
    cdk_mpi_t mpi[4];
    unsigned char * encdata;
    size_t enclen;
    unsigned char is_protected;
    unsigned is_primary:1;
    unsigned has_expired:1;
    unsigned is_revoked:1;
};


cdk_pkt_seckey_t

typedef struct cdk_pkt_seckey_s *cdk_pkt_seckey_t;


struct cdk_pkt_signature_s

struct cdk_pkt_signature_s {
    unsigned char version;
    unsigned char sig_class;
    unsigned int timestamp;
    unsigned int expiredate;
    unsigned int keyid[2];
    unsigned char pubkey_algo;
    unsigned char digest_algo;
    unsigned char digest_start[2];
    unsigned short hashed_size;
    cdk_subpkt_t hashed;
    unsigned short unhashed_size;
    cdk_subpkt_t unhashed;
    cdk_mpi_t mpi[2];
    cdk_desig_revoker_t revkeys;
    struct {
        unsigned exportable:1;
        unsigned revocable:1;
        unsigned policy_url:1;
        unsigned notation:1;
        unsigned expired:1;
        unsigned checked:1;
        unsigned valid:1;
        unsigned missing_key:1;
    } flags;  
    unsigned int key[2]; /* only valid for key signatures */
};


cdk_pkt_signature_t

typedef struct cdk_pkt_signature_s *cdk_pkt_signature_t;


struct cdk_pkt_onepass_sig_s

struct cdk_pkt_onepass_sig_s {
    unsigned char version;
    unsigned int keyid[2];
    unsigned char sig_class;
    unsigned char digest_algo;
    unsigned char pubkey_algo;
    unsigned char last;
};


cdk_pkt_onepass_sig_t

typedef struct cdk_pkt_onepass_sig_s * cdk_pkt_onepass_sig_t;


struct cdk_pkt_pubkey_enc_s

struct cdk_pkt_pubkey_enc_s {
    unsigned char version;
    unsigned int keyid[2];
    int throw_keyid;
    unsigned char pubkey_algo;
    cdk_mpi_t mpi[2];
};


cdk_pkt_pubkey_enc_t

typedef struct cdk_pkt_pubkey_enc_s * cdk_pkt_pubkey_enc_t;


struct cdk_pkt_symkey_enc_s

struct cdk_pkt_symkey_enc_s {
    unsigned char version;
    unsigned char cipher_algo;
    cdk_s2k_t s2k;
    unsigned char seskeylen;
    unsigned char seskey[32];
};


cdk_pkt_symkey_enc_t

typedef struct cdk_pkt_symkey_enc_s *cdk_pkt_symkey_enc_t;


struct cdk_pkt_encrypted_s

struct cdk_pkt_encrypted_s {
    unsigned int len;
    int extralen;
    unsigned char mdc_method;
    cdk_stream_t buf;
};


cdk_pkt_encrypted_t

typedef struct cdk_pkt_encrypted_s *cdk_pkt_encrypted_t;


struct cdk_pkt_mdc_s

struct cdk_pkt_mdc_s {
    unsigned char hash[20];
};


cdk_pkt_mdc_t

typedef struct cdk_pkt_mdc_s *cdk_pkt_mdc_t;


struct cdk_pkt_literal_s

struct cdk_pkt_literal_s {
    unsigned int len;
    cdk_stream_t buf;
    int mode;
    unsigned int timestamp;
    int namelen;
    char name[1];
};


cdk_pkt_literal_t

typedef struct cdk_pkt_literal_s *cdk_pkt_literal_t;


struct cdk_pkt_compressed_s

struct cdk_pkt_compressed_s {
    unsigned int len;
    int algorithm;
    cdk_stream_t buf;
};


cdk_pkt_compressed_t

typedef struct cdk_pkt_compressed_s *cdk_pkt_compressed_t;


struct cdk_packet_s

struct cdk_packet_s {
    size_t pktlen; /* real packet length */
    size_t pktsize; /* length with all headers */
    int old_ctb;
    cdk_packet_type_t pkttype;
    union {
        cdk_pkt_mdc_t mdc;
        cdk_pkt_userid_t user_id;
        cdk_pkt_pubkey_t public_key;
        cdk_pkt_seckey_t secret_key;
        cdk_pkt_signature_t signature;
        cdk_pkt_pubkey_enc_t pubkey_enc;
        cdk_pkt_symkey_enc_t symkey_enc;
        cdk_pkt_compressed_t compressed;
        cdk_pkt_encrypted_t encrypted;
        cdk_pkt_literal_t literal;
        cdk_pkt_onepass_sig_t onepass_sig;
    } pkt;
};


CDK_PACKET

typedef struct cdk_packet_s CDK_PACKET;


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 private 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_func) (size_t n),
                                             void* (*new_alloc_secure_func) (size_t n),
                                             void* (*new_realloc_func) (void * p, size_t n),
                                             void* (*new_calloc_func) (size_t m, size_t n),
                                             void (*new_free_func) (void *));

Set private memory hooks for the lib.

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

n :
m :
Returns :

cdk_realloc ()

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

ptr :
size :
Returns :

cdk_salloc ()

void*       cdk_salloc                      (size_t size,
                                             int clear);

size :
clear :
Returns :

cdk_strdup ()

char*       cdk_strdup                      (const char *ptr);

ptr :
Returns :

cdk_free ()

void        cdk_free                        (void *ptr);

ptr :

cdk_handle_new ()

int         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 hd);

free the main handle.

hd : the handle

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_get_keydb ()

cdk_keydb_hd_t cdk_handle_get_keydb         (cdk_ctx_t hd,
                                             int type);

Return the keydb handle from the session handle.

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_callback ()

void        cdk_handle_set_callback         (cdk_ctx_t hd,
                                             void (*cb) (void *opa, int type, const char * s),
                                             void *cb_value);

set the callback for filter operations.

hd : the handle
cb : the callback function
cb_value : the opaque value for the function

cdk_handle_set_passphrase_cb ()

void        cdk_handle_set_passphrase_cb    (cdk_ctx_t hd,
                                             char* (*cb) (void *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_set_progress_handler ()

void        cdk_set_progress_handler        (void (*cb) (void * hd, unsigned off,unsigned size),
                                             void *cb_value);

cb :
cb_value :

cdk_pkt_new ()

cdk_error_t cdk_pkt_new                     (cdk_packet_t *r_pkt);

r_pkt :
Returns :

cdk_pkt_init ()

void        cdk_pkt_init                    (cdk_packet_t pkt);

pkt :

cdk_pkt_alloc ()

cdk_error_t cdk_pkt_alloc                   (cdk_packet_t *r_pkt,
                                             int pkttype);

r_pkt :
pkttype :
Returns :

cdk_pkt_free ()

void        cdk_pkt_free                    (cdk_packet_t pkt);

pkt :

cdk_pkt_release ()

void        cdk_pkt_release                 (cdk_packet_t pkt);

pkt :

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.

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,
                                             int 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_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,
                                             int *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,
                                             int 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_userid_pref_get_array ()

unsigned char* cdk_userid_pref_get_array    (cdk_pkt_userid_t id,
                                             int type,
                                             size_t *ret_len);

id :
type :
ret_len :
Returns :

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 || (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_pkt_pubkey_t pk,
                                             cdk_pkt_pubkey_enc_t pke,
                                             cdk_sesskey_t esk);

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
esk : the actual session key
Returns :

cdk_pk_decrypt ()

cdk_error_t cdk_pk_decrypt                  (cdk_pkt_seckey_t sk,
                                             cdk_pkt_pubkey_enc_t pke,
                                             cdk_sesskey_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_pkt_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_pkt_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_pkt_pubkey_t pk,
                                             int idx,
                                             unsigned char *buf,
                                             size_t *r_count,
                                             size_t *r_nbits);

pk :
idx :
buf :
r_count :
r_nbits :
Returns :

cdk_sk_get_mpi ()

cdk_error_t cdk_sk_get_mpi                  (cdk_pkt_seckey_t sk,
                                             int idx,
                                             unsigned char *buf,
                                             size_t *r_count,
                                             size_t *r_nbits);

sk :
idx :
buf :
r_count :
r_nbits :
Returns :

cdk_pk_get_nbits ()

int         cdk_pk_get_nbits                (cdk_pkt_pubkey_t pk);

pk :
Returns :

cdk_pk_get_npkey ()

int         cdk_pk_get_npkey                (int algo);

algo :
Returns :

cdk_pk_get_nskey ()

int         cdk_pk_get_nskey                (int algo);

algo :
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);

algo :
Returns :

cdk_pk_get_fingerprint ()

int         cdk_pk_get_fingerprint          (cdk_pkt_pubkey_t pk,
                                             unsigned char *fpr);

pk :
fpr :
Returns :

cdk_pk_fingerprint_get_keyid ()

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

fpr :
fprlen :
keyid :
Returns :

cdk_pk_get_keyid ()

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

pk :
keyid :
Returns :

cdk_sk_get_keyid ()

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

sk :
keyid :
Returns :

cdk_sig_get_keyid ()

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

sig :
keyid :
Returns :

cdk_sk_unprotect ()

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

sk :
pw :
Returns :

cdk_sk_protect ()

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

sk :
pw :
Returns :

cdk_pk_from_secret_key ()

cdk_error_t cdk_pk_from_secret_key          (cdk_pkt_seckey_t sk,
                                             cdk_pkt_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_pkt_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_pkt_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_sesskey_new ()

cdk_error_t cdk_sesskey_new                 (cdk_sesskey_t *r_sk);

r_sk :
Returns :

cdk_sesskey_free ()

void        cdk_sesskey_free                (cdk_sesskey_t sk);

sk :

cdk_dek_new ()

cdk_error_t cdk_dek_new                     (cdk_dek_t *r_dek);

r_dek :
Returns :

cdk_dek_free ()

void        cdk_dek_free                    (cdk_dek_t dek);

dek :

cdk_dek_set_cipher ()

cdk_error_t cdk_dek_set_cipher              (cdk_dek_t dek,
                                             int algo);

dek :
algo :
Returns :

cdk_dek_set_key ()

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

dek :
key :
keylen :
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 mode,
                                             const char *pw);

ret_dek :
cipher_algo :
s2k :
mode :
pw :
Returns :

cdk_dek_encode_pkcs1 ()

cdk_error_t cdk_dek_encode_pkcs1            (cdk_dek_t dek,
                                             int nbits,
                                             cdk_sesskey_t *r_esk);

dek :
nbits :
r_esk :
Returns :

cdk_dek_decode_pkcs1 ()

cdk_error_t cdk_dek_decode_pkcs1            (cdk_dek_t *ret_dek,
                                             cdk_sesskey_t esk);

ret_dek :
esk :
Returns :

cdk_dek_extract ()

cdk_error_t cdk_dek_extract                 (cdk_dek_t *ret_dek,
                                             cdk_ctx_t hd,
                                             cdk_pkt_pubkey_enc_t enc,
                                             cdk_pkt_seckey_t sk);

ret_dek :
hd :
enc :
sk :
Returns :

cdk_dek_set_mdc_flag ()

void        cdk_dek_set_mdc_flag            (cdk_dek_t dek,
                                             int val);

dek :
val :

cdk_s2k_new ()

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

ret_s2k :
mode :
algo :
salt :
Returns :

cdk_s2k_free ()

void        cdk_s2k_free                    (cdk_s2k_t s2k);

s2k :

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

cdk_error_t cdk_armor_filter_use            (cdk_stream_t inp);

Check if the stream contains armored data.

inp : the stream to check
Returns :

cdk_stream_control ()

int         cdk_stream_control              (cdk_stream_t s,
                                             int ctl,
                                             int val);

s :
ctl :
val :
Returns :

cdk_stream_open ()

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

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_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 ()

cdk_stream_t cdk_stream_tmp                 (void);

Returns :

cdk_stream_tmp_from_mem ()

cdk_stream_t cdk_stream_tmp_from_mem        (const void *buf,
                                             size_t count);

buf :
count :
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_set_cache ()

cdk_error_t cdk_stream_set_cache            (cdk_stream_t s,
                                             int val);

s :
val :
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 ()

unsigned    cdk_stream_get_length           (cdk_stream_t s);

This file only works for read stream because it's likely that the write stream is not flushed or even no data was inserted.

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

long        cdk_stream_tell                 (cdk_stream_t s);

s :
Returns :

cdk_stream_seek ()

cdk_error_t cdk_stream_seek                 (cdk_stream_t s,
                                             long offset );

s :
Param2 :
Returns :

cdk_stream_set_armor_flag ()

cdk_error_t cdk_stream_set_armor_flag       (cdk_stream_t s,
                                             int type);

s :
type :
Returns :

cdk_stream_set_literal_flag ()

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

s :
mode :
fname :
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);

s :
dek :
use_mdc :
Returns :

cdk_stream_set_compress_flag ()

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

s :
algo :
level :
Returns :

cdk_stream_set_hash_flag ()

cdk_error_t cdk_stream_set_hash_flag        (cdk_stream_t s,
                                             int algo);

s :
algo :
Returns :

cdk_stream_set_text_flag ()

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

s :
lf :
Returns :

cdk_stream_kick_off ()

cdk_error_t cdk_stream_kick_off             (cdk_stream_t inp,
                                             cdk_stream_t out);

inp :
out :
Returns :

cdk_stream_mmap ()

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

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

s : the stream
ret_buf : the buffer to store the content
ret_count : length of the buffer
Returns :

cdk_stream_peek ()

int         cdk_stream_peek                 (cdk_stream_t inp,
                                             unsigned char *s,
                                             size_t count);

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
s : buffer
count : number of bytes to peek
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_open ()

cdk_error_t cdk_keydb_open                  (cdk_keydb_hd_t hd,
                                             cdk_stream_t *ret_kr);

Open a STREAM with the contents of the keyring from hd

hd : keydb object
ret_kr : the STREAM object which contains the data of the keyring
Returns :

cdk_keydb_check_sk ()

int         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 db,
                                             int type,
                                             void *desc);

Create a new keydb search object.

db : key database handle
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. 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_pkt_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_pkt_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,
                                             int *result);

hd :
knode :
result :
Returns :

cdk_keydb_pk_cache_sigs ()

cdk_error_t cdk_keydb_pk_cache_sigs         (cdk_kbnode_t pk,
                                             cdk_keydb_hd_t hd);

pk :
hd :
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 : the pointer to the new key node object
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.

node : the key node
buf : the buffer to store the node data
r_nbytes : the new length of the buffer.
Returns :

cdk_kbnode_release ()

void        cdk_kbnode_release              (cdk_kbnode_t node);

Release the memory of the node.

node : the key 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_get_attr ()

void*       cdk_kbnode_get_attr             (cdk_kbnode_t node,
                                             int pkttype,
                                             int attr);

Extract a single attribute from the specified packet type. If no packet type is given, it is assumed that the public key is meant. If the attr was found, it is returned as a pointer which can be cast to a proper type.

node : the key node
pkttype : the packet type which the attribute should be retrieved from
attr : the attribute to retrive
Returns :

cdk_kbnode_hash ()

cdk_error_t cdk_kbnode_hash                 (cdk_kbnode_t node,
                                             cdk_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 : opaque pointer to the hash context
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 : the session handle
r_status : variable to store the status of the key
Returns :

cdk_pklist_select_algo ()

int         cdk_pklist_select_algo          (cdk_keylist_t pkl,
                                             int preftype);

Select a symmetric cipher algorithm from a list of public keys. This algorithm is present in all key preferences.

pkl : the keylist
preftype : preference type
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);

Create a public key list based on the recipient names in remusr.

ret_pkl : the new keylist
hd : the session handle
remusr : the string list of the recipients
use : public key usage
Returns :

cdk_pklist_release ()

void        cdk_pklist_release              (cdk_keylist_t pkl);

Free the memory of the key list.

pkl : the keylist

cdk_pklist_encrypt ()

cdk_error_t cdk_pklist_encrypt              (cdk_keylist_t pk_list,
                                             cdk_dek_t dek,
                                             cdk_stream_t outp);

Encrypt the session key with each key of the list and wrap it into a PUBKEY_ENC packet and write it to outp.

pk_list : the keylist
dek : the data encryption key
outp : the stream to write in the data
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);

Free the memory of the secret keylist.

skl : secret keylist

cdk_sklist_write ()

cdk_error_t cdk_sklist_write                (cdk_keylist_t skl,
                                             cdk_stream_t outp,
                                             cdk_md_hd_t hash,
                                             int sigclass,
                                             int sigver);

Complete the sig based on hash and write all signatures to outp.

skl : secret keylist
outp : the stream to write in the data
hash : opaque handle for the message digest operations
sigclass : the class of the sig
sigver : version of the sig
Returns :

cdk_sklist_write_onepass ()

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

Write a one-pass signature for each key in the list into outp.

skl : secret keylist
outp : the stream to write in the data
sigclass : the class of the sig to create
mdalgo : the message digest algorithm
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);

If remusr is NULL, then symmetric encryption is used. Via the handle the caller can set or unset multiple options.

hd : Handle
remusr : List of recipients
inp : Input stream handle
out : Output stream handle
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 : Handle
remusr : List of recipient
file : Input file
output : Output file
Returns :

cdk_file_decrypt ()

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

When the operation was successfull, hd can contain information about the signature (when present) and more.

hd : Handle.
file : Name of the file to decrypt.
output : Output filename.
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);

This function transforms data into the given openpgp mode. It works exactly like the cdk_file_xxx functions with the exception that it can be used with memory and not with streams or files.

hd : session handle
mode : crypto mode
locusr : local user list (sign mode only)
remusr : remote users 'recipients'
inbuf : input buffer with data
insize : length of data in bytes
outbuf : pointer to the output data (will be allocated)
outsize : size of the new data in bytes
modval : value for the modus (for example sign mode)
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);

Sign the data from the STREAM inp.

hd : session handle
inp : input stream
out : output stream
locusr : local user list for signing
remusr : remote user list for encrypting
encryptflag : shall the output be encrypted? (1/0)
sigmode : signature mode
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);

Sign a file.

hd :
locusr : List of userid which should be used for signing
remusr : If encrypt is valid, the list of recipients
file : Name of the input file
output : Name of the output file
sigmode : Signature mode
encryptflag : enable sign and encrypt
Returns :

cdk_stream_verify ()

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

hd :
inp :
out :
Returns :

cdk_file_verify ()

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

Verify a signature.

hd : the session handle
file : the input file
output : the output file
Returns :

cdk_sig_get_ulong_attr ()

unsigned long cdk_sig_get_ulong_attr        (cdk_ctx_t hd,
                                             int idx,
                                             int what);

Extract the requested attribute of the signature. The returned value is always an integer (max. 32-bit).

hd : session handle
idx : index of the signature
what : attribute id
Returns :

cdk_sig_get_data_attr ()

const void* cdk_sig_get_data_attr           (cdk_ctx_t hd,
                                             int idx,
                                             int what);

Extract the requested attribute of the signature. The returned value is always a constant object to the data.

hd : session handle
idx : index of the signature
what : attribute id.
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_pkt_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);

sl :

cdk_strlist_add ()

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

list :
string :
Returns :

cdk_strlist_walk ()

const char* cdk_strlist_walk                (cdk_strlist_t root,
                                             cdk_strlist_t *context);

root :
context :
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);

string :
Returns :

cdk_utf8_decode ()

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

string :
length :
delim :
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 *ret_key);

Receive a key from a keyserver.

host : URL or hostname of the keyserver
port : The port to use for the connection
keyid : KeyID of the key to retrieve
kid_type : KeyID type (long, short, fingerprint)
ret_key : The key that was found wrapped in a KBNODE struct
Returns :

cdk_keygen_new ()

cdk_error_t cdk_keygen_new                  (cdk_keygen_ctx_t *r_hd);

r_hd : the new object
Returns :

cdk_keygen_free ()

void        cdk_keygen_free                 (cdk_keygen_ctx_t hd);

hd : the keygen object

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 : the keygen object
type : the preference type
array : one-octet array with algorithm numers
n : length of array.
Returns :

cdk_keygen_set_algo_info ()

cdk_error_t cdk_keygen_set_algo_info        (cdk_keygen_ctx_t hd,
                                             int type,
                                             enum cdk_pk_algo_t algo,
                                             int bits);

hd : the keygen object.
type : key type (primary=0, subkey=1)
algo : algorithm compliant with rfc2440
bits : lengt of the key in bits
Returns :

cdk_keygen_set_mdc_feature ()

void        cdk_keygen_set_mdc_feature      (cdk_keygen_ctx_t hd,
                                             int val);

if you want a RFC2440 compliant key, you've to disable this feature until the rfc2440-bis8 becomes the next standard.

hd : keygen object
val : boolean( yes=1, no=0)

cdk_keygen_set_keyserver_flags ()

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

hd :
no_modify :
pref_url :

cdk_keygen_set_expire_date ()

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

hd : keygen object
type : key type( 0=primary, 1=seconardy)
timestamp : the date the key should expire

cdk_keygen_set_name ()

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

The name will be encoded in UTF8 to avoid problems.

hd : the keygen object
name : 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 : the keygen object
Returns :

cdk_keygen_save ()

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

hd : the keygen object
pubf : name of the file to store the public key
secf : name of the file to store the secret key
Returns :