gnutls_sign_get_pk_algorithm and gnutls_sign_get_hash_algorithm were exported.
[gnutls.git] / src / certtool-common.h
bloba68e47b922d01643012971c3236d95256f06c8b9
1 /*
2 * Copyright (C) 2003-2012 Free Software Foundation, Inc.
4 * This file is part of GnuTLS.
6 * GnuTLS is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * GnuTLS is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see
18 * <http://www.gnu.org/licenses/>.
21 #ifndef CERTTOOL_COMMON_H
22 #define CERTTOOL_COMMON_H
24 #include <gnutls/x509.h>
25 #include <stdio.h>
27 #define TYPE_CRT 1
28 #define TYPE_CRQ 2
30 void certtool_version (void);
32 #include <gnutls/x509.h>
33 #include <gnutls/abstract.h>
35 typedef struct common_info
37 const char *secret_key;
38 const char *privkey;
39 const char *pubkey;
40 int pkcs8;
41 int incert_format;
42 const char *cert;
44 const char *request;
45 const char *ca;
46 const char *ca_privkey;
47 int bits;
48 const char* sec_param;
49 const char* pkcs_cipher;
50 const char* password;
51 int null_password;
52 unsigned int crq_extensions;
53 unsigned int v1_cert;
54 } common_info_st;
56 gnutls_pubkey_t load_public_key_or_import(int mand, gnutls_privkey_t privkey, common_info_st * info);
57 gnutls_privkey_t load_private_key (int mand, common_info_st * info);
58 gnutls_x509_privkey_t load_x509_private_key (int mand, common_info_st * info);
59 gnutls_x509_privkey_t *load_privkey_list (int mand, size_t * privkey_size,
60 common_info_st * info);
61 gnutls_x509_crq_t load_request (common_info_st * info);
62 gnutls_privkey_t load_ca_private_key (common_info_st * info);
63 gnutls_x509_crt_t load_ca_cert (common_info_st * info);
64 gnutls_x509_crt_t load_cert (int mand, common_info_st * info);
65 gnutls_datum_t *load_secret_key (int mand, common_info_st * info);
66 gnutls_pubkey_t load_pubkey (int mand, common_info_st * info);
67 gnutls_x509_crt_t *load_cert_list (int mand, size_t * size,
68 common_info_st * info);
69 int get_bits (gnutls_pk_algorithm_t key_type, int info_bits, const char* info_sec_param);
70 gnutls_sec_param_t str_to_sec_param (const char *str);
72 /* prime.c */
73 int generate_prime (int how, common_info_st * info);
74 void dh_info (common_info_st * ci);
76 gnutls_x509_privkey_t * load_privkey_list (int mand, size_t * privkey_size, common_info_st * info);
78 void _pubkey_info(FILE* outfile, gnutls_pubkey_t pubkey);
79 void
80 print_ecc_pkey (FILE* outfile, gnutls_ecc_curve_t curve, gnutls_datum_t* k, gnutls_datum_t * x, gnutls_datum_t * y);
81 void
82 print_rsa_pkey (FILE* outfile, gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * d,
83 gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * u,
84 gnutls_datum_t * exp1, gnutls_datum_t * exp2);
85 void
86 print_dsa_pkey (FILE* outfile, gnutls_datum_t * x, gnutls_datum_t * y, gnutls_datum_t * p,
87 gnutls_datum_t * q, gnutls_datum_t * g);
89 FILE *safe_open_rw (const char *file, int privkey_op);
91 extern unsigned char buffer[];
92 extern const int buffer_size;
95 #endif