| GNU TLS API Reference Manual | ||||
|---|---|---|---|---|
#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);
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;
typedef enum {
CDK_FLAG_KEY_REVOKED = 256,
CDK_FLAG_KEY_EXPIRED = 512,
CDK_FLAG_SIG_EXPIRED = 1024
} cdk_key_flags_t;
typedef enum {
CDK_LITFMT_BINARY = 0,
CDK_LITFMT_TEXT = 1,
CDK_LITFMT_UNICODE= 2
} cdk_lit_format_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;
void (*cdk_log_fnc_t) (void *,
...,
const char *,
va_list );
|
|
|
|
|
|
|
void cdk_set_log_handler (cdk_log_fnc_t logfnc, void *opaque);
Set a custom handler for logging.
|
the function pointer |
|
a private values for the function |
const char* cdk_strerror (int ec);
Return an error text for the given id.
|
the error number |
Returns : |
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.
|
malloc replacement |
|
secure malloc replacement |
|
realloc replacement |
|
calloc replacement |
|
free replacement |
int cdk_malloc_hook_initialized (void);
Return if the malloc hooks are already initialized.
Returns : |
void* cdk_calloc (size_t n,
size_t m);
Safe wrapper around the c-function calloc.
|
amount of elements |
|
size of one element |
Returns : |
void* cdk_salloc (size_t size,
int clear);
Allocated the requested amount of bytes in 'secure' memory.
|
how much bytes should be allocated. |
|
shall the buffer cleared after the allocation? |
Returns : |
void cdk_lib_startup (void);
Prepare the internal structures of the library. This function should be called before any other CDK function.
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_error_t cdk_handle_new (cdk_ctx_t *r_ctx);
create a new session handle.
|
context to store the handle |
Returns : |
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.
|
session handle |
|
the database handle |
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.
|
session handle |
|
public=0 or secret=1 keyring type |
|
file name of the keyring which shall be used. |
Returns : |
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.
|
session handle |
|
type of the keyring |
Returns : |
int cdk_handle_control (cdk_ctx_t hd, int action, int cmd, ...);
Perform various control operations for the current session.
|
session handle |
|
flag which indicates whether put or get is requested |
|
command id |
|
|
Returns : |
void cdk_handle_set_passphrase_cb (cdk_ctx_t hd, char* (cbvoid *opa, const char *prompt) (), void *cb_value);
set the passphrase callback.
|
session handle |
|
callback function |
|
the opaque value for the cb function |
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.
|
the session handle |
Returns : |
cdk_error_t cdk_pkt_new (cdk_packet_t *r_pkt);
Allocate a new packet.
|
the new packet |
Returns : |
cdk_error_t cdk_pkt_alloc (cdk_packet_t *r_pkt, int pkttype);
Allocate a new packet structure with the given packet type.
|
output is the new packet |
|
the requested packet type |
Returns : |
void cdk_pkt_release (cdk_packet_t pkt);
Free the contents of the given package and release the memory of the structure.
|
the packet |
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.
|
the input stream |
|
allocated packet handle to store the packet |
Returns : |
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.
|
the output stream handle |
|
the packet itself |
Returns : |
cdk_subpkt_t cdk_subpkt_new (size_t size);
Create a new sub packet node with the size of size.
|
the size of the new context |
Returns : |
void cdk_subpkt_free (cdk_subpkt_t ctx);
Release the context.
|
the sub packet node to free |
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.
|
the sub packet node |
|
the packet type to find |
Returns : |
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.
|
the base where to begin the iteration |
|
the type to find or 0 for the next node. |
Returns : |
size_t cdk_subpkt_type_count (cdk_subpkt_t ctx, size_t type);
Return the amount of sub packets with this type.
|
The sub packet context |
|
The sub packet type. |
Returns : |
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.
|
The sub packet context |
|
The sub packet type |
|
The nth packet to retrieve, 0 means the first |
Returns : |