added ac.c
[strongswan.git] / src / libstrongswan / credentials / certificates / ac.c
1 /*
2 * Copyright (C) 2002 Ueli Galizzi, Ariane Seiler
3 * Copyright (C) 2003 Martin Berner, Lukas Suter
4 * Copyright (C) 2002-2008 Andreas Steffen
5 *
6 * Hochschule fuer Technik Rapperswil
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 * $Id: ac.h 3300 2007-10-12 21:53:18Z andreas $
19 */
20
21 #include <library.h>
22 #include <debug.h>
23 #include <asn1/pem.h>
24
25 #include "ac.h"
26
27 /*
28 * Defined in header.
29 */
30 ac_t* ac_create_from_file(char *path)
31 {
32 ac_t *ac;
33 bool pgp = FALSE;
34 chunk_t chunk;
35
36 if (!pem_asn1_load_file(path, NULL, &chunk, &pgp))
37 {
38 DBG1(" could not load attr cert file '%s'", path);
39 return NULL;
40 }
41 /* ac = (ac_t*)lib->creds->create(lib->creds,
42 CRED_CERTIFICATE, CERT_X509_AC,
43 BUILD_BLOB_ASN1_DER, chunk, BUILD_END);
44 */
45 ac = NULL;
46 if (ac == NULL)
47 {
48 DBG1(" could not parse loaded attr cert file '%s'", path);
49 return NULL;
50 }
51 DBG1(" loaded attr cert file '%s'", path);
52 return ac;
53 }
54
55