d0dd51da12971c26511e386a33d58d3a0ca6bd89
2 * Copyright (C) 2010-2013 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
4 * Copyright (C) 2010 Martin Willi
5 * Copyright (C) 2010 revosec AG
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * @defgroup mem_cred mem_cred
26 typedef struct mem_cred_t mem_cred_t
;
28 #include <credentials/credential_set.h>
29 #include <credentials/certificates/crl.h>
30 #include <collections/linked_list.h>
33 * Generic in-memory credential set.
38 * Implements credential_set_t.
43 * Add a certificate to the credential set.
45 * @param trusted TRUE to serve certificate as trusted
46 * @param cert certificate, reference gets owned by set
48 void (*add_cert
)(mem_cred_t
*this, bool trusted
, certificate_t
*cert
);
51 * Add a certificate to the credential set, returning a reference to it or
52 * to a cached duplicate.
54 * @param trusted TRUE to serve certificate as trusted
55 * @param cert certificate, reference gets owned by set
56 * @return reference to cert or a previously cached duplicate
58 certificate_t
*(*add_cert_ref
)(mem_cred_t
*this, bool trusted
,
62 * Add an X.509 CRL to the credential set.
64 * @param crl CRL, gets owned by set
65 * @return TRUE, if the CRL is newer than an existing one (or
68 bool (*add_crl
)(mem_cred_t
*this, crl_t
*crl
);
71 * Add a private key to the credential set.
73 * @param key key, reference gets owned by set
75 void (*add_key
)(mem_cred_t
*this, private_key_t
*key
);
78 * Add a shared key to the credential set.
80 * @param shared shared key to add, gets owned by set
81 * @param ... NULL terminated list of owners (identification_t*)
83 void (*add_shared
)(mem_cred_t
*this, shared_key_t
*shared
, ...);
86 * Add a shared key to the credential set.
88 * @param shared shared key to add, gets owned by set
89 * @param owners list of owners (identification_t*), gets owned
91 void (*add_shared_list
)(mem_cred_t
*this, shared_key_t
*shared
,
92 linked_list_t
*owners
);
94 * Add a certificate distribution point to the set.
96 * @param type type of the certificate
97 * @param id certificate ID CDP has a cert for, gets cloned
98 * @param uri CDP URI, gets strduped
100 void (*add_cdp
)(mem_cred_t
*this, certificate_type_t type
,
101 identification_t
*id
, char *uri
);
104 * Replace all secrets (private and shared keys) in this credential set
105 * with those of another.
107 * @param other credential set to get secrets from
108 * @param clone TRUE to clone secrets, FALSE to adopt them (they
109 * get removed from the other set)
111 void (*replace_secrets
)(mem_cred_t
*this, mem_cred_t
*other
, bool clone
);
114 * Clear all credentials from the credential set.
116 void (*clear
)(mem_cred_t
*this);
119 * Clear the secrets (private and shared keys, not the certificates) from
120 * the credential set.
122 void (*clear_secrets
)(mem_cred_t
*this);
125 * Destroy a mem_cred_t.
127 void (*destroy
)(mem_cred_t
*this);
131 * Create a mem_cred instance.
133 mem_cred_t
*mem_cred_create();
135 #endif /** MEM_CRED_H_ @}*/