updated Doxyfile
[strongswan.git] / src / libstrongswan / crypto / pkcs9.h
1 /*
2 * Copyright (C) 2008 Andreas Steffen
3 * Hochschule fuer Technik Rapperswil, Switzerland
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 pkcs9 pkcs9
20 * @{ @ingroup crypto
21 */
22
23 #ifndef PKCS9_H_
24 #define PKCS9_H_
25
26 typedef struct pkcs9_t pkcs9_t;
27
28 #include <library.h>
29
30 /**
31 * PKCS#9 attributes.
32 */
33 struct pkcs9_t {
34
35 /**
36 * Generate ASN.1 encoding of attribute list
37 */
38 void (*build_encoding) (pkcs9_t *this);
39
40 /**
41 * Gets ASN.1 encoding of PKCS#9 attribute list
42 *
43 * @return ASN.1 encoded PKCSI#9 list
44 */
45 chunk_t (*get_encoding) (pkcs9_t *this);
46
47 /**
48 * Gets a PKCS#9 attribute
49 *
50 * @param oid OID of the attribute
51 * @return ASN.1 encoded value of the attribute
52 */
53 chunk_t (*get_attribute) (pkcs9_t *this, int oid);
54
55 /**
56 * Adds a PKCS#9 attribute
57 *
58 * @param oid OID of the attribute
59 * @param value ASN.1 encoded value of the attribute
60 */
61 void (*set_attribute) (pkcs9_t *this, int oid, chunk_t value);
62
63 /**
64 * Gets a PKCS#9 messageDigest attribute
65 *
66 * @return messageDigest
67 */
68 chunk_t (*get_messageDigest) (pkcs9_t *this);
69
70 /**
71 * Add a PKCS#9 messageDigest attribute
72 *
73 * @param value messageDigest
74 */
75 void (*set_messageDigest) (pkcs9_t *this, chunk_t value);
76
77 /**
78 * Destroys the PKCS#9 attribute list.
79 */
80 void (*destroy) (pkcs9_t *this);
81 };
82
83 /**
84 * Read a PKCS#9 attribute list from a DER encoded chunk.
85 *
86 * @param chunk chunk containing DER encoded data
87 * @param level ASN.1 parsing start level
88 * @return created pkcs9 attribute list, or NULL if invalid.
89 */
90 pkcs9_t *pkcs9_create_from_chunk(chunk_t chunk, u_int level);
91
92 /**
93 * Create an empty PKCS#9 attribute list
94 *
95 * @return created pkcs9 attribute list.
96 */
97 pkcs9_t *pkcs9_create(void);
98
99 #endif /** PKCS9_H_ @}*/