2 * @file credential_store.h
4 * @brief Interface credential_store_t.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
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>.
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
23 #ifndef CREDENTIAL_STORE_H_
24 #define CREDENTIAL_STORE_H_
27 #include <crypto/rsa/rsa_private_key.h>
28 #include <crypto/rsa/rsa_public_key.h>
29 #include <utils/identification.h>
32 typedef struct credential_store_t credential_store_t
;
35 * @brief The interface for a credential_store backend.
42 struct credential_store_t
{
45 * @brief Returns the preshared secret of a specific ID.
47 * The returned chunk must be destroyed by the caller after usage.
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.
53 * - NOT_FOUND if no preshared secrets for specific ID could be found
56 * @todo We should use two IDs to query shared secrets, since we want to use different
57 * keys for different peers...
59 status_t (*get_shared_secret
) (credential_store_t
*this, identification_t
*identification
, chunk_t
*preshared_secret
);
62 * @brief Returns the RSA public key of a specific ID.
64 * The returned rsa_public_key_t must be destroyed by the caller after usage.
66 * @param this calling object
67 * @param identification identification_t object identifiying the key.
68 * @return public key, or NULL if not found
70 rsa_public_key_t
* (*get_rsa_public_key
) (credential_store_t
*this, identification_t
*identification
);
73 * @brief Returns the RSA private key of a specific ID.
75 * The returned rsa_private_key_t must be destroyed by the caller after usage.
77 * @param this calling object
78 * @param identification identification_t object identifiying the key
79 * @return private key, or NULL if not found
81 rsa_private_key_t
*(*get_rsa_private_key
) (credential_store_t
*this, identification_t
*identification
);
84 * @brief Destroys a credential_store_t object.
86 * @param this calling object
88 void (*destroy
) (credential_store_t
*this);
91 #endif /*CREDENTIAL_STORE_H_*/