summaryrefslogtreecommitdiff
path: root/libextra/openpgp/openpgp.h
blob: bb76a7401f992986aa844440ffd60441fe4401a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <config.h>

#ifdef HAVE_LIBOPENCDK

#ifndef OPENPGP_H
# define OPENPGP_H

#include <opencdk.h>

typedef enum gnutls_openpgp_key_fmt { GNUTLS_OPENPGP_FMT_RAW,
        GNUTLS_OPENPGP_FMT_BASE64 } gnutls_openpgp_key_fmt;

typedef struct gnutls_openpgp_key_int {
	cdk_kbnode_t knode;
	cdk_stream_t inp;
} gnutls_openpgp_key_int;

typedef struct gnutls_openpgp_privkey_int {
	gnutls_privkey pkey;
} gnutls_openpgp_privkey_int;

typedef struct gnutls_openpgp_keyring_int {
	cdk_keydb_hd_t hd;
} gnutls_openpgp_keyring_int;

typedef struct gnutls_openpgp_trustdb_int {
	cdk_stream_t st;
} gnutls_openpgp_trustdb_int;

typedef struct gnutls_openpgp_key_int *gnutls_openpgp_key;
typedef struct gnutls_openpgp_privkey_int *gnutls_openpgp_privkey;
typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring;
typedef struct gnutls_openpgp_trustdb_int *gnutls_openpgp_trustdb;

int
_gnutls_map_cdk_rc( int rc);
int
gnutls_openpgp_key_get_name( gnutls_openpgp_key key, 
	int idx,
        char *buf, size_t *sizeof_buf);
int gnutls_openpgp_key_get_fingerprint( gnutls_openpgp_key key, 
	void *fpr, size_t *fprlen);
int gnutls_openpgp_key_get_pk_algorithm( gnutls_openpgp_key key, unsigned int *bits);
int gnutls_openpgp_key_get_version( gnutls_openpgp_key key);
time_t gnutls_openpgp_key_get_creation_time( gnutls_openpgp_key key);
time_t gnutls_openpgp_key_get_expiration_time( gnutls_openpgp_key key);
int gnutls_openpgp_key_get_id( gnutls_openpgp_key key,
                               unsigned char keyid[8]);

int gnutls_openpgp_key_init(gnutls_openpgp_key * key);
void gnutls_openpgp_key_deinit(gnutls_openpgp_key key);
int gnutls_openpgp_key_import(gnutls_openpgp_key key, 
	const gnutls_datum * data, gnutls_openpgp_key_fmt format);
int gnutls_openpgp_key_export(gnutls_openpgp_key key, 
	gnutls_openpgp_key_fmt format, void* output_data,
	size_t* output_data_size);

void gnutls_openpgp_keyring_deinit(gnutls_openpgp_keyring keyring);
int gnutls_openpgp_keyring_init(gnutls_openpgp_keyring * keyring);
int gnutls_openpgp_keyring_import(gnutls_openpgp_keyring keyring, 
	const gnutls_datum * data,
	gnutls_openpgp_key_fmt format);

void gnutls_openpgp_trustdb_deinit(gnutls_openpgp_trustdb trustdb);
int gnutls_openpgp_trustdb_init(gnutls_openpgp_trustdb * trustdb);
int gnutls_openpgp_trustdb_import_file(gnutls_openpgp_trustdb trustdb, 
	const char * file);

int gnutls_openpgp_key_verify_ring( gnutls_openpgp_key key,
        gnutls_openpgp_keyring keyring,
        unsigned int flags, unsigned int *verify);

int gnutls_openpgp_key_verify_trustdb( gnutls_openpgp_key key, 
	gnutls_openpgp_trustdb trustdb,
        unsigned int flags, unsigned int *verify);

int gnutls_openpgp_key_verify_self( gnutls_openpgp_key key,
        unsigned int flags, unsigned int *verify);

int _gnutls_openpgp_key_to_gcert(gnutls_cert * gcert, gnutls_openpgp_key cert);
int _gnutls_openpgp_privkey_to_gkey( gnutls_privkey* dest, gnutls_openpgp_privkey src);

void gnutls_openpgp_privkey_deinit(gnutls_openpgp_privkey key);

#endif

#endif /* HAVE_LIBOPENCDK */