Add an enumerator for PKCS#7 contained certificates
[strongswan.git] / src / libstrongswan / credentials / containers / pkcs7.h
1 /*
2 * Copyright (C) 2012 Martin Willi
3 * Copyright (C) 2012 revosec AG
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 pkcs7 pkcs7
18 * @{ @ingroup containers
19 */
20
21 #ifndef PKCS7_H_
22 #define PKCS7_H_
23
24 #include <credentials/containers/container.h>
25
26 typedef struct pkcs7_t pkcs7_t;
27
28 /**
29 * PKCS#7/CMS container type.
30 */
31 struct pkcs7_t {
32
33 /**
34 * Implements container_t.
35 */
36 container_t container;
37
38 /**
39 * Get an authenticated PKCS#9 attribute from PKCS#7 signerInfo.
40 *
41 * To select the signerInfo structure to get the attribute from, pass
42 * the enumerator position from container_t.create_signature_enumerator().
43 *
44 * @param oid OID from the attribute to get
45 * @param enumerator enumerator to select signerInfo
46 * @param value chunk receiving attribute value, internal data
47 * @return TRUE if attribute found
48 */
49 bool (*get_attribute)(pkcs7_t *this, int oid, enumerator_t *enumerator,
50 chunk_t *value);
51
52 /**
53 * Create an enumerator over attached certificates.
54 *
55 * @return enumerator over certificate_t
56 */
57 enumerator_t* (*create_cert_enumerator)(pkcs7_t *this);
58 };
59
60 #endif /** PKCS7_H_ @}*/