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,
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
44 * [1] is public exponent
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_*
59 /* holds the type (PGP, X509)
61 gnutls_certificate_type_t cert_type
;
62 gnutls_sign_algorithm_t sign_algo
;
68 gnutls_openpgp_keyid_t subkey_id
;
72 /* because gnutls_session_t is not defined when this file is included */
73 struct gnutls_session_int
;
75 typedef enum ConvFlags
79 CERT_ONLY_EXTENSIONS
= 16
82 int _gnutls_x509_raw_cert_to_gcert (gnutls_cert
* gcert
,
83 const gnutls_datum_t
* derCert
,
85 int _gnutls_x509_crt_to_gcert (gnutls_cert
* gcert
, gnutls_x509_crt_t cert
,
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
,