updated licenses
[gnutls.git] / lib / openpgp / openpgp_int.h
blob9f6b3a5212691dec415c6dcb5f4c3d952e797a25
1 /*
2 * Copyright (C) 2002-2012 Free Software Foundation, Inc.
4 * Author: Timo Schulz, Nikos Mavrogiannopoulos
6 * This file is part of GnuTLS.
8 * The GnuTLS is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
23 #ifndef OPENPGP_LOCAL_H
24 #define OPENPGP_LOCAL_H
26 #ifdef HAVE_CONFIG_H
27 #include <config.h>
28 #endif
30 #ifdef ENABLE_OPENPGP
32 #include <opencdk/opencdk.h>
33 #include <gnutls/openpgp.h>
35 #define KEYID_IMPORT(dst, src) { \
36 dst[0] = _gnutls_read_uint32( src); \
37 dst[1] = _gnutls_read_uint32( src+4); }
39 /* Internal context to store the OpenPGP key. */
40 typedef struct gnutls_openpgp_crt_int
42 cdk_kbnode_t knode;
43 uint8_t preferred_keyid[GNUTLS_OPENPGP_KEYID_SIZE];
44 int preferred_set;
45 } gnutls_openpgp_crt_int;
47 /* Internal context to store the private OpenPGP key. */
48 typedef struct gnutls_openpgp_privkey_int
50 cdk_kbnode_t knode;
51 uint8_t preferred_keyid[GNUTLS_OPENPGP_KEYID_SIZE];
52 int preferred_set;
53 } gnutls_openpgp_privkey_int;
56 typedef struct gnutls_openpgp_keyring_int
58 cdk_keydb_hd_t db;
59 } gnutls_openpgp_keyring_int;
61 int _gnutls_map_cdk_rc (int rc);
63 int _gnutls_openpgp_export (cdk_kbnode_t node,
64 gnutls_openpgp_crt_fmt_t format,
65 void *output_data, size_t * output_data_size,
66 int private);
68 cdk_packet_t _gnutls_get_valid_subkey (cdk_kbnode_t knode, int key_type);
70 unsigned int _gnutls_get_pgp_key_usage (unsigned int pgp_usage);
72 int
73 _gnutls_openpgp_crt_get_mpis (gnutls_openpgp_crt_t cert, uint32_t keyid[2],
74 gnutls_pk_params_st * params);
76 int
77 _gnutls_openpgp_privkey_get_mpis (gnutls_openpgp_privkey_t pkey,
78 uint32_t keyid[2], gnutls_pk_params_st* params);
80 cdk_packet_t _gnutls_openpgp_find_key (cdk_kbnode_t knode, uint32_t keyid[2],
81 unsigned int priv);
83 int _gnutls_read_pgp_mpi (cdk_packet_t pkt, unsigned int priv, size_t idx,
84 bigint_t * m);
86 int _gnutls_openpgp_find_subkey_idx (cdk_kbnode_t knode, uint32_t keyid[2],
87 unsigned int priv);
89 int _gnutls_openpgp_get_algo (int cdk_algo);
91 #endif /* ENABLE_OPENPGP */
93 #endif /* OPENPGP_LOCAL_H */