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
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
43 uint8_t preferred_keyid
[GNUTLS_OPENPGP_KEYID_SIZE
];
45 } gnutls_openpgp_crt_int
;
47 /* Internal context to store the private OpenPGP key. */
48 typedef struct gnutls_openpgp_privkey_int
51 uint8_t preferred_keyid
[GNUTLS_OPENPGP_KEYID_SIZE
];
53 } gnutls_openpgp_privkey_int
;
56 typedef struct gnutls_openpgp_keyring_int
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
,
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
);
73 _gnutls_openpgp_crt_get_mpis (gnutls_openpgp_crt_t cert
, uint32_t keyid
[2],
74 gnutls_pk_params_st
* params
);
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],
83 int _gnutls_read_pgp_mpi (cdk_packet_t pkt
, unsigned int priv
, size_t idx
,
86 int _gnutls_openpgp_find_subkey_idx (cdk_kbnode_t knode
, uint32_t keyid
[2],
89 int _gnutls_openpgp_get_algo (int cdk_algo
);
91 #endif /* ENABLE_OPENPGP */
93 #endif /* OPENPGP_LOCAL_H */