Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:00:18

0001 /*
0002  * Copyright (C) 2014 Free Software Foundation, Inc.
0003  *
0004  * Author: Nikos Mavrogiannopoulos
0005  *
0006  * This file is part of GnuTLS.
0007  *
0008  * The GnuTLS is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Lesser General Public License
0010  * as published by the Free Software Foundation; either version 2.1 of
0011  * the License, or (at your option) any later version.
0012  *
0013  * This library is distributed in the hope that it will be useful, but
0014  * WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Lesser General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Lesser General Public License
0019  * along with this program.  If not, see <https://www.gnu.org/licenses/>
0020  *
0021  */
0022 
0023 /* Prototypes for direct handling of extension data */
0024 
0025 #ifndef GNUTLS_X509_EXT_H
0026 #define GNUTLS_X509_EXT_H
0027 
0028 #include <gnutls/gnutls.h>
0029 #include <gnutls/x509.h>
0030 
0031 #ifdef __cplusplus
0032 extern "C" {
0033 #endif
0034 
0035 typedef struct gnutls_subject_alt_names_st *gnutls_subject_alt_names_t;
0036 
0037 int gnutls_subject_alt_names_init(gnutls_subject_alt_names_t *);
0038 void gnutls_subject_alt_names_deinit(gnutls_subject_alt_names_t sans);
0039 int gnutls_subject_alt_names_get(gnutls_subject_alt_names_t sans,
0040                  unsigned int seq, unsigned int *san_type,
0041                  gnutls_datum_t *san,
0042                  gnutls_datum_t *othername_oid);
0043 int gnutls_subject_alt_names_set(gnutls_subject_alt_names_t sans,
0044                  unsigned int san_type,
0045                  const gnutls_datum_t *san,
0046                  const char *othername_oid);
0047 
0048 int gnutls_x509_ext_import_subject_alt_names(const gnutls_datum_t *ext,
0049                          gnutls_subject_alt_names_t,
0050                          unsigned int flags);
0051 int gnutls_x509_ext_export_subject_alt_names(gnutls_subject_alt_names_t,
0052                          gnutls_datum_t *ext);
0053 
0054 /* They are exactly the same */
0055 #define gnutls_x509_ext_import_issuer_alt_name \
0056     gnutls_x509_ext_import_subject_alt_name
0057 #define gnutls_x509_ext_export_issuer_alt_name \
0058     gnutls_x509_ext_export_subject_alt_name
0059 
0060 typedef struct gnutls_x509_crl_dist_points_st *gnutls_x509_crl_dist_points_t;
0061 
0062 int gnutls_x509_crl_dist_points_init(gnutls_x509_crl_dist_points_t *);
0063 void gnutls_x509_crl_dist_points_deinit(gnutls_x509_crl_dist_points_t);
0064 int gnutls_x509_crl_dist_points_get(gnutls_x509_crl_dist_points_t,
0065                     unsigned int seq, unsigned int *type,
0066                     gnutls_datum_t *dist,
0067                     unsigned int *reason_flags);
0068 int gnutls_x509_crl_dist_points_set(gnutls_x509_crl_dist_points_t,
0069                     gnutls_x509_subject_alt_name_t type,
0070                     const gnutls_datum_t *dist,
0071                     unsigned int reason_flags);
0072 
0073 int gnutls_x509_ext_import_crl_dist_points(const gnutls_datum_t *ext,
0074                        gnutls_x509_crl_dist_points_t dp,
0075                        unsigned int flags);
0076 int gnutls_x509_ext_export_crl_dist_points(gnutls_x509_crl_dist_points_t dp,
0077                        gnutls_datum_t *ext);
0078 
0079 int gnutls_x509_ext_import_name_constraints(const gnutls_datum_t *ext,
0080                         gnutls_x509_name_constraints_t nc,
0081                         unsigned int flags);
0082 int gnutls_x509_ext_export_name_constraints(gnutls_x509_name_constraints_t nc,
0083                         gnutls_datum_t *ext);
0084 
0085 typedef struct gnutls_x509_aia_st *gnutls_x509_aia_t;
0086 
0087 int gnutls_x509_aia_init(gnutls_x509_aia_t *);
0088 void gnutls_x509_aia_deinit(gnutls_x509_aia_t);
0089 int gnutls_x509_aia_get(gnutls_x509_aia_t aia, unsigned int seq,
0090             gnutls_datum_t *oid, unsigned *san_type,
0091             gnutls_datum_t *san);
0092 int gnutls_x509_aia_set(gnutls_x509_aia_t aia, const char *oid,
0093             unsigned san_type, const gnutls_datum_t *san);
0094 
0095 int gnutls_x509_ext_import_aia(const gnutls_datum_t *ext, gnutls_x509_aia_t,
0096                    unsigned int flags);
0097 int gnutls_x509_ext_export_aia(gnutls_x509_aia_t aia, gnutls_datum_t *ext);
0098 
0099 int gnutls_x509_ext_import_subject_key_id(const gnutls_datum_t *ext,
0100                       gnutls_datum_t *id);
0101 int gnutls_x509_ext_export_subject_key_id(const gnutls_datum_t *id,
0102                       gnutls_datum_t *ext);
0103 
0104 typedef struct gnutls_x509_aki_st *gnutls_x509_aki_t;
0105 
0106 int gnutls_x509_ext_export_authority_key_id(gnutls_x509_aki_t,
0107                         gnutls_datum_t *ext);
0108 int gnutls_x509_ext_import_authority_key_id(const gnutls_datum_t *ext,
0109                         gnutls_x509_aki_t,
0110                         unsigned int flags);
0111 
0112 int gnutls_x509_othername_to_virtual(const char *oid,
0113                      const gnutls_datum_t *othername,
0114                      unsigned int *virt_type,
0115                      gnutls_datum_t *virt);
0116 
0117 int gnutls_x509_aki_init(gnutls_x509_aki_t *);
0118 int gnutls_x509_aki_get_id(gnutls_x509_aki_t, gnutls_datum_t *id);
0119 int gnutls_x509_aki_get_cert_issuer(gnutls_x509_aki_t aki, unsigned int seq,
0120                     unsigned int *san_type, gnutls_datum_t *san,
0121                     gnutls_datum_t *othername_oid,
0122                     gnutls_datum_t *serial);
0123 int gnutls_x509_aki_set_id(gnutls_x509_aki_t aki, const gnutls_datum_t *id);
0124 int gnutls_x509_aki_set_cert_issuer(gnutls_x509_aki_t aki,
0125                     unsigned int san_type,
0126                     const gnutls_datum_t *san,
0127                     const char *othername_oid,
0128                     const gnutls_datum_t *serial);
0129 void gnutls_x509_aki_deinit(gnutls_x509_aki_t);
0130 
0131 int gnutls_x509_ext_import_private_key_usage_period(const gnutls_datum_t *ext,
0132                             time_t *activation,
0133                             time_t *expiration);
0134 int gnutls_x509_ext_export_private_key_usage_period(time_t activation,
0135                             time_t expiration,
0136                             gnutls_datum_t *ext);
0137 
0138 int gnutls_x509_ext_import_basic_constraints(const gnutls_datum_t *ext,
0139                          unsigned int *ca, int *pathlen);
0140 int gnutls_x509_ext_export_basic_constraints(unsigned int ca, int pathlen,
0141                          gnutls_datum_t *ext);
0142 
0143 typedef struct gnutls_x509_key_purposes_st *gnutls_x509_key_purposes_t;
0144 
0145 int gnutls_x509_key_purpose_init(gnutls_x509_key_purposes_t *p);
0146 void gnutls_x509_key_purpose_deinit(gnutls_x509_key_purposes_t p);
0147 int gnutls_x509_key_purpose_set(gnutls_x509_key_purposes_t p, const char *oid);
0148 int gnutls_x509_key_purpose_get(gnutls_x509_key_purposes_t p, unsigned idx,
0149                 gnutls_datum_t *oid);
0150 
0151 int gnutls_x509_ext_import_key_purposes(const gnutls_datum_t *ext,
0152                     gnutls_x509_key_purposes_t,
0153                     unsigned int flags);
0154 int gnutls_x509_ext_export_key_purposes(gnutls_x509_key_purposes_t,
0155                     gnutls_datum_t *ext);
0156 
0157 int gnutls_x509_ext_import_key_usage(const gnutls_datum_t *ext,
0158                      unsigned int *key_usage);
0159 int gnutls_x509_ext_export_key_usage(unsigned int key_usage,
0160                      gnutls_datum_t *ext);
0161 
0162 int gnutls_x509_ext_import_inhibit_anypolicy(const gnutls_datum_t *ext,
0163                          unsigned int *skipcerts);
0164 int gnutls_x509_ext_export_inhibit_anypolicy(unsigned int skipcerts,
0165                          gnutls_datum_t *ext);
0166 
0167 int gnutls_x509_ext_import_proxy(const gnutls_datum_t *ext, int *pathlen,
0168                  char **policyLanguage, char **policy,
0169                  size_t *sizeof_policy);
0170 int gnutls_x509_ext_export_proxy(int pathLenConstraint,
0171                  const char *policyLanguage, const char *policy,
0172                  size_t sizeof_policy, gnutls_datum_t *ext);
0173 
0174 typedef struct gnutls_x509_policies_st *gnutls_x509_policies_t;
0175 
0176 int gnutls_x509_policies_init(gnutls_x509_policies_t *);
0177 void gnutls_x509_policies_deinit(gnutls_x509_policies_t);
0178 
0179 int gnutls_x509_policies_get(gnutls_x509_policies_t policies, unsigned int seq,
0180                  struct gnutls_x509_policy_st *policy);
0181 int gnutls_x509_policies_set(gnutls_x509_policies_t policies,
0182                  const struct gnutls_x509_policy_st *policy);
0183 
0184 int gnutls_x509_ext_import_policies(const gnutls_datum_t *ext,
0185                     gnutls_x509_policies_t policies,
0186                     unsigned int flags);
0187 int gnutls_x509_ext_export_policies(gnutls_x509_policies_t policies,
0188                     gnutls_datum_t *ext);
0189 
0190 int gnutls_x509_ext_import_tlsfeatures(const gnutls_datum_t *ext,
0191                        gnutls_x509_tlsfeatures_t,
0192                        unsigned int flags);
0193 
0194 int gnutls_x509_ext_export_tlsfeatures(gnutls_x509_tlsfeatures_t f,
0195                        gnutls_datum_t *ext);
0196 
0197 int gnutls_x509_tlsfeatures_add(gnutls_x509_tlsfeatures_t f,
0198                 unsigned int feature);
0199 
0200 typedef struct gnutls_x509_ct_scts_st *gnutls_x509_ct_scts_t;
0201 
0202 int gnutls_x509_ext_ct_scts_init(gnutls_x509_ct_scts_t *scts);
0203 void gnutls_x509_ext_ct_scts_deinit(gnutls_x509_ct_scts_t scts);
0204 int gnutls_x509_ext_ct_import_scts(const gnutls_datum_t *ext,
0205                    gnutls_x509_ct_scts_t scts,
0206                    unsigned int flags);
0207 int gnutls_x509_ext_ct_export_scts(const gnutls_x509_ct_scts_t scts,
0208                    gnutls_datum_t *ext);
0209 int gnutls_x509_ct_sct_get_version(const gnutls_x509_ct_scts_t scts,
0210                    unsigned idx, unsigned int *version_out);
0211 int gnutls_x509_ct_sct_get(const gnutls_x509_ct_scts_t scts, unsigned idx,
0212                time_t *timestamp, gnutls_datum_t *logid,
0213                gnutls_sign_algorithm_t *sigalg,
0214                gnutls_datum_t *signature);
0215 
0216 #ifdef __cplusplus
0217 }
0218 #endif
0219 
0220 #endif /* GNUTLS_X509_EXT_H */