1 /* validate.h - Certificate validation
2 * Copyright (C) 2004 g10 Code GmbH
4 * This file is part of DirMngr.
6 * DirMngr is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * DirMngr is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
25 /* Flag values matching the CERTTRUST_CLASS values and a MASK for
26 * them. check_header_constants() checks their consistency. */
27 #define VALIDATE_FLAG_TRUST_SYSTEM 1
28 #define VALIDATE_FLAG_TRUST_CONFIG 2
29 #define VALIDATE_FLAG_TRUST_HKP 4
30 #define VALIDATE_FLAG_TRUST_HKPSPOOL 8
31 #define VALIDATE_FLAG_MASK_TRUST 0x0f
33 /* Standard CRL issuer certificate validation; i.e. CRLs are not
34 * considered for CRL issuer certificates. */
35 #define VALIDATE_FLAG_CRL 64
37 /* If this flag is set along with VALIDATE_FLAG_CRL a full CRL
38 * verification is done. */
39 #define VALIDATE_FLAG_RECURSIVE 128
41 /* Validation mode as used for OCSP. */
42 #define VALIDATE_FLAG_OCSP 256
44 /* Validation mode as used with TLS. */
45 #define VALIDATE_FLAG_TLS 512
47 /* Don't do CRL checks. */
48 #define VALIDATE_FLAG_NOCRLCHECK 1024
51 /* Helper to get the public key algo from a public key. */
52 int pk_algo_from_sexp (gcry_sexp_t pkey);
54 /* Validate the certificate CHAIN up to the trust anchor. Optionally
55 return the closest expiration time in R_EXPTIME. */
56 gpg_error_t validate_cert_chain (ctrl_t ctrl,
57 ksba_cert_t cert, ksba_isotime_t r_exptime,
58 unsigned int flags, char **r_trust_anchor);
60 /* Return 0 if the certificate CERT is usable for certification. */
61 gpg_error_t check_cert_use_cert (ksba_cert_t cert);
63 /* Return 0 if the certificate CERT is usable for signing OCSP
65 gpg_error_t check_cert_use_ocsp (ksba_cert_t cert);
67 /* Return 0 if the certificate CERT is usable for signing CRLs. */
68 gpg_error_t check_cert_use_crl (ksba_cert_t cert);