Refactored certificate management for the vici and stroke interfaces
[strongswan.git] / src / libstrongswan / credentials / certificates / certificate_printer.h
1 /*
2 * Copyright (C) 2015 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup certificate_printer certificate_printer
18 * @{ @ingroup certificates
19 */
20
21 #ifndef CERTIFICATE_PRINTER_H_
22 #define CERTIFICATE_PRINTER_H_
23
24 typedef struct certificate_printer_t certificate_printer_t;
25
26 #include "credentials/certificates/certificate.h"
27 #include "credentials/certificates/x509.h"
28
29 #include <stdio.h>
30
31 /**
32 * An object for printing certificate information.
33 */
34 struct certificate_printer_t {
35
36 /**
37 * Print a certificate.
38 *
39 * @cert certificate to be printed
40 * @has_privkey indicates that certificate has a matching private key
41 */
42 void (*print)(certificate_printer_t *this, certificate_t *cert,
43 bool has_privkey);
44
45 /**
46 * Print a caption if the certificate type changed.
47 *
48 * @type certificate type
49 * @flag X.509 certificate flag
50 */
51 void (*print_caption)(certificate_printer_t *this, certificate_type_t type,
52 x509_flag_t flag);
53
54 /**
55 * Destroy the certificate_printer object.
56 */
57 void (*destroy)(certificate_printer_t *this);
58 };
59
60 /**
61 * Create a certificate_printer object
62 *
63 * @param f file where print output is directed to (usually stdout)
64 * @param detailed print more detailed certificate information
65 * @param utc print time inforamtion in UTC
66 */
67 certificate_printer_t* certificate_printer_create(FILE *f, bool detailed,
68 bool utc);
69
70 #endif /** CERTIFICATE_PRINTER_H_ @}*/