Updated x509 plugin to the new builder API
[strongswan.git] / src / libstrongswan / plugins / x509 / x509_cert.h
1 /*
2 * Copyright (C) 2008-2009 Martin Willi
3 * Hochschule fuer Technik Rapperswil
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 x509_cert x509_cert
18 * @{ @ingroup x509_p
19 */
20
21 #ifndef X509_CERT_H_
22 #define X509_CERT_H_
23
24 typedef struct x509_cert_t x509_cert_t;
25
26 #include <credentials/builder.h>
27 #include <credentials/certificates/x509.h>
28
29 /**
30 * Implementation of x509_t/certificate_t using own ASN1 parser.
31 */
32 struct x509_cert_t {
33
34 /**
35 * Implements the x509_t interface
36 */
37 x509_t interface;
38 };
39
40 /**
41 * Load a X.509 certificate.
42 *
43 * This function takes a BUILD_BLOB_ASN1_DER.
44 *
45 * @param type certificate type, CERT_X509 only
46 * @param args builder_part_t argument list
47 * @return X.509 certificate, NULL on failure
48 */
49 x509_cert_t *x509_cert_load(certificate_type_t type, va_list args);
50
51 /**
52 * Generate a X.509 certificate.
53 *
54 * To issue a self-signed certificate, the function takes:
55 * BUILD_SUBJECT, BUILD_SUBJECT_ALTNAMES, BUILD_SIGNING_KEY, BUILD_X509_FLAG,
56 * BUILD_NOT_BEFORE_TIME, BUILD_NOT_AFTER_TIME, BUILD_SERIAL, BUILD_DIGEST_ALG.
57 * To issue certificates from a CA, additionally pass:
58 * BUILD_SIGNING_CERT and BUILD_PUBLIC_KEY.
59 *
60 * @param type certificate type, CERT_X509 only
61 * @param args builder_part_t argument list
62 * @return X.509 certificate, NULL on failure
63 */
64 x509_cert_t *x509_cert_gen(certificate_type_t type, va_list args);
65
66 #endif /** X509_CERT_H_ @}*/