corrected typo
[gnutls.git] / src / certtool-common.h
blobc1c07ff1e4a23885f3593b14a0ee1b5cf728e2ca
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;
55 unsigned int verbose;
56 } common_info_st;
58 gnutls_pubkey_t load_public_key_or_import(int mand, gnutls_privkey_t privkey, common_info_st * info);
59 gnutls_privkey_t load_private_key (int mand, common_info_st * info);
60 gnutls_x509_privkey_t load_x509_private_key (int mand, common_info_st * info);
61 gnutls_x509_privkey_t *load_privkey_list (int mand, size_t * privkey_size,
62 common_info_st * info);
63 gnutls_x509_crq_t load_request (common_info_st * info);
64 gnutls_privkey_t load_ca_private_key (common_info_st * info);
65 gnutls_x509_crt_t load_ca_cert (common_info_st * info);
66 gnutls_x509_crt_t load_cert (int mand, common_info_st * info);
67 gnutls_datum_t *load_secret_key (int mand, common_info_st * info);
68 gnutls_pubkey_t load_pubkey (int mand, common_info_st * info);
69 gnutls_x509_crt_t *load_cert_list (int mand, size_t * size,
70 common_info_st * info);
71 int get_bits (gnutls_pk_algorithm_t key_type, int info_bits, const char* info_sec_param);
72 gnutls_sec_param_t str_to_sec_param (const char *str);
74 /* prime.c */
75 int generate_prime (int how, common_info_st * info);
76 void dh_info (common_info_st * ci);
78 gnutls_x509_privkey_t * load_privkey_list (int mand, size_t * privkey_size, common_info_st * info);
80 void _pubkey_info(FILE* outfile, gnutls_pubkey_t pubkey);
81 void
82 print_ecc_pkey (FILE* outfile, gnutls_ecc_curve_t curve, gnutls_datum_t* k, gnutls_datum_t * x, gnutls_datum_t * y);
83 void
84 print_rsa_pkey (FILE* outfile, gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * d,
85 gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * u,
86 gnutls_datum_t * exp1, gnutls_datum_t * exp2);
87 void
88 print_dsa_pkey (FILE* outfile, gnutls_datum_t * x, gnutls_datum_t * y, gnutls_datum_t * p,
89 gnutls_datum_t * q, gnutls_datum_t * g);
91 FILE *safe_open_rw (const char *file, int privkey_op);
93 const char* get_password(common_info_st * cinfo, unsigned int *flags, int confirm);
95 extern unsigned char buffer[];
96 extern const int buffer_size;
99 #endif