File: certs.h

package info (click to toggle)
strongswan 2.8.0%2Bdfsg-1%2Betch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 15,344 kB
  • ctags: 15,752
  • sloc: ansic: 104,081; sh: 6,913; asm: 4,026; perl: 3,711; makefile: 3,215; pascal: 250; yacc: 221; lex: 190; xml: 147; awk: 124; sed: 98; lisp: 3
file content (80 lines) | stat: -rw-r--r-- 2,634 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* Certificate support for IKE authentication
 * Copyright (C) 2002-2004 Andreas Steffen, Zuercher Hochschule Winterthur
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 *
 * RCSID $Id: certs.h,v 1.7 2005/11/06 22:55:41 as Exp $
 */

#ifndef _CERTS_H
#define _CERTS_H

#include "pkcs1.h"
#include "x509.h"
#include "pgp.h"

/* path definitions for private keys, end certs,
 * cacerts, attribute certs and crls
 */
#define PRIVATE_KEY_PATH  "/etc/ipsec.d/private"
#define HOST_CERT_PATH    "/etc/ipsec.d/certs"
#define CA_CERT_PATH	  "/etc/ipsec.d/cacerts"
#define A_CERT_PATH	  "/etc/ipsec.d/acerts"
#define AA_CERT_PATH	  "/etc/ipsec.d/aacerts"
#define OCSP_CERT_PATH	  "/etc/ipsec.d/ocspcerts"
#define CRL_PATH	  "/etc/ipsec.d/crls"
#define REQ_PATH	  "/etc/ipsec.d/reqs"

/* advance warning of imminent expiry of
 * cacerts, public keys, and crls
 */
#define CA_CERT_WARNING_INTERVAL	30 /* days */
#define OCSP_CERT_WARNING_INTERVAL	30 /* days */
#define PUBKEY_WARNING_INTERVAL		 7 /* days */
#define CRL_WARNING_INTERVAL		 7 /* days */
#define ACERT_WARNING_INTERVAL		 1 /* day */

/* certificate access structure
 * currently X.509 and OpenPGP certificates are supported
 */
typedef struct {
    u_char type;
    union {
	x509cert_t *x509;
	pgpcert_t  *pgp;
    } u;
} cert_t;

/* used for initialization */
extern const cert_t empty_cert;

/*  do not send certificate requests
 *  flag set in plutomain.c and used in ipsec_doi.c
 */
extern bool no_cr_send;

extern err_t load_rsa_private_key(const char* filename, prompt_pass_t *pass
    , RSA_private_key_t *key);
extern chunk_t get_mycert(cert_t cert);
extern bool load_coded_file(const char *filename, prompt_pass_t *pass
    , const char *type, chunk_t *blob, bool *pgp);
extern bool load_cert(const char *filename, const char *label
    , cert_t *cert);
extern bool load_host_cert(const char *filename, cert_t *cert);
extern bool load_ca_cert(const char *filename, cert_t *cert);
extern bool same_cert(const cert_t *a, const cert_t *b);
extern void share_cert(cert_t cert);
extern void release_cert(cert_t cert);
extern void list_certs(bool utc);

#endif /* _CERTS_H */