merged the modularization branch (credentials) back to trunk
[strongswan.git] / src / charon / credentials / credential_set.h
1 /*
2 * Copyright (C) 2007 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 * $Id$
16 */
17
18 /**
19 * @defgroup credential_set credential_set
20 * @{ @ingroup ccredentials
21 */
22
23 #ifndef CREDENTIAL_SET_H_
24 #define CREDENTIAL_SET_H_
25
26 #include <credentials/keys/public_key.h>
27 #include <credentials/keys/shared_key.h>
28 #include <credentials/certificates/certificate.h>
29
30 typedef struct credential_set_t credential_set_t;
31
32 /**
33 * A set of credentials.
34 *
35 * Contains private keys, shared keys and different kinds of certificates.
36 * Enumerators are used because queries might return multiple matches.
37 * Filter parameters restrict enumeration over specific items only.
38 * See credential_manager_t for an overview of the credential framework.
39 */
40 struct credential_set_t {
41
42 /**
43 * Create an enumerator over private keys (private_key_t).
44 *
45 * The id is either a key identifier of the requested key, or an identity
46 * of the key owner.
47 *
48 * @param type type of requested private key
49 * @param id key identifier/owner
50 * @return enumerator over private_key_t's.
51 */
52 enumerator_t *(*create_private_enumerator)(credential_set_t *this,
53 key_type_t type, identification_t *id);
54 /**
55 * Create an enumerator over certificates (certificate_t).
56 *
57 * @param cert kind of certificate
58 * @param key kind of key in certificate
59 * @param id identity (subject) this certificate belongs to
60 * @param trusted whether the certificate must be trustworthy
61 * @return enumerator as described above
62 */
63 enumerator_t *(*create_cert_enumerator)(credential_set_t *this,
64 certificate_type_t cert, key_type_t key,
65 identification_t *id, bool trusted);
66 /**
67 * Create an enumerator over shared keys (shared_key_t).
68 *
69 * The enumerator enumerates over:
70 * shared_key_t*, id_match_t me, id_match_t other
71 * But must accept NULL values for the id_matches.
72 *
73 * @param type kind of requested shared key
74 * @param me own identity
75 * @param other other identity who owns that secret
76 * @return enumerator as described above
77 */
78 enumerator_t *(*create_shared_enumerator)(credential_set_t *this,
79 shared_key_type_t type,
80 identification_t *me, identification_t *other);
81
82 /**
83 * Create an enumerator over certificate distribution points.
84 *
85 * @param type type of the certificate to get a CDP
86 * @param id identification of the distributed certificate
87 * @return an enumerator over CDPs as char*
88 */
89 enumerator_t *(*create_cdp_enumerator)(credential_set_t *this,
90 certificate_type_t type, identification_t *id);
91 };
92
93 #endif /* CREDENTIAL_SET_H_ @} */