c7082e3d1d2392c3298210d091d200a9bbd176a8
[platform/upstream/gpg2.git] / dirmngr / validate.h
1 /* validate.h - Certificate validation
2  *      Copyright (C) 2004 g10 Code GmbH
3  *
4  * This file is part of DirMngr.
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef VALIDATE_H
22 #define VALIDATE_H
23
24
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
32
33 /* Standard CRL issuer certificate validation; i.e. CRLs are not
34  * considered for CRL issuer certificates.  */
35 #define VALIDATE_FLAG_CRL          64
36
37 /* If this flag is set along with VALIDATE_FLAG_CRL a full CRL
38  * verification is done.  */
39 #define VALIDATE_FLAG_RECURSIVE    128
40
41 /* Validation mode as used for OCSP.  */
42 #define VALIDATE_FLAG_OCSP         256
43
44 /* Validation mode as used with TLS.  */
45 #define VALIDATE_FLAG_TLS          512
46
47 /* Don't do CRL checks.  */
48 #define VALIDATE_FLAG_NOCRLCHECK  1024
49
50
51 /* Validate the certificate CHAIN up to the trust anchor. Optionally
52    return the closest expiration time in R_EXPTIME. */
53 gpg_error_t validate_cert_chain (ctrl_t ctrl,
54                                  ksba_cert_t cert, ksba_isotime_t r_exptime,
55                                  unsigned int flags, char **r_trust_anchor);
56
57 /* Return 0 if the certificate CERT is usable for certification.  */
58 gpg_error_t check_cert_use_cert (ksba_cert_t cert);
59
60 /* Return 0 if the certificate CERT is usable for signing OCSP
61    responses.  */
62 gpg_error_t check_cert_use_ocsp (ksba_cert_t cert);
63
64 /* Return 0 if the certificate CERT is usable for signing CRLs. */
65 gpg_error_t check_cert_use_crl (ksba_cert_t cert);
66
67
68 #endif /*VALIDATE_H*/