added support for %prompt-ing private key passhprases in strokes "ipsec secrets"
[strongswan.git] / src / charon / plugins / stroke / stroke_cred.h
1 /*
2 * Copyright (C) 2008 Martin Willi
3 * 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 stroke_cred stroke_cred
18 * @{ @ingroup stroke
19 */
20
21 #ifndef STROKE_CRED_H_
22 #define STROKE_CRED_H_
23
24 #include <stdio.h>
25
26 #include <stroke_msg.h>
27 #include <credentials/credential_set.h>
28 #include <credentials/certificates/certificate.h>
29
30 typedef struct stroke_cred_t stroke_cred_t;
31
32 /**
33 * Stroke in-memory credential storage.
34 */
35 struct stroke_cred_t {
36
37 /**
38 * Implements credential_set_t
39 */
40 credential_set_t set;
41
42 /**
43 * Reread secrets from config files.
44 *
45 * @param msg stroke message
46 * @param prompt I/O channel to prompt for private key passhprase
47 */
48 void (*reread)(stroke_cred_t *this, stroke_msg_t *msg, FILE *prompt);
49
50 /**
51 * Load a CA certificate, and serve it through the credential_set.
52 *
53 * @param filename file to load CA cert from
54 * @return reference to loaded certificate, or NULL
55 */
56 certificate_t* (*load_ca)(stroke_cred_t *this, char *filename);
57
58 /**
59 * Load a peer certificate and serve it rhrough the credential_set.
60 *
61 * @param filename file to load peer cert from
62 * @return reference to loaded certificate, or NULL
63 */
64 certificate_t* (*load_peer)(stroke_cred_t *this, char *filename);
65
66 /**
67 * Enable/Disable CRL caching to disk.
68 *
69 * @param enabled TRUE to enable, FALSE to disable
70 */
71 void (*cachecrl)(stroke_cred_t *this, bool enabled);
72
73 /**
74 * Destroy a stroke_cred instance.
75 */
76 void (*destroy)(stroke_cred_t *this);
77 };
78
79 /**
80 * Create a stroke_cred instance.
81 */
82 stroke_cred_t *stroke_cred_create();
83
84 #endif /** STROKE_CRED_H_ @}*/