aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/validate.h
blob: 376d99d60ddc776908e5eabfe7e9896a8b92d68e (plain)
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
/* validate.h - Certificate validation
 *      Copyright (C) 2004 g10 Code GmbH
 *
 * This file is part of DirMngr.
 *
 * DirMngr 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.
 *
 * DirMngr 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 */

#ifndef VALIDATE_H
#define VALIDATE_H


enum {
  /* Simple certificate validation mode. */
  VALIDATE_MODE_CERT = 0,

  /* Same as MODE_CERT but using the system provided root
   * certificates.  */
  VALIDATE_MODE_CERT_SYSTRUST,

  /* Same as MODE_CERT but uses a provided list of certificates.  */
  VALIDATE_MODE_TLS,

  /* Same as MODE_TLS but using the system provided root
   * certificates.  */
  VALIDATE_MODE_TLS_SYSTRUST,

  /* Standard CRL issuer certificate validation; i.e. CRLs are not
     considered for CRL issuer certificates. */
  VALIDATE_MODE_CRL,

  /* Full CRL validation. */
  VALIDATE_MODE_CRL_RECURSIVE,

  /* Validation as used for OCSP. */
  VALIDATE_MODE_OCSP
};


/* Validate the certificate CHAIN up to the trust anchor. Optionally
   return the closest expiration time in R_EXPTIME. */
gpg_error_t validate_cert_chain (ctrl_t ctrl,
                                 ksba_cert_t cert, ksba_isotime_t r_exptime,
                                 int mode, char **r_trust_anchor);

/* Return 0 if the certificate CERT is usable for certification.  */
gpg_error_t check_cert_use_cert (ksba_cert_t cert);

/* Return 0 if the certificate CERT is usable for signing OCSP
   responses.  */
gpg_error_t check_cert_use_ocsp (ksba_cert_t cert);

/* Return 0 if the certificate CERT is usable for signing CRLs. */
gpg_error_t check_cert_use_crl (ksba_cert_t cert);


#endif /*VALIDATE_H*/