]> git.ipfire.org Git - people/ms/strongswan.git/blob - programs/charon/charon/config/credentials/credential_store.h
- import of strongswan-2.7.0
[people/ms/strongswan.git] / programs / charon / charon / config / credentials / credential_store.h
1 /**
2 * @file credential_store.h
3 *
4 * @brief Interface credential_store_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef CREDENTIAL_STORE_H_
24 #define CREDENTIAL_STORE_H_
25
26 #include <types.h>
27 #include <crypto/rsa/rsa_private_key.h>
28 #include <crypto/rsa/rsa_public_key.h>
29 #include <utils/identification.h>
30
31
32 typedef struct credential_store_t credential_store_t;
33
34 /**
35 * @brief The interface for a credential_store backend.
36 *
37 * @b Constructors:
38 * - stroke_create()
39 *
40 * @ingroup config
41 */
42 struct credential_store_t {
43
44 /**
45 * @brief Returns the preshared secret of a specific ID.
46 *
47 * The returned chunk must be destroyed by the caller after usage.
48 *
49 * @param this calling object
50 * @param identification identification_t object identifiying the secret.
51 * @param[out] preshared_secret the preshared secret will be written there.
52 * @return
53 * - NOT_FOUND if no preshared secrets for specific ID could be found
54 * - SUCCESS
55 *
56 * @todo We should use two IDs to query shared secrets, since we want to use different
57 * keys for different peers...
58 */
59 status_t (*get_shared_secret) (credential_store_t *this, identification_t *identification, chunk_t *preshared_secret);
60
61 /**
62 * @brief Returns the RSA public key of a specific ID.
63 *
64 * The returned rsa_public_key_t must be destroyed by the caller after usage.
65 *
66 * @param this calling object
67 * @param identification identification_t object identifiying the key.
68 * @return public key, or NULL if not found
69 */
70 rsa_public_key_t * (*get_rsa_public_key) (credential_store_t *this, identification_t *identification);
71
72 /**
73 * @brief Returns the RSA private key of a specific ID.
74 *
75 * The returned rsa_private_key_t must be destroyed by the caller after usage.
76 *
77 * @param this calling object
78 * @param identification identification_t object identifiying the key
79 * @return private key, or NULL if not found
80 */
81 rsa_private_key_t *(*get_rsa_private_key) (credential_store_t *this, identification_t *identification);
82
83 /**
84 * @brief Destroys a credential_store_t object.
85 *
86 * @param this calling object
87 */
88 void (*destroy) (credential_store_t *this);
89 };
90
91 #endif /*CREDENTIAL_STORE_H_*/