added strneq(x,y,len) macro
[strongswan.git] / src / libstrongswan / crypto / pkcs7.h
1 /**
2 * @file pkcs7.h
3 *
4 * @brief Interface of pkcs7_contentInfo_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Copyright (C) 2002-2007 Andreas Steffen
11 *
12 * Hochschule fuer Technik Rapperswil, Switzerland
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
23 *
24 * RCSID $Id$
25 */
26
27 #ifndef _PKCS7_H
28 #define _PKCS7_H
29
30 typedef struct pkcs7_contentInfo_t pkcs7_contentInfo_t;
31
32 #include <library.h>
33 #include <crypto/x509.h>
34 #include <crypto/rsa/rsa_private_key.h>
35
36 /* Access structure for a PKCS#7 ContentInfo object */
37
38
39 /**
40 * @brief PKCS#7 ContentInfo object.
41 *
42 * @b Constructors:
43 * -pkcs7_create_from_chunk()
44 *
45 * @ingroup crypto
46 */
47 struct pkcs7_contentInfo_t {
48 /**
49 * @brief Is contentInfo object of type signedData?.
50 *
51 * @param this calling object
52 * @return TRUE if of type signedData
53 */
54 bool (*is_signedData) (pkcs7_contentInfo_t *this);
55
56 /**
57 * @brief Is contentInfo object of type envelopedData?.
58 *
59 * @param this calling object
60 * @return TRUE if of type envelopedData
61 */
62 bool (*is_envelopedData) (pkcs7_contentInfo_t *this);
63
64 /**
65 * @brief Destroys the contentInfo object.
66 *
67 * @param this contentInfo object to destroy
68 */
69 void (*destroy) (pkcs7_contentInfo_t *this);
70 };
71
72 extern chunk_t pkcs7_contentType_attribute(void);
73 extern chunk_t pkcs7_messageDigest_attribute(chunk_t content, int digest_alg);
74 extern chunk_t pkcs7_build_issuerAndSerialNumber(const x509_t *cert);
75 extern chunk_t pkcs7_build_signedData(chunk_t data, chunk_t attributes
76 ,const x509_t *cert, int digest_alg, const rsa_private_key_t *key);
77 extern chunk_t pkcs7_build_envelopedData(chunk_t data, const x509_t *cert
78 , int cipher);
79
80 #endif /* _PKCS7_H */