2b5459efbfedd1e6848d552a1bcae58e1bd510cc
[strongswan.git] / Source / lib / crypto / certificate.h
1 /**
2 * @file certificate.h
3 *
4 * @brief Interface of certificate_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2006 Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef CERTIFICATE_H_
24 #define CERTIFICATE_H_
25
26 #include <types.h>
27 #include <definitions.h>
28 #include <crypto/rsa/rsa_public_key.h>
29
30
31 typedef struct certificate_t certificate_t;
32
33 /**
34 * @brief X509 certificate.
35 *
36 * @b Constructors:
37 * - certificate_create_from_chunk()
38 *
39 * @ingroup transforms
40 */
41 struct certificate_t {
42
43 /**
44 * @brief Get the RSA public key from the certificate.
45 *
46 * @param this calling object
47 * @return public_key
48 */
49 rsa_public_key_t *(*get_public_key) (certificate_t *this);
50
51 /**
52 * @brief Destroys the private key.
53 *
54 * @param this private key to destroy
55 */
56 void (*destroy) (certificate_t *this);
57 };
58
59 /**
60 * @brief Read a certificate from a blob.
61 *
62 * @return created certificate_t.
63 *
64 * @ingroup transforms
65 */
66 certificate_t *certificate_create_from_chunk(chunk_t chunk);
67
68 certificate_t *certificate_create_from_file(char *filename);
69
70 #endif /* CERTIFICATE_H_ */