Annotation of embedaddon/strongswan/src/libstrongswan/credentials/containers/container.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2013 Tobias Brunner
3: * HSR Hochschule fuer Technik Rapperswil
4: *
5: * Copyright (C) 2012 Martin Willi
6: * Copyright (C) 2012 revosec AG
7: *
8: * This program is free software; you can redistribute it and/or modify it
9: * under the terms of the GNU General Public License as published by the
10: * Free Software Foundation; either version 2 of the License, or (at your
11: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12: *
13: * This program is distributed in the hope that it will be useful, but
14: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16: * for more details.
17: */
18:
19: /**
20: * @defgroup container container
21: * @{ @ingroup containers
22: */
23:
24: #ifndef CONTAINER_H_
25: #define CONTAINER_H_
26:
27: typedef struct container_t container_t;
28: typedef enum container_type_t container_type_t;
29:
30: #include <utils/chunk.h>
31: #include <collections/enumerator.h>
32:
33: /**
34: * Type of the container.
35: */
36: enum container_type_t {
37: /** Any kind of PKCS#7/CMS container */
38: CONTAINER_PKCS7,
39: /** PKCS#7/CMS plain "data" */
40: CONTAINER_PKCS7_DATA,
41: /** PKCS#7/CMS "signed-data" */
42: CONTAINER_PKCS7_SIGNED_DATA,
43: /** PKCS#7/CMS "enveloped-data" */
44: CONTAINER_PKCS7_ENVELOPED_DATA,
45: /** PKCS#7/CMS "encrypted-data" */
46: CONTAINER_PKCS7_ENCRYPTED_DATA,
47: /** A PKCS#12 container */
48: CONTAINER_PKCS12,
49: };
50:
51: /**
52: * Enum names for container_type_t
53: */
54: extern enum_name_t *container_type_names;
55:
56: /**
57: * Generic interface for cryptographic containers.
58: */
59: struct container_t {
60:
61: /**
62: * Get the type of the container.
63: *
64: * @return container type
65: */
66: container_type_t (*get_type)(container_t *this);
67:
68: /**
69: * Create an enumerator over trustchains for valid container signatures.
70: *
71: * @return enumerator over auth_cfg_t*
72: */
73: enumerator_t* (*create_signature_enumerator)(container_t *this);
74:
75: /**
76: * Get signed/decrypted data wrapped in this container.
77: *
78: * This function does not verify any associated signatures, use
79: * create_signature_enumerator() to verify them.
80: *
81: * @param data allocated data wrapped in this container
82: * @return TRUE if data decrypted successfully
83: */
84: bool (*get_data)(container_t *this, chunk_t *data);
85:
86: /**
87: * Get the encoding of the full signed/encrypted container.
88: *
89: * @param data allocated container encoding
90: * @return TRUE if encoding successful
91: */
92: bool (*get_encoding)(container_t *this, chunk_t *encoding);
93:
94: /**
95: * Destroy a container_t.
96: */
97: void (*destroy)(container_t *this);
98: };
99:
100: #endif /** CONTAINER_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>