Add `gnutls/dtls.h' to the distribution.
[gnutls.git] / lib / gnutls_cert.h
bloba989b4333ea04e307e9e844cd1c9797825158d47
1 /*
2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2010 Free
3 * Software Foundation, Inc.
5 * Author: Nikos Mavrogiannopoulos
7 * This file is part of GnuTLS.
9 * The GnuTLS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 * USA
26 #ifndef GNUTLS_CERT_H
27 #define GNUTLS_CERT_H
29 #include <gnutls_pk.h>
30 #include "x509/x509_int.h"
31 #include <gnutls/openpgp.h>
33 #define MAX_PUBLIC_PARAMS_SIZE 4 /* ok for RSA and DSA */
35 /* parameters should not be larger than this limit */
36 #define DSA_PUBLIC_PARAMS 4
37 #define RSA_PUBLIC_PARAMS 2
39 typedef struct gnutls_cert
41 /* the size of params depends on the public
42 * key algorithm
43 * RSA: [0] is modulus
44 * [1] is public exponent
45 * DSA: [0] is p
46 * [1] is q
47 * [2] is g
48 * [3] is public key
50 bigint_t params[MAX_PUBLIC_PARAMS_SIZE];
51 int params_size; /* holds the size of MPI params */
53 gnutls_pk_algorithm_t subject_pk_algorithm;
55 unsigned int key_usage; /* bits from KEY_*
58 unsigned int version;
59 /* holds the type (PGP, X509)
61 gnutls_certificate_type_t cert_type;
62 gnutls_sign_algorithm_t sign_algo;
64 gnutls_datum_t raw;
66 #ifdef ENABLE_OPENPGP
67 int use_subkey;
68 gnutls_openpgp_keyid_t subkey_id;
69 #endif
70 } gnutls_cert;
72 /* because gnutls_session_t is not defined when this file is included */
73 struct gnutls_session_int;
75 typedef enum ConvFlags
77 CERT_NO_COPY = 2,
78 CERT_ONLY_PUBKEY = 4,
79 CERT_ONLY_EXTENSIONS = 16
80 } ConvFlags;
82 int _gnutls_x509_raw_cert_to_gcert (gnutls_cert * gcert,
83 const gnutls_datum_t * derCert,
84 int flags);
85 int _gnutls_x509_crt_to_gcert (gnutls_cert * gcert, gnutls_x509_crt_t cert,
86 unsigned int flags);
88 void _gnutls_gcert_deinit (gnutls_cert * cert);
90 int _gnutls_selected_cert_supported_kx (struct gnutls_session_int *session,
91 gnutls_kx_algorithm_t ** alg,
92 int *alg_size);
94 #endif