f11b77ef604ed29de4a3133d4c7e92ceca155e09
[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
28 #include <stdio.h>
29
30 /**
31 * An object for printing certificate information.
32 */
33 struct certificate_printer_t {
34
35 /**
36 * Print a certificate.
37 *
38 * @cert certificate to be printed
39 * @has_privkey indicates that certificate has a matching private key
40 */
41 void (*print)(certificate_printer_t *this, certificate_t *cert,
42 bool has_privkey);
43
44 /**
45 * Destroy the certificate_printer object.
46 */
47 void (*destroy)(certificate_printer_t *this);
48 };
49
50 /**
51 * Create a certificate_printer object
52 *
53 * @param f file where print output is directed to (usually stdout)
54 * @param detailed print more detailed certificate information
55 * @param utc print time inforamtion in UTC
56 */
57 certificate_printer_t* certificate_printer_create(FILE *f, bool detailed,
58 bool utc);
59
60 #endif /** CERTIFICATE_PRINTER_H_ @}*/