summaryrefslogtreecommitdiff
path: root/lib/openpgp/openpgp_int.h
blob: bf0a970352f571ccb4ccba697cfa847832655795 (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
#ifndef OPENPGP_LOCAL_H
#define OPENPGP_LOCAL_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifdef ENABLE_OPENPGP

#include <opencdk.h>
#include <gnutls/openpgp.h>

#define KEYID_IMPORT(dst, src) { \
	dst[0] = _gnutls_read_uint32( src); \
	dst[1] = _gnutls_read_uint32( src+4); }

/* Internal context to store the OpenPGP key. */
typedef struct gnutls_openpgp_crt_int
{
  cdk_kbnode_t knode;
  gnutls_openpgp_keyid_t preferred_keyid;
  int preferred_set;
} gnutls_openpgp_crt_int;

/* Internal context to store the private OpenPGP key. */
typedef struct gnutls_openpgp_privkey_int
{
  cdk_kbnode_t knode;
  gnutls_openpgp_keyid_t preferred_keyid;
  int preferred_set;
} gnutls_openpgp_privkey_int;


typedef struct gnutls_openpgp_keyring_int
{
  cdk_keydb_hd_t db;
} gnutls_openpgp_keyring_int;

int _gnutls_map_cdk_rc (int rc);

int _gnutls_openpgp_export (cdk_kbnode_t node,
                            gnutls_openpgp_crt_fmt_t format,
                            void *output_data, size_t * output_data_size,
                            int private);

int _gnutls_openpgp_crt_to_gcert (gnutls_cert * gcert,
                                  gnutls_openpgp_crt_t cert);

cdk_packet_t _gnutls_get_valid_subkey (cdk_kbnode_t knode, int key_type);

unsigned int _gnutls_get_pgp_key_usage (unsigned int pgp_usage);

int
_gnutls_openpgp_crt_get_mpis (gnutls_openpgp_crt_t cert, uint32_t keyid[2],
                              bigint_t * params, int *params_size);

int
_gnutls_openpgp_privkey_get_mpis (gnutls_openpgp_privkey_t pkey,
                                  uint32_t keyid[2], bigint_t * params,
                                  int *params_size);

cdk_packet_t _gnutls_openpgp_find_key (cdk_kbnode_t knode, uint32_t keyid[2],
                                       unsigned int priv);

int _gnutls_read_pgp_mpi (cdk_packet_t pkt, unsigned int priv, size_t idx,
                          bigint_t * m);

int _gnutls_openpgp_find_subkey_idx (cdk_kbnode_t knode, uint32_t keyid[2],
                                     unsigned int priv);

int _gnutls_openpgp_get_algo (int cdk_algo);

#endif /* ENABLE_OPENPGP */

#endif /* OPENPGP_LOCAL_H */