File indexing completed on 2025-01-18 10:00:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #ifndef GNUTLS_X509_H
0029 #define GNUTLS_X509_H
0030
0031 #include <gnutls/gnutls.h>
0032
0033 #ifdef __cplusplus
0034 extern "C" {
0035 #endif
0036
0037
0038
0039
0040 #define GNUTLS_OID_X520_COUNTRY_NAME "2.5.4.6"
0041 #define GNUTLS_OID_X520_ORGANIZATION_NAME "2.5.4.10"
0042 #define GNUTLS_OID_X520_ORGANIZATIONAL_UNIT_NAME "2.5.4.11"
0043 #define GNUTLS_OID_X520_COMMON_NAME "2.5.4.3"
0044 #define GNUTLS_OID_X520_LOCALITY_NAME "2.5.4.7"
0045 #define GNUTLS_OID_X520_STATE_OR_PROVINCE_NAME "2.5.4.8"
0046
0047 #define GNUTLS_OID_X520_INITIALS "2.5.4.43"
0048 #define GNUTLS_OID_X520_GENERATION_QUALIFIER "2.5.4.44"
0049 #define GNUTLS_OID_X520_SURNAME "2.5.4.4"
0050 #define GNUTLS_OID_X520_GIVEN_NAME "2.5.4.42"
0051 #define GNUTLS_OID_X520_TITLE "2.5.4.12"
0052 #define GNUTLS_OID_X520_DN_QUALIFIER "2.5.4.46"
0053 #define GNUTLS_OID_X520_PSEUDONYM "2.5.4.65"
0054 #define GNUTLS_OID_X520_POSTALCODE "2.5.4.17"
0055 #define GNUTLS_OID_X520_NAME "2.5.4.41"
0056
0057 #define GNUTLS_OID_LDAP_DC "0.9.2342.19200300.100.1.25"
0058 #define GNUTLS_OID_LDAP_UID "0.9.2342.19200300.100.1.1"
0059
0060
0061
0062 #define GNUTLS_OID_PKCS9_EMAIL "1.2.840.113549.1.9.1"
0063
0064 #define GNUTLS_OID_PKIX_DATE_OF_BIRTH "1.3.6.1.5.5.7.9.1"
0065 #define GNUTLS_OID_PKIX_PLACE_OF_BIRTH "1.3.6.1.5.5.7.9.2"
0066 #define GNUTLS_OID_PKIX_GENDER "1.3.6.1.5.5.7.9.3"
0067 #define GNUTLS_OID_PKIX_COUNTRY_OF_CITIZENSHIP "1.3.6.1.5.5.7.9.4"
0068 #define GNUTLS_OID_PKIX_COUNTRY_OF_RESIDENCE "1.3.6.1.5.5.7.9.5"
0069
0070
0071
0072 #define GNUTLS_KP_TLS_WWW_SERVER "1.3.6.1.5.5.7.3.1"
0073 #define GNUTLS_KP_TLS_WWW_CLIENT "1.3.6.1.5.5.7.3.2"
0074 #define GNUTLS_KP_CODE_SIGNING "1.3.6.1.5.5.7.3.3"
0075 #define GNUTLS_KP_MS_SMART_CARD_LOGON "1.3.6.1.4.1.311.20.2.2"
0076 #define GNUTLS_KP_EMAIL_PROTECTION "1.3.6.1.5.5.7.3.4"
0077 #define GNUTLS_KP_TIME_STAMPING "1.3.6.1.5.5.7.3.8"
0078 #define GNUTLS_KP_OCSP_SIGNING "1.3.6.1.5.5.7.3.9"
0079 #define GNUTLS_KP_IPSEC_IKE "1.3.6.1.5.5.7.3.17"
0080 #define GNUTLS_KP_ANY "2.5.29.37.0"
0081
0082 #define GNUTLS_KP_FLAG_DISALLOW_ANY 1
0083
0084 #define GNUTLS_OID_AIA "1.3.6.1.5.5.7.1.1"
0085 #define GNUTLS_OID_AD_OCSP "1.3.6.1.5.5.7.48.1"
0086 #define GNUTLS_OID_AD_CAISSUERS "1.3.6.1.5.5.7.48.2"
0087
0088 #define GNUTLS_FSAN_SET 0
0089 #define GNUTLS_FSAN_APPEND 1
0090 #define GNUTLS_FSAN_ENCODE_OCTET_STRING (1 << 1)
0091 #define GNUTLS_FSAN_ENCODE_UTF8_STRING (1 << 2)
0092
0093 #define GNUTLS_X509EXT_OID_SUBJECT_KEY_ID "2.5.29.14"
0094 #define GNUTLS_X509EXT_OID_KEY_USAGE "2.5.29.15"
0095 #define GNUTLS_X509EXT_OID_PRIVATE_KEY_USAGE_PERIOD "2.5.29.16"
0096 #define GNUTLS_X509EXT_OID_SAN "2.5.29.17"
0097 #define GNUTLS_X509EXT_OID_IAN "2.5.29.18"
0098 #define GNUTLS_X509EXT_OID_BASIC_CONSTRAINTS "2.5.29.19"
0099 #define GNUTLS_X509EXT_OID_NAME_CONSTRAINTS "2.5.29.30"
0100 #define GNUTLS_X509EXT_OID_CRL_DIST_POINTS "2.5.29.31"
0101 #define GNUTLS_X509EXT_OID_CRT_POLICY "2.5.29.32"
0102 #define GNUTLS_X509EXT_OID_AUTHORITY_KEY_ID "2.5.29.35"
0103 #define GNUTLS_X509EXT_OID_EXTENDED_KEY_USAGE "2.5.29.37"
0104 #define GNUTLS_X509EXT_OID_INHIBIT_ANYPOLICY "2.5.29.52"
0105 #define GNUTLS_X509EXT_OID_AUTHORITY_INFO_ACCESS "1.3.6.1.5.5.7.1.1"
0106 #define GNUTLS_X509EXT_OID_PROXY_CRT_INFO "1.3.6.1.5.5.7.1.14"
0107 #define GNUTLS_X509EXT_OID_TLSFEATURES "1.3.6.1.5.5.7.1.24"
0108 #define GNUTLS_X509EXT_OID_CT_SCT_V1 "1.3.6.1.4.1.11129.2.4.2"
0109
0110 #define GNUTLS_X509_OID_POLICY_ANY "2.5.29.54"
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127 typedef enum gnutls_certificate_import_flags {
0128 GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED = 1,
0129 GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED = 1 << 1,
0130 GNUTLS_X509_CRT_LIST_SORT = 1 << 2
0131 } gnutls_certificate_import_flags;
0132
0133 int gnutls_x509_crt_init(gnutls_x509_crt_t *cert);
0134 void gnutls_x509_crt_deinit(gnutls_x509_crt_t cert);
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144 typedef enum gnutls_x509_crt_flags {
0145 GNUTLS_X509_CRT_FLAG_IGNORE_SANITY = 1
0146 } gnutls_x509_crt_flags;
0147 void gnutls_x509_crt_set_flags(gnutls_x509_crt_t cert, unsigned flags);
0148
0149 unsigned gnutls_x509_crt_equals(gnutls_x509_crt_t cert1,
0150 gnutls_x509_crt_t cert2);
0151 unsigned gnutls_x509_crt_equals2(gnutls_x509_crt_t cert1,
0152 const gnutls_datum_t *der);
0153
0154 int gnutls_x509_crt_import(gnutls_x509_crt_t cert, const gnutls_datum_t *data,
0155 gnutls_x509_crt_fmt_t format);
0156 int gnutls_x509_crt_list_import2(gnutls_x509_crt_t **certs, unsigned int *size,
0157 const gnutls_datum_t *data,
0158 gnutls_x509_crt_fmt_t format,
0159 unsigned int flags);
0160 int gnutls_x509_crt_list_import(gnutls_x509_crt_t *certs,
0161 unsigned int *cert_max,
0162 const gnutls_datum_t *data,
0163 gnutls_x509_crt_fmt_t format,
0164 unsigned int flags);
0165
0166 int gnutls_x509_crt_import_url(gnutls_x509_crt_t crt, const char *url,
0167 unsigned int flags
0168
0169 );
0170
0171 int gnutls_x509_crt_list_import_url(gnutls_x509_crt_t **certs,
0172 unsigned int *size, const char *url,
0173 gnutls_pin_callback_t pin_fn,
0174 void *pin_fn_userdata, unsigned int flags);
0175
0176 int gnutls_x509_crt_export(gnutls_x509_crt_t cert, gnutls_x509_crt_fmt_t format,
0177 void *output_data, size_t *output_data_size);
0178 int gnutls_x509_crt_export2(gnutls_x509_crt_t cert,
0179 gnutls_x509_crt_fmt_t format, gnutls_datum_t *out);
0180 int gnutls_x509_crt_get_private_key_usage_period(gnutls_x509_crt_t cert,
0181 time_t *activation,
0182 time_t *expiration,
0183 unsigned int *critical);
0184
0185 int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt_t cert, char *buf,
0186 size_t *buf_size);
0187 int gnutls_x509_crt_get_issuer_dn2(gnutls_x509_crt_t cert, gnutls_datum_t *dn);
0188 int gnutls_x509_crt_get_issuer_dn3(gnutls_x509_crt_t cert, gnutls_datum_t *dn,
0189 unsigned flags);
0190 int gnutls_x509_crt_get_issuer_dn_oid(gnutls_x509_crt_t cert, unsigned indx,
0191 void *oid, size_t *oid_size);
0192 int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt_t cert,
0193 const char *oid, unsigned indx,
0194 unsigned int raw_flag, void *buf,
0195 size_t *buf_size);
0196
0197 int gnutls_x509_crt_get_dn(gnutls_x509_crt_t cert, char *buf, size_t *buf_size);
0198 int gnutls_x509_crt_get_dn2(gnutls_x509_crt_t cert, gnutls_datum_t *dn);
0199 int gnutls_x509_crt_get_dn3(gnutls_x509_crt_t cert, gnutls_datum_t *dn,
0200 unsigned flags);
0201
0202 int gnutls_x509_crt_get_dn_oid(gnutls_x509_crt_t cert, unsigned indx, void *oid,
0203 size_t *oid_size);
0204 int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt_t cert, const char *oid,
0205 unsigned indx, unsigned int raw_flag,
0206 void *buf, size_t *buf_size);
0207 unsigned gnutls_x509_crt_check_hostname(gnutls_x509_crt_t cert,
0208 const char *hostname);
0209 unsigned gnutls_x509_crt_check_hostname2(gnutls_x509_crt_t cert,
0210 const char *hostname,
0211 unsigned int flags);
0212 unsigned gnutls_x509_crt_check_email(gnutls_x509_crt_t cert, const char *email,
0213 unsigned int flags);
0214
0215 unsigned gnutls_x509_crt_check_ip(gnutls_x509_crt_t cert,
0216 const unsigned char *ip, unsigned int ip_size,
0217 unsigned int flags);
0218
0219 int gnutls_x509_crt_get_signature_algorithm(gnutls_x509_crt_t cert);
0220 int gnutls_x509_crt_get_signature(gnutls_x509_crt_t cert, char *sig,
0221 size_t *sizeof_sig);
0222 int gnutls_x509_crt_get_version(gnutls_x509_crt_t cert);
0223
0224 int gnutls_x509_crt_get_pk_oid(gnutls_x509_crt_t cert, char *oid,
0225 size_t *oid_size);
0226 int gnutls_x509_crt_get_signature_oid(gnutls_x509_crt_t cert, char *oid,
0227 size_t *oid_size);
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239 typedef enum {
0240 GNUTLS_KEYID_USE_SHA1 = 0,
0241 GNUTLS_KEYID_USE_SHA256 = (1 << 0),
0242 GNUTLS_KEYID_USE_SHA512 = (1 << 1),
0243 GNUTLS_KEYID_USE_BEST_KNOWN = (1 << 30)
0244 } gnutls_keyid_flags_t;
0245 int gnutls_x509_crt_get_key_id(gnutls_x509_crt_t crt, unsigned int flags,
0246 unsigned char *output_data,
0247 size_t *output_data_size);
0248
0249 int gnutls_x509_crt_set_private_key_usage_period(gnutls_x509_crt_t crt,
0250 time_t activation,
0251 time_t expiration);
0252 int gnutls_x509_crt_set_authority_key_id(gnutls_x509_crt_t cert, const void *id,
0253 size_t id_size);
0254 int gnutls_x509_crt_get_authority_key_id(gnutls_x509_crt_t cert, void *id,
0255 size_t *id_size,
0256 unsigned int *critical);
0257 int gnutls_x509_crt_get_authority_key_gn_serial(
0258 gnutls_x509_crt_t cert, unsigned int seq, void *alt, size_t *alt_size,
0259 unsigned int *alt_type, void *serial, size_t *serial_size,
0260 unsigned int *critical);
0261
0262 int gnutls_x509_crt_get_subject_key_id(gnutls_x509_crt_t cert, void *ret,
0263 size_t *ret_size,
0264 unsigned int *critical);
0265
0266 int gnutls_x509_crt_get_subject_unique_id(gnutls_x509_crt_t crt, char *buf,
0267 size_t *buf_size);
0268
0269 int gnutls_x509_crt_get_issuer_unique_id(gnutls_x509_crt_t crt, char *buf,
0270 size_t *buf_size);
0271
0272 void gnutls_x509_crt_set_pin_function(gnutls_x509_crt_t crt,
0273 gnutls_pin_callback_t fn, void *userdata);
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286 typedef enum gnutls_info_access_what_t {
0287 GNUTLS_IA_ACCESSMETHOD_OID = 1,
0288 GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE = 2,
0289
0290 GNUTLS_IA_URI = 106,
0291
0292 GNUTLS_IA_UNKNOWN = 10000,
0293 GNUTLS_IA_OCSP_URI = 10006,
0294 GNUTLS_IA_CAISSUERS_URI = 10106
0295 } gnutls_info_access_what_t;
0296
0297 int gnutls_x509_crt_get_authority_info_access(gnutls_x509_crt_t crt,
0298 unsigned int seq, int what,
0299 gnutls_datum_t *data,
0300 unsigned int *critical);
0301
0302 typedef struct gnutls_name_constraints_st *gnutls_x509_name_constraints_t;
0303
0304 unsigned gnutls_x509_name_constraints_check(gnutls_x509_name_constraints_t nc,
0305 gnutls_x509_subject_alt_name_t type,
0306 const gnutls_datum_t *name);
0307 unsigned
0308 gnutls_x509_name_constraints_check_crt(gnutls_x509_name_constraints_t nc,
0309 gnutls_x509_subject_alt_name_t type,
0310 gnutls_x509_crt_t crt);
0311
0312 int gnutls_x509_name_constraints_init(gnutls_x509_name_constraints_t *nc);
0313 void gnutls_x509_name_constraints_deinit(gnutls_x509_name_constraints_t nc);
0314
0315 #define GNUTLS_EXT_FLAG_APPEND 1
0316
0317 #define GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND GNUTLS_EXT_FLAG_APPEND
0318 int gnutls_x509_crt_get_name_constraints(gnutls_x509_crt_t crt,
0319 gnutls_x509_name_constraints_t nc,
0320 unsigned int flags,
0321 unsigned int *critical);
0322 int gnutls_x509_name_constraints_add_permitted(
0323 gnutls_x509_name_constraints_t nc, gnutls_x509_subject_alt_name_t type,
0324 const gnutls_datum_t *name);
0325 int gnutls_x509_name_constraints_add_excluded(
0326 gnutls_x509_name_constraints_t nc, gnutls_x509_subject_alt_name_t type,
0327 const gnutls_datum_t *name);
0328 int gnutls_x509_crt_set_name_constraints(gnutls_x509_crt_t crt,
0329 gnutls_x509_name_constraints_t nc,
0330 unsigned int critical);
0331 int gnutls_x509_name_constraints_get_permitted(gnutls_x509_name_constraints_t nc,
0332 unsigned idx, unsigned *type,
0333 gnutls_datum_t *name);
0334 int gnutls_x509_name_constraints_get_excluded(gnutls_x509_name_constraints_t nc,
0335 unsigned idx, unsigned *type,
0336 gnutls_datum_t *name);
0337 int gnutls_x509_cidr_to_rfc5280(const char *cidr, gnutls_datum_t *cidr_rfc5280);
0338
0339 #define GNUTLS_CRL_REASON_SUPERSEEDED GNUTLS_CRL_REASON_SUPERSEDED,
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354 typedef enum gnutls_x509_crl_reason_flags_t {
0355 GNUTLS_CRL_REASON_UNSPECIFIED = 0,
0356 GNUTLS_CRL_REASON_PRIVILEGE_WITHDRAWN = 1,
0357 GNUTLS_CRL_REASON_CERTIFICATE_HOLD = 2,
0358 GNUTLS_CRL_REASON_CESSATION_OF_OPERATION = 4,
0359 GNUTLS_CRL_REASON_SUPERSEDED = 8,
0360 GNUTLS_CRL_REASON_AFFILIATION_CHANGED = 16,
0361 GNUTLS_CRL_REASON_CA_COMPROMISE = 32,
0362 GNUTLS_CRL_REASON_KEY_COMPROMISE = 64,
0363 GNUTLS_CRL_REASON_UNUSED = 128,
0364 GNUTLS_CRL_REASON_AA_COMPROMISE = 32768
0365 } gnutls_x509_crl_reason_flags_t;
0366
0367 int gnutls_x509_crt_get_crl_dist_points(gnutls_x509_crt_t cert,
0368 unsigned int seq, void *ret,
0369 size_t *ret_size,
0370 unsigned int *reason_flags,
0371 unsigned int *critical);
0372 int gnutls_x509_crt_set_crl_dist_points2(gnutls_x509_crt_t crt,
0373 gnutls_x509_subject_alt_name_t type,
0374 const void *data,
0375 unsigned int data_size,
0376 unsigned int reason_flags);
0377 int gnutls_x509_crt_set_crl_dist_points(gnutls_x509_crt_t crt,
0378 gnutls_x509_subject_alt_name_t type,
0379 const void *data_string,
0380 unsigned int reason_flags);
0381 int gnutls_x509_crt_cpy_crl_dist_points(gnutls_x509_crt_t dst,
0382 gnutls_x509_crt_t src);
0383
0384 int gnutls_x509_crl_sign(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer,
0385 gnutls_x509_privkey_t issuer_key);
0386
0387 int gnutls_x509_crl_sign2(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer,
0388 gnutls_x509_privkey_t issuer_key,
0389 gnutls_digest_algorithm_t dig, unsigned int flags);
0390
0391 time_t gnutls_x509_crt_get_activation_time(gnutls_x509_crt_t cert);
0392
0393
0394 #define GNUTLS_X509_NO_WELL_DEFINED_EXPIRATION ((time_t)4294197631)
0395
0396 time_t gnutls_x509_crt_get_expiration_time(gnutls_x509_crt_t cert);
0397 int gnutls_x509_crt_get_serial(gnutls_x509_crt_t cert, void *result,
0398 size_t *result_size);
0399
0400 typedef struct gnutls_x509_spki_st *gnutls_x509_spki_t;
0401
0402 int gnutls_x509_spki_init(gnutls_x509_spki_t *spki);
0403 void gnutls_x509_spki_deinit(gnutls_x509_spki_t spki);
0404
0405 int gnutls_x509_spki_get_rsa_pss_params(gnutls_x509_spki_t spki,
0406 gnutls_digest_algorithm_t *dig,
0407 unsigned int *salt_size);
0408
0409 void gnutls_x509_spki_set_rsa_pss_params(gnutls_x509_spki_t spki,
0410 gnutls_digest_algorithm_t dig,
0411 unsigned int salt_size);
0412
0413 int gnutls_x509_crt_get_pk_algorithm(gnutls_x509_crt_t cert,
0414 unsigned int *bits);
0415 int gnutls_x509_crt_set_spki(gnutls_x509_crt_t crt,
0416 const gnutls_x509_spki_t spki, unsigned int flags);
0417 int gnutls_x509_crt_get_spki(gnutls_x509_crt_t cert, gnutls_x509_spki_t spki,
0418 unsigned int flags);
0419
0420 int gnutls_x509_crt_get_pk_rsa_raw(gnutls_x509_crt_t crt, gnutls_datum_t *m,
0421 gnutls_datum_t *e);
0422 int gnutls_x509_crt_get_pk_dsa_raw(gnutls_x509_crt_t crt, gnutls_datum_t *p,
0423 gnutls_datum_t *q, gnutls_datum_t *g,
0424 gnutls_datum_t *y);
0425 int gnutls_x509_crt_get_pk_ecc_raw(gnutls_x509_crt_t crt,
0426 gnutls_ecc_curve_t *curve, gnutls_datum_t *x,
0427 gnutls_datum_t *y);
0428 int gnutls_x509_crt_get_pk_gost_raw(gnutls_x509_crt_t crt,
0429 gnutls_ecc_curve_t *curve,
0430 gnutls_digest_algorithm_t *digest,
0431 gnutls_gost_paramset_t *paramset,
0432 gnutls_datum_t *x, gnutls_datum_t *y);
0433
0434 int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt_t cert,
0435 unsigned int seq, void *san,
0436 size_t *san_size,
0437 unsigned int *critical);
0438 int gnutls_x509_crt_get_subject_alt_name2(gnutls_x509_crt_t cert,
0439 unsigned int seq, void *san,
0440 size_t *san_size,
0441 unsigned int *san_type,
0442 unsigned int *critical);
0443
0444 int gnutls_x509_crt_get_subject_alt_othername_oid(gnutls_x509_crt_t cert,
0445 unsigned int seq, void *oid,
0446 size_t *oid_size);
0447
0448 int gnutls_x509_crt_get_issuer_alt_name(gnutls_x509_crt_t cert,
0449 unsigned int seq, void *ian,
0450 size_t *ian_size,
0451 unsigned int *critical);
0452 int gnutls_x509_crt_get_issuer_alt_name2(gnutls_x509_crt_t cert,
0453 unsigned int seq, void *ian,
0454 size_t *ian_size,
0455 unsigned int *ian_type,
0456 unsigned int *critical);
0457
0458 int gnutls_x509_crt_get_issuer_alt_othername_oid(gnutls_x509_crt_t cert,
0459 unsigned int seq, void *ret,
0460 size_t *ret_size);
0461
0462 int gnutls_x509_crt_get_ca_status(gnutls_x509_crt_t cert,
0463 unsigned int *critical);
0464 int gnutls_x509_crt_get_basic_constraints(gnutls_x509_crt_t cert,
0465 unsigned int *critical,
0466 unsigned int *ca, int *pathlen);
0467
0468
0469
0470
0471 int gnutls_x509_crt_get_key_usage(gnutls_x509_crt_t cert,
0472 unsigned int *key_usage,
0473 unsigned int *critical);
0474 int gnutls_x509_crt_set_key_usage(gnutls_x509_crt_t crt, unsigned int usage);
0475 int gnutls_x509_crt_set_authority_info_access(gnutls_x509_crt_t crt, int what,
0476 gnutls_datum_t *data);
0477
0478 int gnutls_x509_crt_get_inhibit_anypolicy(gnutls_x509_crt_t cert,
0479 unsigned int *skipcerts,
0480 unsigned int *critical);
0481 int gnutls_x509_crt_set_inhibit_anypolicy(gnutls_x509_crt_t crt,
0482 unsigned int skipcerts);
0483
0484 int gnutls_x509_crt_get_proxy(gnutls_x509_crt_t cert, unsigned int *critical,
0485 int *pathlen, char **policyLanguage,
0486 char **policy, size_t *sizeof_policy);
0487
0488 typedef struct gnutls_x509_tlsfeatures_st *gnutls_x509_tlsfeatures_t;
0489
0490 int gnutls_x509_tlsfeatures_init(gnutls_x509_tlsfeatures_t *features);
0491 void gnutls_x509_tlsfeatures_deinit(gnutls_x509_tlsfeatures_t);
0492 int gnutls_x509_tlsfeatures_get(gnutls_x509_tlsfeatures_t f, unsigned idx,
0493 unsigned int *feature);
0494
0495 int gnutls_x509_crt_set_tlsfeatures(gnutls_x509_crt_t crt,
0496 gnutls_x509_tlsfeatures_t features);
0497
0498 int gnutls_x509_crt_get_tlsfeatures(gnutls_x509_crt_t cert,
0499 gnutls_x509_tlsfeatures_t features,
0500 unsigned int flags, unsigned int *critical);
0501
0502 unsigned gnutls_x509_tlsfeatures_check_crt(gnutls_x509_tlsfeatures_t feat,
0503 gnutls_x509_crt_t crt);
0504
0505 #define GNUTLS_MAX_QUALIFIERS 8
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515 typedef enum gnutls_x509_qualifier_t {
0516 GNUTLS_X509_QUALIFIER_UNKNOWN = 0,
0517 GNUTLS_X509_QUALIFIER_URI,
0518 GNUTLS_X509_QUALIFIER_NOTICE
0519 } gnutls_x509_qualifier_t;
0520
0521 typedef struct gnutls_x509_policy_st {
0522 char *oid;
0523 unsigned int qualifiers;
0524 struct {
0525 gnutls_x509_qualifier_t type;
0526 char *data;
0527 unsigned int size;
0528 } qualifier[GNUTLS_MAX_QUALIFIERS];
0529 } gnutls_x509_policy_st;
0530
0531 void gnutls_x509_policy_release(struct gnutls_x509_policy_st *policy);
0532 int gnutls_x509_crt_get_policy(gnutls_x509_crt_t crt, unsigned indx,
0533 struct gnutls_x509_policy_st *policy,
0534 unsigned int *critical);
0535 int gnutls_x509_crt_set_policy(gnutls_x509_crt_t crt,
0536 const struct gnutls_x509_policy_st *policy,
0537 unsigned int critical);
0538
0539 int gnutls_x509_dn_oid_known(const char *oid);
0540
0541 #define GNUTLS_X509_DN_OID_RETURN_OID 1
0542 const char *gnutls_x509_dn_oid_name(const char *oid, unsigned int flags);
0543
0544
0545 int gnutls_x509_crt_get_extension_oid(gnutls_x509_crt_t cert, unsigned indx,
0546 void *oid, size_t *oid_size);
0547 int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt_t cert,
0548 const char *oid, unsigned indx,
0549 void *buf, size_t *buf_size,
0550 unsigned int *critical);
0551
0552 int gnutls_x509_crq_get_signature_algorithm(gnutls_x509_crq_t crq);
0553 int gnutls_x509_crq_get_extension_by_oid2(gnutls_x509_crq_t crq,
0554 const char *oid, unsigned indx,
0555 gnutls_datum_t *output,
0556 unsigned int *critical);
0557
0558
0559 int gnutls_x509_crt_get_extension_info(gnutls_x509_crt_t cert, unsigned indx,
0560 void *oid, size_t *oid_size,
0561 unsigned int *critical);
0562 int gnutls_x509_crt_get_extension_data(gnutls_x509_crt_t cert, unsigned indx,
0563 void *data, size_t *sizeof_data);
0564 int gnutls_x509_crt_get_extension_data2(gnutls_x509_crt_t cert, unsigned indx,
0565 gnutls_datum_t *data);
0566
0567 int gnutls_x509_crt_set_extension_by_oid(gnutls_x509_crt_t crt, const char *oid,
0568 const void *buf, size_t sizeof_buf,
0569 unsigned int critical);
0570
0571
0572
0573 int gnutls_x509_crt_set_dn(gnutls_x509_crt_t crt, const char *dn,
0574 const char **err);
0575
0576 int gnutls_x509_crt_set_dn_by_oid(gnutls_x509_crt_t crt, const char *oid,
0577 unsigned int raw_flag, const void *name,
0578 unsigned int sizeof_name);
0579 int gnutls_x509_crt_set_issuer_dn_by_oid(gnutls_x509_crt_t crt, const char *oid,
0580 unsigned int raw_flag,
0581 const void *name,
0582 unsigned int sizeof_name);
0583 int gnutls_x509_crt_set_issuer_dn(gnutls_x509_crt_t crt, const char *dn,
0584 const char **err);
0585
0586 int gnutls_x509_crt_set_version(gnutls_x509_crt_t crt, unsigned int version);
0587 int gnutls_x509_crt_set_key(gnutls_x509_crt_t crt, gnutls_x509_privkey_t key);
0588 int gnutls_x509_crt_set_ca_status(gnutls_x509_crt_t crt, unsigned int ca);
0589 int gnutls_x509_crt_set_basic_constraints(gnutls_x509_crt_t crt,
0590 unsigned int ca,
0591 int pathLenConstraint);
0592
0593 int gnutls_x509_crt_set_subject_unique_id(gnutls_x509_crt_t cert,
0594 const void *id, size_t id_size);
0595 int gnutls_x509_crt_set_issuer_unique_id(gnutls_x509_crt_t cert, const void *id,
0596 size_t id_size);
0597
0598 int gnutls_x509_crt_set_subject_alternative_name(
0599 gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t type,
0600 const char *data_string);
0601 int gnutls_x509_crt_set_subject_alt_name(gnutls_x509_crt_t crt,
0602 gnutls_x509_subject_alt_name_t type,
0603 const void *data,
0604 unsigned int data_size,
0605 unsigned int flags);
0606
0607 int gnutls_x509_crt_set_subject_alt_othername(gnutls_x509_crt_t crt,
0608 const char *oid, const void *data,
0609 unsigned int data_size,
0610 unsigned int flags);
0611
0612 int gnutls_x509_crt_set_issuer_alt_name(gnutls_x509_crt_t crt,
0613 gnutls_x509_subject_alt_name_t type,
0614 const void *data,
0615 unsigned int data_size,
0616 unsigned int flags);
0617
0618 int gnutls_x509_crt_set_issuer_alt_othername(gnutls_x509_crt_t crt,
0619 const char *oid, const void *data,
0620 unsigned int data_size,
0621 unsigned int flags);
0622
0623 int gnutls_x509_crt_sign(gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer,
0624 gnutls_x509_privkey_t issuer_key);
0625 int gnutls_x509_crt_sign2(gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer,
0626 gnutls_x509_privkey_t issuer_key,
0627 gnutls_digest_algorithm_t dig, unsigned int flags);
0628 int gnutls_x509_crt_set_activation_time(gnutls_x509_crt_t cert,
0629 time_t act_time);
0630 int gnutls_x509_crt_set_expiration_time(gnutls_x509_crt_t cert,
0631 time_t exp_time);
0632 int gnutls_x509_crt_set_serial(gnutls_x509_crt_t cert, const void *serial,
0633 size_t serial_size);
0634
0635 int gnutls_x509_crt_set_subject_key_id(gnutls_x509_crt_t cert, const void *id,
0636 size_t id_size);
0637
0638 int gnutls_x509_crt_set_proxy_dn(gnutls_x509_crt_t crt, gnutls_x509_crt_t eecrt,
0639 unsigned int raw_flag, const void *name,
0640 unsigned int sizeof_name);
0641 int gnutls_x509_crt_set_proxy(gnutls_x509_crt_t crt, int pathLenConstraint,
0642 const char *policyLanguage, const char *policy,
0643 size_t sizeof_policy);
0644
0645 int gnutls_x509_crt_print(gnutls_x509_crt_t cert,
0646 gnutls_certificate_print_formats_t format,
0647 gnutls_datum_t *out);
0648 int gnutls_x509_crl_print(gnutls_x509_crl_t crl,
0649 gnutls_certificate_print_formats_t format,
0650 gnutls_datum_t *out);
0651
0652
0653
0654 int gnutls_x509_crt_get_raw_issuer_dn(gnutls_x509_crt_t cert,
0655 gnutls_datum_t *start);
0656 int gnutls_x509_crt_get_raw_dn(gnutls_x509_crt_t cert, gnutls_datum_t *start);
0657
0658
0659
0660 int gnutls_x509_rdn_get(const gnutls_datum_t *idn, char *buf,
0661 size_t *sizeof_buf);
0662 int gnutls_x509_rdn_get2(const gnutls_datum_t *idn, gnutls_datum_t *str,
0663 unsigned flags);
0664
0665 int gnutls_x509_rdn_get_oid(const gnutls_datum_t *idn, unsigned indx, void *buf,
0666 size_t *sizeof_buf);
0667
0668 int gnutls_x509_rdn_get_by_oid(const gnutls_datum_t *idn, const char *oid,
0669 unsigned indx, unsigned int raw_flag, void *buf,
0670 size_t *sizeof_buf);
0671
0672 typedef struct gnutls_x509_dn_st *gnutls_x509_dn_t;
0673
0674 typedef struct gnutls_x509_ava_st {
0675 gnutls_datum_t oid;
0676 gnutls_datum_t value;
0677 unsigned long value_tag;
0678 } gnutls_x509_ava_st;
0679
0680 int gnutls_x509_crt_get_subject(gnutls_x509_crt_t cert, gnutls_x509_dn_t *dn);
0681 int gnutls_x509_crt_get_issuer(gnutls_x509_crt_t cert, gnutls_x509_dn_t *dn);
0682 int gnutls_x509_dn_get_rdn_ava(gnutls_x509_dn_t dn, int irdn, int iava,
0683 gnutls_x509_ava_st *ava);
0684
0685 int gnutls_x509_dn_get_str(gnutls_x509_dn_t dn, gnutls_datum_t *str);
0686
0687 #define GNUTLS_X509_DN_FLAG_COMPAT 1
0688 int gnutls_x509_dn_get_str2(gnutls_x509_dn_t dn, gnutls_datum_t *str,
0689 unsigned flags);
0690
0691 int gnutls_x509_dn_set_str(gnutls_x509_dn_t dn, const char *str,
0692 const char **err);
0693
0694 int gnutls_x509_dn_init(gnutls_x509_dn_t *dn);
0695
0696 int gnutls_x509_dn_import(gnutls_x509_dn_t dn, const gnutls_datum_t *data);
0697
0698 int gnutls_x509_dn_export(gnutls_x509_dn_t dn, gnutls_x509_crt_fmt_t format,
0699 void *output_data, size_t *output_data_size);
0700 int gnutls_x509_dn_export2(gnutls_x509_dn_t dn, gnutls_x509_crt_fmt_t format,
0701 gnutls_datum_t *out);
0702
0703 void gnutls_x509_dn_deinit(gnutls_x509_dn_t dn);
0704
0705
0706
0707 int gnutls_x509_crl_init(gnutls_x509_crl_t *crl);
0708 void gnutls_x509_crl_deinit(gnutls_x509_crl_t crl);
0709
0710 int gnutls_x509_crl_import(gnutls_x509_crl_t crl, const gnutls_datum_t *data,
0711 gnutls_x509_crt_fmt_t format);
0712 int gnutls_x509_crl_export(gnutls_x509_crl_t crl, gnutls_x509_crt_fmt_t format,
0713 void *output_data, size_t *output_data_size);
0714 int gnutls_x509_crl_export2(gnutls_x509_crl_t crl, gnutls_x509_crt_fmt_t format,
0715 gnutls_datum_t *out);
0716
0717 int gnutls_x509_crl_get_raw_issuer_dn(gnutls_x509_crl_t crl,
0718 gnutls_datum_t *dn);
0719
0720 int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl_t crl, char *buf,
0721 size_t *sizeof_buf);
0722 int gnutls_x509_crl_get_issuer_dn2(gnutls_x509_crl_t crl, gnutls_datum_t *dn);
0723 int gnutls_x509_crl_get_issuer_dn3(gnutls_x509_crl_t crl, gnutls_datum_t *dn,
0724 unsigned flags);
0725
0726 int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl_t crl, const char *oid,
0727 unsigned indx, unsigned int raw_flag,
0728 void *buf, size_t *sizeof_buf);
0729 int gnutls_x509_crl_get_dn_oid(gnutls_x509_crl_t crl, unsigned indx, void *oid,
0730 size_t *sizeof_oid);
0731
0732 int gnutls_x509_crl_get_signature_algorithm(gnutls_x509_crl_t crl);
0733 int gnutls_x509_crl_get_signature(gnutls_x509_crl_t crl, char *sig,
0734 size_t *sizeof_sig);
0735 int gnutls_x509_crl_get_version(gnutls_x509_crl_t crl);
0736
0737 int gnutls_x509_crl_get_signature_oid(gnutls_x509_crl_t crl, char *oid,
0738 size_t *oid_size);
0739
0740 time_t gnutls_x509_crl_get_this_update(gnutls_x509_crl_t crl);
0741 time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl_t crl);
0742
0743 int gnutls_x509_crl_get_crt_count(gnutls_x509_crl_t crl);
0744 int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl_t crl, unsigned indx,
0745 unsigned char *serial, size_t *serial_size,
0746 time_t *t);
0747
0748 typedef struct gnutls_x509_crl_iter *gnutls_x509_crl_iter_t;
0749
0750 int gnutls_x509_crl_iter_crt_serial(gnutls_x509_crl_t crl,
0751 gnutls_x509_crl_iter_t *,
0752 unsigned char *serial, size_t *serial_size,
0753 time_t *t);
0754
0755 void gnutls_x509_crl_iter_deinit(gnutls_x509_crl_iter_t);
0756
0757 #define gnutls_x509_crl_get_certificate_count gnutls_x509_crl_get_crt_count
0758 #define gnutls_x509_crl_get_certificate gnutls_x509_crl_get_crt_serial
0759
0760 unsigned gnutls_x509_crl_check_issuer(gnutls_x509_crl_t crl,
0761 gnutls_x509_crt_t issuer);
0762
0763 int gnutls_x509_crl_list_import2(gnutls_x509_crl_t **crls, unsigned int *size,
0764 const gnutls_datum_t *data,
0765 gnutls_x509_crt_fmt_t format,
0766 unsigned int flags);
0767
0768 int gnutls_x509_crl_list_import(gnutls_x509_crl_t *crls, unsigned int *crl_max,
0769 const gnutls_datum_t *data,
0770 gnutls_x509_crt_fmt_t format,
0771 unsigned int flags);
0772
0773
0774 int gnutls_x509_crl_set_version(gnutls_x509_crl_t crl, unsigned int version);
0775 int gnutls_x509_crl_set_this_update(gnutls_x509_crl_t crl, time_t act_time);
0776 int gnutls_x509_crl_set_next_update(gnutls_x509_crl_t crl, time_t exp_time);
0777 int gnutls_x509_crl_set_crt_serial(gnutls_x509_crl_t crl, const void *serial,
0778 size_t serial_size, time_t revocation_time);
0779 int gnutls_x509_crl_set_crt(gnutls_x509_crl_t crl, gnutls_x509_crt_t crt,
0780 time_t revocation_time);
0781
0782 int gnutls_x509_crl_get_authority_key_id(gnutls_x509_crl_t crl, void *id,
0783 size_t *id_size,
0784 unsigned int *critical);
0785 int gnutls_x509_crl_get_authority_key_gn_serial(
0786 gnutls_x509_crl_t crl, unsigned int seq, void *alt, size_t *alt_size,
0787 unsigned int *alt_type, void *serial, size_t *serial_size,
0788 unsigned int *critical);
0789
0790 int gnutls_x509_crl_get_number(gnutls_x509_crl_t crl, void *ret,
0791 size_t *ret_size, unsigned int *critical);
0792
0793 int gnutls_x509_crl_get_extension_oid(gnutls_x509_crl_t crl, unsigned indx,
0794 void *oid, size_t *sizeof_oid);
0795
0796 int gnutls_x509_crl_get_extension_info(gnutls_x509_crl_t crl, unsigned indx,
0797 void *oid, size_t *sizeof_oid,
0798 unsigned int *critical);
0799
0800 int gnutls_x509_crl_get_extension_data(gnutls_x509_crl_t crl, unsigned indx,
0801 void *data, size_t *sizeof_data);
0802 int gnutls_x509_crl_get_extension_data2(gnutls_x509_crl_t crl, unsigned indx,
0803 gnutls_datum_t *data);
0804
0805 int gnutls_x509_crl_set_authority_key_id(gnutls_x509_crl_t crl, const void *id,
0806 size_t id_size);
0807
0808 int gnutls_x509_crl_set_number(gnutls_x509_crl_t crl, const void *nr,
0809 size_t nr_size);
0810
0811
0812
0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827
0828
0829
0830
0831
0832
0833
0834
0835
0836
0837
0838
0839
0840
0841
0842
0843
0844
0845
0846
0847
0848
0849
0850
0851
0852
0853
0854
0855
0856
0857
0858
0859
0860
0861
0862
0863
0864
0865
0866 typedef enum gnutls_certificate_verify_flags {
0867 GNUTLS_VERIFY_DISABLE_CA_SIGN = 1 << 0,
0868 GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES = 1 << 1,
0869 GNUTLS_VERIFY_DO_NOT_ALLOW_SAME = 1 << 2,
0870 GNUTLS_VERIFY_ALLOW_ANY_X509_V1_CA_CRT = 1 << 3,
0871 GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2 = 1 << 4,
0872 GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5 = 1 << 5,
0873 GNUTLS_VERIFY_DISABLE_TIME_CHECKS = 1 << 6,
0874 GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS = 1 << 7,
0875 GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT = 1 << 8,
0876 GNUTLS_VERIFY_DISABLE_CRL_CHECKS = 1 << 9,
0877 GNUTLS_VERIFY_ALLOW_UNSORTED_CHAIN = 1 << 10,
0878 GNUTLS_VERIFY_DO_NOT_ALLOW_UNSORTED_CHAIN = 1 << 11,
0879 GNUTLS_VERIFY_DO_NOT_ALLOW_WILDCARDS = 1 << 12,
0880 GNUTLS_VERIFY_USE_TLS1_RSA = 1 << 13,
0881 GNUTLS_VERIFY_IGNORE_UNKNOWN_CRIT_EXTENSIONS = 1 << 14,
0882 GNUTLS_VERIFY_ALLOW_SIGN_WITH_SHA1 = 1 << 15,
0883 GNUTLS_VERIFY_RSA_PSS_FIXED_SALT_LENGTH = 1 << 16
0884
0885 } gnutls_certificate_verify_flags;
0886
0887 #define GNUTLS_VERIFY_ALLOW_BROKEN \
0888 (GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2 | GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5)
0889
0890
0891
0892
0893
0894
0895
0896
0897
0898
0899
0900
0901
0902
0903
0904
0905
0906
0907
0908
0909
0910
0911
0912
0913
0914 typedef enum gnutls_certificate_verification_profiles_t {
0915 GNUTLS_PROFILE_UNKNOWN = 0,
0916 GNUTLS_PROFILE_VERY_WEAK = 1,
0917 GNUTLS_PROFILE_LOW = 2,
0918 GNUTLS_PROFILE_LEGACY = 4,
0919 GNUTLS_PROFILE_MEDIUM = 5,
0920 GNUTLS_PROFILE_HIGH = 6,
0921 GNUTLS_PROFILE_ULTRA = 7,
0922 GNUTLS_PROFILE_FUTURE = 8,
0923
0924 GNUTLS_PROFILE_SUITEB128 = 32,
0925 GNUTLS_PROFILE_SUITEB192 = 33
0926
0927 } gnutls_certificate_verification_profiles_t;
0928
0929 #define GNUTLS_PROFILE_TO_VFLAGS(x) (((unsigned)x) << 24)
0930
0931 #define GNUTLS_VFLAGS_PROFILE_MASK (0xff000000)
0932
0933 #define GNUTLS_VFLAGS_TO_PROFILE(x) ((((unsigned)x) >> 24) & 0xff)
0934
0935 const char *gnutls_certificate_verification_profile_get_name(
0936 gnutls_certificate_verification_profiles_t id) __GNUTLS_CONST__;
0937 gnutls_certificate_verification_profiles_t
0938 gnutls_certificate_verification_profile_get_id(const char *name)
0939 __GNUTLS_CONST__;
0940
0941 unsigned gnutls_x509_crt_check_issuer(gnutls_x509_crt_t cert,
0942 gnutls_x509_crt_t issuer);
0943
0944 int gnutls_x509_crt_list_verify(const gnutls_x509_crt_t *cert_list,
0945 unsigned cert_list_length,
0946 const gnutls_x509_crt_t *CA_list,
0947 unsigned CA_list_length,
0948 const gnutls_x509_crl_t *CRL_list,
0949 unsigned CRL_list_length, unsigned int flags,
0950 unsigned int *verify);
0951
0952 int gnutls_x509_crt_verify(gnutls_x509_crt_t cert,
0953 const gnutls_x509_crt_t *CA_list,
0954 unsigned CA_list_length, unsigned int flags,
0955 unsigned int *verify);
0956 int gnutls_x509_crl_verify(gnutls_x509_crl_t crl,
0957 const gnutls_x509_crt_t *CA_list,
0958 unsigned CA_list_length, unsigned int flags,
0959 unsigned int *verify);
0960
0961 int gnutls_x509_crt_verify_data2(gnutls_x509_crt_t crt,
0962 gnutls_sign_algorithm_t algo,
0963 unsigned int flags, const gnutls_datum_t *data,
0964 const gnutls_datum_t *signature);
0965
0966 int gnutls_x509_crt_check_revocation(gnutls_x509_crt_t cert,
0967 const gnutls_x509_crl_t *crl_list,
0968 unsigned crl_list_length);
0969
0970 int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt_t cert,
0971 gnutls_digest_algorithm_t algo, void *buf,
0972 size_t *buf_size);
0973
0974 int gnutls_x509_crt_get_key_purpose_oid(gnutls_x509_crt_t cert, unsigned indx,
0975 void *oid, size_t *oid_size,
0976 unsigned int *critical);
0977 int gnutls_x509_crt_set_key_purpose_oid(gnutls_x509_crt_t cert, const void *oid,
0978 unsigned int critical);
0979
0980 unsigned gnutls_x509_crt_check_key_purpose(gnutls_x509_crt_t cert,
0981 const char *purpose, unsigned flags);
0982
0983
0984
0985
0986
0987
0988
0989 #define GNUTLS_PKCS8_PLAIN GNUTLS_PKCS_PLAIN
0990 #define GNUTLS_PKCS8_USE_PKCS12_3DES GNUTLS_PKCS_PKCS12_3DES
0991 #define GNUTLS_PKCS8_USE_PKCS12_ARCFOUR GNUTLS_PKCS_PKCS12_ARCFOUR
0992 #define GNUTLS_PKCS8_USE_PKCS12_RC2_40 GNUTLS_PKCS_PKCS12_RC2_40
0993
0994
0995
0996
0997
0998
0999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015 typedef enum gnutls_pkcs_encrypt_flags_t {
1016 GNUTLS_PKCS_PLAIN = 1,
1017 GNUTLS_PKCS_PKCS12_3DES = 1 << 1,
1018 GNUTLS_PKCS_PKCS12_ARCFOUR = 1 << 2,
1019 GNUTLS_PKCS_PKCS12_RC2_40 = 1 << 3,
1020 GNUTLS_PKCS_PBES2_3DES = 1 << 4,
1021 GNUTLS_PKCS_PBES2_AES_128 = 1 << 5,
1022 GNUTLS_PKCS_PBES2_AES_192 = 1 << 6,
1023 GNUTLS_PKCS_PBES2_AES_256 = 1 << 7,
1024 GNUTLS_PKCS_NULL_PASSWORD = 1 << 8,
1025 GNUTLS_PKCS_PBES2_DES = 1 << 9,
1026 GNUTLS_PKCS_PBES1_DES_MD5 = 1 << 10,
1027 GNUTLS_PKCS_PBES2_GOST_TC26Z = 1 << 11,
1028 GNUTLS_PKCS_PBES2_GOST_CPA = 1 << 12,
1029 GNUTLS_PKCS_PBES2_GOST_CPB = 1 << 13,
1030 GNUTLS_PKCS_PBES2_GOST_CPC = 1 << 14,
1031 GNUTLS_PKCS_PBES2_GOST_CPD = 1 << 15
1032 } gnutls_pkcs_encrypt_flags_t;
1033
1034 #define GNUTLS_PKCS_CIPHER_MASK(x) ((x) & (~(GNUTLS_PKCS_NULL_PASSWORD)))
1035
1036 #define GNUTLS_PKCS_USE_PKCS12_3DES GNUTLS_PKCS_PKCS12_3DES
1037 #define GNUTLS_PKCS_USE_PKCS12_ARCFOUR GNUTLS_PKCS_PKCS12_ARCFOUR
1038 #define GNUTLS_PKCS_USE_PKCS12_RC2_40 GNUTLS_PKCS_PKCS12_RC2_40
1039 #define GNUTLS_PKCS_USE_PBES2_3DES GNUTLS_PKCS_PBES2_3DES
1040 #define GNUTLS_PKCS_USE_PBES2_AES_128 GNUTLS_PKCS_PBES2_AES_128
1041 #define GNUTLS_PKCS_USE_PBES2_AES_192 GNUTLS_PKCS_PBES2_AES_192
1042 #define GNUTLS_PKCS_USE_PBES2_AES_256 GNUTLS_PKCS_PBES2_AES_256
1043 #define GNUTLS_PKCS_USE_PBES2_GOST_TC26Z GNUTLS_PKCS_PBES2_GOST_TC26Z
1044 #define GNUTLS_PKCS_USE_PBES2_GOST_CPA GNUTLS_PKCS_PBES2_GOST_CPA
1045 #define GNUTLS_PKCS_USE_PBES2_GOST_CPB GNUTLS_PKCS_PBES2_GOST_CPB
1046 #define GNUTLS_PKCS_USE_PBES2_GOST_CPC GNUTLS_PKCS_PBES2_GOST_CPC
1047 #define GNUTLS_PKCS_USE_PBES2_GOST_CPD GNUTLS_PKCS_PBES2_GOST_CPD
1048
1049 const char *gnutls_pkcs_schema_get_name(unsigned int schema);
1050 const char *gnutls_pkcs_schema_get_oid(unsigned int schema);
1051
1052 int gnutls_x509_privkey_init(gnutls_x509_privkey_t *key);
1053 void gnutls_x509_privkey_deinit(gnutls_x509_privkey_t key);
1054 gnutls_sec_param_t gnutls_x509_privkey_sec_param(gnutls_x509_privkey_t key);
1055
1056 void gnutls_x509_privkey_set_pin_function(gnutls_x509_privkey_t key,
1057 gnutls_pin_callback_t fn,
1058 void *userdata);
1059
1060 int gnutls_x509_privkey_cpy(gnutls_x509_privkey_t dst,
1061 gnutls_x509_privkey_t src);
1062 int gnutls_x509_privkey_import(gnutls_x509_privkey_t key,
1063 const gnutls_datum_t *data,
1064 gnutls_x509_crt_fmt_t format);
1065 int gnutls_x509_privkey_import_pkcs8(gnutls_x509_privkey_t key,
1066 const gnutls_datum_t *data,
1067 gnutls_x509_crt_fmt_t format,
1068 const char *password, unsigned int flags);
1069 int gnutls_x509_privkey_import_openssl(gnutls_x509_privkey_t key,
1070 const gnutls_datum_t *data,
1071 const char *password);
1072
1073 int gnutls_pkcs8_info(const gnutls_datum_t *data, gnutls_x509_crt_fmt_t format,
1074 unsigned int *schema, unsigned int *cipher, void *salt,
1075 unsigned int *salt_size, unsigned int *iter_count,
1076 char **oid);
1077
1078 int gnutls_x509_privkey_import2(gnutls_x509_privkey_t key,
1079 const gnutls_datum_t *data,
1080 gnutls_x509_crt_fmt_t format,
1081 const char *password, unsigned int flags);
1082
1083 int gnutls_x509_privkey_import_rsa_raw(gnutls_x509_privkey_t key,
1084 const gnutls_datum_t *m,
1085 const gnutls_datum_t *e,
1086 const gnutls_datum_t *d,
1087 const gnutls_datum_t *p,
1088 const gnutls_datum_t *q,
1089 const gnutls_datum_t *u);
1090 int gnutls_x509_privkey_import_rsa_raw2(
1091 gnutls_x509_privkey_t key, const gnutls_datum_t *m,
1092 const gnutls_datum_t *e, const gnutls_datum_t *d,
1093 const gnutls_datum_t *p, const gnutls_datum_t *q,
1094 const gnutls_datum_t *u, const gnutls_datum_t *e1,
1095 const gnutls_datum_t *e2);
1096 int gnutls_x509_privkey_import_ecc_raw(gnutls_x509_privkey_t key,
1097 gnutls_ecc_curve_t curve,
1098 const gnutls_datum_t *x,
1099 const gnutls_datum_t *y,
1100 const gnutls_datum_t *k);
1101 int gnutls_x509_privkey_import_gost_raw(gnutls_x509_privkey_t key,
1102 gnutls_ecc_curve_t curve,
1103 gnutls_digest_algorithm_t digest,
1104 gnutls_gost_paramset_t paramset,
1105 const gnutls_datum_t *x,
1106 const gnutls_datum_t *y,
1107 const gnutls_datum_t *k);
1108
1109 int gnutls_x509_privkey_fix(gnutls_x509_privkey_t key);
1110
1111 int gnutls_x509_privkey_export_dsa_raw(gnutls_x509_privkey_t key,
1112 gnutls_datum_t *p, gnutls_datum_t *q,
1113 gnutls_datum_t *g, gnutls_datum_t *y,
1114 gnutls_datum_t *x);
1115 int gnutls_x509_privkey_import_dsa_raw(gnutls_x509_privkey_t key,
1116 const gnutls_datum_t *p,
1117 const gnutls_datum_t *q,
1118 const gnutls_datum_t *g,
1119 const gnutls_datum_t *y,
1120 const gnutls_datum_t *x);
1121 int gnutls_x509_privkey_import_dh_raw(gnutls_x509_privkey_t key,
1122 const gnutls_dh_params_t params,
1123 const gnutls_datum_t *y,
1124 const gnutls_datum_t *x);
1125
1126 int gnutls_x509_privkey_get_pk_algorithm(gnutls_x509_privkey_t key);
1127 int gnutls_x509_privkey_get_pk_algorithm2(gnutls_x509_privkey_t key,
1128 unsigned int *bits);
1129 int gnutls_x509_privkey_get_spki(gnutls_x509_privkey_t key,
1130 gnutls_x509_spki_t spki, unsigned int flags);
1131 int gnutls_x509_privkey_set_spki(gnutls_x509_privkey_t key,
1132 const gnutls_x509_spki_t spki,
1133 unsigned int flags);
1134
1135 int gnutls_x509_privkey_get_key_id(gnutls_x509_privkey_t key,
1136 unsigned int flags,
1137 unsigned char *output_data,
1138 size_t *output_data_size);
1139
1140 int gnutls_x509_privkey_generate(gnutls_x509_privkey_t key,
1141 gnutls_pk_algorithm_t algo, unsigned int bits,
1142 unsigned int flags);
1143
1144 void gnutls_x509_privkey_set_flags(gnutls_x509_privkey_t key,
1145 unsigned int flags);
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156 typedef enum {
1157 GNUTLS_KEYGEN_SEED = 1,
1158 GNUTLS_KEYGEN_DIGEST = 2,
1159 GNUTLS_KEYGEN_SPKI = 3,
1160 GNUTLS_KEYGEN_DH = 4
1161 } gnutls_keygen_types_t;
1162
1163 typedef struct {
1164 gnutls_keygen_types_t type;
1165 unsigned char *data;
1166 unsigned int size;
1167 } gnutls_keygen_data_st;
1168
1169 int gnutls_x509_privkey_generate2(gnutls_x509_privkey_t key,
1170 gnutls_pk_algorithm_t algo, unsigned int bits,
1171 unsigned int flags,
1172 const gnutls_keygen_data_st *data,
1173 unsigned data_size);
1174
1175 int gnutls_x509_privkey_verify_seed(gnutls_x509_privkey_t key,
1176 gnutls_digest_algorithm_t, const void *seed,
1177 size_t seed_size);
1178 int gnutls_x509_privkey_get_seed(gnutls_x509_privkey_t key,
1179 gnutls_digest_algorithm_t *, void *seed,
1180 size_t *seed_size);
1181
1182 int gnutls_x509_privkey_verify_params(gnutls_x509_privkey_t key);
1183
1184 int gnutls_x509_privkey_export(gnutls_x509_privkey_t key,
1185 gnutls_x509_crt_fmt_t format, void *output_data,
1186 size_t *output_data_size);
1187 int gnutls_x509_privkey_export2(gnutls_x509_privkey_t key,
1188 gnutls_x509_crt_fmt_t format,
1189 gnutls_datum_t *out);
1190 int gnutls_x509_privkey_export_pkcs8(gnutls_x509_privkey_t key,
1191 gnutls_x509_crt_fmt_t format,
1192 const char *password, unsigned int flags,
1193 void *output_data,
1194 size_t *output_data_size);
1195 int gnutls_x509_privkey_export2_pkcs8(gnutls_x509_privkey_t key,
1196 gnutls_x509_crt_fmt_t format,
1197 const char *password, unsigned int flags,
1198 gnutls_datum_t *out);
1199 int gnutls_x509_privkey_export_rsa_raw2(gnutls_x509_privkey_t key,
1200 gnutls_datum_t *m, gnutls_datum_t *e,
1201 gnutls_datum_t *d, gnutls_datum_t *p,
1202 gnutls_datum_t *q, gnutls_datum_t *u,
1203 gnutls_datum_t *e1, gnutls_datum_t *e2);
1204 int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey_t key,
1205 gnutls_datum_t *m, gnutls_datum_t *e,
1206 gnutls_datum_t *d, gnutls_datum_t *p,
1207 gnutls_datum_t *q, gnutls_datum_t *u);
1208 int gnutls_x509_privkey_export_ecc_raw(gnutls_x509_privkey_t key,
1209 gnutls_ecc_curve_t *curve,
1210 gnutls_datum_t *x, gnutls_datum_t *y,
1211 gnutls_datum_t *k);
1212 int gnutls_x509_privkey_export_gost_raw(gnutls_x509_privkey_t key,
1213 gnutls_ecc_curve_t *curve,
1214 gnutls_digest_algorithm_t *digest,
1215 gnutls_gost_paramset_t *paramset,
1216 gnutls_datum_t *x, gnutls_datum_t *y,
1217 gnutls_datum_t *k);
1218
1219 int gnutls_x509_privkey_sign_data(gnutls_x509_privkey_t key,
1220 gnutls_digest_algorithm_t digest,
1221 unsigned int flags,
1222 const gnutls_datum_t *data, void *signature,
1223 size_t *signature_size);
1224
1225
1226
1227 int gnutls_x509_crq_sign(gnutls_x509_crq_t crq, gnutls_x509_privkey_t key);
1228
1229 int gnutls_x509_crq_sign2(gnutls_x509_crq_t crq, gnutls_x509_privkey_t key,
1230 gnutls_digest_algorithm_t dig, unsigned int flags);
1231
1232 int gnutls_x509_crq_print(gnutls_x509_crq_t crq,
1233 gnutls_certificate_print_formats_t format,
1234 gnutls_datum_t *out);
1235
1236 int gnutls_x509_crq_verify(gnutls_x509_crq_t crq, unsigned int flags);
1237
1238 int gnutls_x509_crq_init(gnutls_x509_crq_t *crq);
1239 void gnutls_x509_crq_deinit(gnutls_x509_crq_t crq);
1240 int gnutls_x509_crq_import(gnutls_x509_crq_t crq, const gnutls_datum_t *data,
1241 gnutls_x509_crt_fmt_t format);
1242
1243 int gnutls_x509_crq_get_private_key_usage_period(gnutls_x509_crq_t cert,
1244 time_t *activation,
1245 time_t *expiration,
1246 unsigned int *critical);
1247
1248 int gnutls_x509_crq_get_dn(gnutls_x509_crq_t crq, char *buf,
1249 size_t *sizeof_buf);
1250 int gnutls_x509_crq_get_dn2(gnutls_x509_crq_t crq, gnutls_datum_t *dn);
1251 int gnutls_x509_crq_get_dn3(gnutls_x509_crq_t crq, gnutls_datum_t *dn,
1252 unsigned flags);
1253 int gnutls_x509_crq_get_dn_oid(gnutls_x509_crq_t crq, unsigned indx, void *oid,
1254 size_t *sizeof_oid);
1255 int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq_t crq, const char *oid,
1256 unsigned indx, unsigned int raw_flag,
1257 void *buf, size_t *sizeof_buf);
1258 int gnutls_x509_crq_set_dn(gnutls_x509_crq_t crq, const char *dn,
1259 const char **err);
1260 int gnutls_x509_crq_set_dn_by_oid(gnutls_x509_crq_t crq, const char *oid,
1261 unsigned int raw_flag, const void *data,
1262 unsigned int sizeof_data);
1263 int gnutls_x509_crq_set_version(gnutls_x509_crq_t crq, unsigned int version);
1264 int gnutls_x509_crq_get_version(gnutls_x509_crq_t crq);
1265 int gnutls_x509_crq_set_key(gnutls_x509_crq_t crq, gnutls_x509_privkey_t key);
1266
1267 int gnutls_x509_crq_set_extension_by_oid(gnutls_x509_crq_t crq, const char *oid,
1268 const void *buf, size_t sizeof_buf,
1269 unsigned int critical);
1270
1271 int gnutls_x509_crq_set_challenge_password(gnutls_x509_crq_t crq,
1272 const char *pass);
1273 int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq_t crq, char *pass,
1274 size_t *sizeof_pass);
1275
1276 int gnutls_x509_crq_set_attribute_by_oid(gnutls_x509_crq_t crq, const char *oid,
1277 void *buf, size_t sizeof_buf);
1278 int gnutls_x509_crq_get_attribute_by_oid(gnutls_x509_crq_t crq, const char *oid,
1279 unsigned indx, void *buf,
1280 size_t *sizeof_buf);
1281
1282 int gnutls_x509_crq_export(gnutls_x509_crq_t crq, gnutls_x509_crt_fmt_t format,
1283 void *output_data, size_t *output_data_size);
1284 int gnutls_x509_crq_export2(gnutls_x509_crq_t crq, gnutls_x509_crt_fmt_t format,
1285 gnutls_datum_t *out);
1286
1287 int gnutls_x509_crt_set_crq(gnutls_x509_crt_t crt, gnutls_x509_crq_t crq);
1288 int gnutls_x509_crt_set_crq_extensions(gnutls_x509_crt_t crt,
1289 gnutls_x509_crq_t crq);
1290
1291 int gnutls_x509_crt_set_crq_extension_by_oid(gnutls_x509_crt_t crt,
1292 gnutls_x509_crq_t crq,
1293 const char *oid, unsigned flags);
1294
1295 int gnutls_x509_crq_set_private_key_usage_period(gnutls_x509_crq_t crq,
1296 time_t activation,
1297 time_t expiration);
1298 int gnutls_x509_crq_set_key_rsa_raw(gnutls_x509_crq_t crq,
1299 const gnutls_datum_t *m,
1300 const gnutls_datum_t *e);
1301 int gnutls_x509_crq_set_subject_alt_name(gnutls_x509_crq_t crq,
1302 gnutls_x509_subject_alt_name_t nt,
1303 const void *data,
1304 unsigned int data_size,
1305 unsigned int flags);
1306
1307 int gnutls_x509_crq_set_subject_alt_othername(gnutls_x509_crq_t crq,
1308 const char *oid, const void *data,
1309 unsigned int data_size,
1310 unsigned int flags);
1311
1312 int gnutls_x509_crq_set_key_usage(gnutls_x509_crq_t crq, unsigned int usage);
1313 int gnutls_x509_crq_set_basic_constraints(gnutls_x509_crq_t crq,
1314 unsigned int ca,
1315 int pathLenConstraint);
1316 int gnutls_x509_crq_set_key_purpose_oid(gnutls_x509_crq_t crq, const void *oid,
1317 unsigned int critical);
1318 int gnutls_x509_crq_get_key_purpose_oid(gnutls_x509_crq_t crq, unsigned indx,
1319 void *oid, size_t *sizeof_oid,
1320 unsigned int *critical);
1321
1322 int gnutls_x509_crq_get_extension_data(gnutls_x509_crq_t crq, unsigned indx,
1323 void *data, size_t *sizeof_data);
1324 int gnutls_x509_crq_get_extension_data2(gnutls_x509_crq_t crq, unsigned indx,
1325 gnutls_datum_t *data);
1326 int gnutls_x509_crq_get_extension_info(gnutls_x509_crq_t crq, unsigned indx,
1327 void *oid, size_t *sizeof_oid,
1328 unsigned int *critical);
1329 int gnutls_x509_crq_get_attribute_data(gnutls_x509_crq_t crq, unsigned indx,
1330 void *data, size_t *sizeof_data);
1331 int gnutls_x509_crq_get_attribute_info(gnutls_x509_crq_t crq, unsigned indx,
1332 void *oid, size_t *sizeof_oid);
1333 int gnutls_x509_crq_get_pk_algorithm(gnutls_x509_crq_t crq, unsigned int *bits);
1334 int gnutls_x509_crq_get_spki(gnutls_x509_crq_t crq, gnutls_x509_spki_t spki,
1335 unsigned int flags);
1336
1337 int gnutls_x509_crq_set_spki(gnutls_x509_crq_t crq,
1338 const gnutls_x509_spki_t spki, unsigned int flags);
1339
1340 int gnutls_x509_crq_get_signature_oid(gnutls_x509_crq_t crq, char *oid,
1341 size_t *oid_size);
1342 int gnutls_x509_crq_get_pk_oid(gnutls_x509_crq_t crq, char *oid,
1343 size_t *oid_size);
1344
1345 int gnutls_x509_crq_get_key_id(gnutls_x509_crq_t crq, unsigned int flags,
1346 unsigned char *output_data,
1347 size_t *output_data_size);
1348 int gnutls_x509_crq_get_key_rsa_raw(gnutls_x509_crq_t crq, gnutls_datum_t *m,
1349 gnutls_datum_t *e);
1350
1351 int gnutls_x509_crq_get_key_usage(gnutls_x509_crq_t crq,
1352 unsigned int *key_usage,
1353 unsigned int *critical);
1354 int gnutls_x509_crq_get_basic_constraints(gnutls_x509_crq_t crq,
1355 unsigned int *critical,
1356 unsigned int *ca, int *pathlen);
1357 int gnutls_x509_crq_get_subject_alt_name(gnutls_x509_crq_t crq,
1358 unsigned int seq, void *ret,
1359 size_t *ret_size,
1360 unsigned int *ret_type,
1361 unsigned int *critical);
1362 int gnutls_x509_crq_get_subject_alt_othername_oid(gnutls_x509_crq_t crq,
1363 unsigned int seq, void *ret,
1364 size_t *ret_size);
1365
1366 int gnutls_x509_crq_get_extension_by_oid(gnutls_x509_crq_t crq, const char *oid,
1367 unsigned indx, void *buf,
1368 size_t *sizeof_buf,
1369 unsigned int *critical);
1370
1371 int gnutls_x509_crq_get_tlsfeatures(gnutls_x509_crq_t crq,
1372 gnutls_x509_tlsfeatures_t features,
1373 unsigned flags, unsigned int *critical);
1374 int gnutls_x509_crq_set_tlsfeatures(gnutls_x509_crq_t crq,
1375 gnutls_x509_tlsfeatures_t features);
1376
1377 int gnutls_x509_crt_get_extension_by_oid2(gnutls_x509_crt_t cert,
1378 const char *oid, unsigned indx,
1379 gnutls_datum_t *output,
1380 unsigned int *critical);
1381
1382 typedef struct gnutls_x509_trust_list_st *gnutls_x509_trust_list_t;
1383 typedef struct gnutls_x509_trust_list_iter *gnutls_x509_trust_list_iter_t;
1384
1385 int gnutls_x509_trust_list_init(gnutls_x509_trust_list_t *list,
1386 unsigned int size);
1387
1388 void gnutls_x509_trust_list_deinit(gnutls_x509_trust_list_t list,
1389 unsigned int all);
1390
1391 int gnutls_x509_trust_list_get_issuer(gnutls_x509_trust_list_t list,
1392 gnutls_x509_crt_t cert,
1393 gnutls_x509_crt_t *issuer,
1394 unsigned int flags);
1395
1396 int gnutls_x509_trust_list_get_issuer_by_dn(gnutls_x509_trust_list_t list,
1397 const gnutls_datum_t *dn,
1398 gnutls_x509_crt_t *issuer,
1399 unsigned int flags);
1400
1401 int gnutls_x509_trust_list_get_issuer_by_subject_key_id(
1402 gnutls_x509_trust_list_t list, const gnutls_datum_t *dn,
1403 const gnutls_datum_t *spki, gnutls_x509_crt_t *issuer,
1404 unsigned int flags);
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425 typedef enum gnutls_trust_list_flags_t {
1426 GNUTLS_TL_VERIFY_CRL = 1,
1427 #define GNUTLS_TL_VERIFY_CRL 1
1428 GNUTLS_TL_USE_IN_TLS = (1 << 1),
1429 #define GNUTLS_TL_USE_IN_TLS (1 << 1)
1430 GNUTLS_TL_NO_DUPLICATES = (1 << 2),
1431 #define GNUTLS_TL_NO_DUPLICATES (1 << 2)
1432 GNUTLS_TL_NO_DUPLICATE_KEY = (1 << 3),
1433 #define GNUTLS_TL_NO_DUPLICATE_KEY (1 << 3)
1434 GNUTLS_TL_GET_COPY = (1 << 4),
1435 #define GNUTLS_TL_GET_COPY (1 << 4)
1436 GNUTLS_TL_FAIL_ON_INVALID_CRL = (1 << 5)
1437 #define GNUTLS_TL_FAIL_ON_INVALID_CRL (1 << 5)
1438 } gnutls_trust_list_flags_t;
1439
1440 int gnutls_x509_trust_list_add_cas(gnutls_x509_trust_list_t list,
1441 const gnutls_x509_crt_t *clist,
1442 unsigned clist_size, unsigned int flags);
1443 int gnutls_x509_trust_list_remove_cas(gnutls_x509_trust_list_t list,
1444 const gnutls_x509_crt_t *clist,
1445 unsigned clist_size);
1446
1447 int gnutls_x509_trust_list_add_named_crt(gnutls_x509_trust_list_t list,
1448 gnutls_x509_crt_t cert,
1449 const void *name, size_t name_size,
1450 unsigned int flags);
1451
1452 int gnutls_x509_trust_list_add_crls(gnutls_x509_trust_list_t list,
1453 const gnutls_x509_crl_t *crl_list,
1454 unsigned crl_size, unsigned int flags,
1455 unsigned int verification_flags);
1456
1457 int gnutls_x509_trust_list_iter_get_ca(gnutls_x509_trust_list_t list,
1458 gnutls_x509_trust_list_iter_t *iter,
1459 gnutls_x509_crt_t *crt);
1460
1461 void gnutls_x509_trust_list_iter_deinit(gnutls_x509_trust_list_iter_t iter);
1462
1463 typedef int gnutls_verify_output_function(
1464 gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer,
1465
1466
1467
1468 gnutls_x509_crl_t crl,
1469
1470
1471 unsigned int verification_output);
1472
1473 void gnutls_session_set_verify_output_function(
1474 gnutls_session_t session, gnutls_verify_output_function *func);
1475
1476 int gnutls_x509_trust_list_verify_named_crt(gnutls_x509_trust_list_t list,
1477 gnutls_x509_crt_t cert,
1478 const void *name, size_t name_size,
1479 unsigned int flags,
1480 unsigned int *verify,
1481 gnutls_verify_output_function func);
1482
1483 int gnutls_x509_trust_list_verify_crt2(
1484 gnutls_x509_trust_list_t list, gnutls_x509_crt_t *cert_list,
1485 unsigned int cert_list_size, gnutls_typed_vdata_st *data,
1486 unsigned int elements, unsigned int flags, unsigned int *voutput,
1487 gnutls_verify_output_function func);
1488
1489 int gnutls_x509_trust_list_verify_crt(gnutls_x509_trust_list_t list,
1490 gnutls_x509_crt_t *cert_list,
1491 unsigned int cert_list_size,
1492 unsigned int flags, unsigned int *verify,
1493 gnutls_verify_output_function func);
1494
1495
1496 int gnutls_x509_trust_list_add_trust_mem(gnutls_x509_trust_list_t list,
1497 const gnutls_datum_t *cas,
1498 const gnutls_datum_t *crls,
1499 gnutls_x509_crt_fmt_t type,
1500 unsigned int tl_flags,
1501 unsigned int tl_vflags);
1502
1503 int gnutls_x509_trust_list_add_trust_file(gnutls_x509_trust_list_t list,
1504 const char *ca_file,
1505 const char *crl_file,
1506 gnutls_x509_crt_fmt_t type,
1507 unsigned int tl_flags,
1508 unsigned int tl_vflags);
1509
1510 int gnutls_x509_trust_list_add_trust_dir(gnutls_x509_trust_list_t list,
1511 const char *ca_dir,
1512 const char *crl_dir,
1513 gnutls_x509_crt_fmt_t type,
1514 unsigned int tl_flags,
1515 unsigned int tl_vflags);
1516
1517 int gnutls_x509_trust_list_remove_trust_file(gnutls_x509_trust_list_t list,
1518 const char *ca_file,
1519 gnutls_x509_crt_fmt_t type);
1520
1521 int gnutls_x509_trust_list_remove_trust_mem(gnutls_x509_trust_list_t list,
1522 const gnutls_datum_t *cas,
1523 gnutls_x509_crt_fmt_t type);
1524
1525 int gnutls_x509_trust_list_add_system_trust(gnutls_x509_trust_list_t list,
1526 unsigned int tl_flags,
1527 unsigned int tl_vflags);
1528
1529 typedef int gnutls_x509_trust_list_getissuer_function(
1530 gnutls_x509_trust_list_t list, const gnutls_x509_crt_t cert,
1531 gnutls_x509_crt_t **issuers, unsigned int *issuers_size);
1532
1533 void gnutls_x509_trust_list_set_getissuer_function(
1534 gnutls_x509_trust_list_t tlist,
1535 gnutls_x509_trust_list_getissuer_function *func);
1536
1537 void gnutls_x509_trust_list_set_ptr(gnutls_x509_trust_list_t tlist, void *ptr);
1538
1539 void *gnutls_x509_trust_list_get_ptr(gnutls_x509_trust_list_t tlist);
1540
1541 void gnutls_certificate_set_trust_list(gnutls_certificate_credentials_t res,
1542 gnutls_x509_trust_list_t tlist,
1543 unsigned flags);
1544 void gnutls_certificate_get_trust_list(gnutls_certificate_credentials_t res,
1545 gnutls_x509_trust_list_t *tlist);
1546
1547 typedef struct gnutls_x509_ext_st {
1548 char *oid;
1549 unsigned int critical;
1550 gnutls_datum_t data;
1551 } gnutls_x509_ext_st;
1552
1553 void gnutls_x509_ext_deinit(gnutls_x509_ext_st *ext);
1554
1555 int gnutls_x509_ext_print(gnutls_x509_ext_st *exts, unsigned int exts_size,
1556 gnutls_certificate_print_formats_t format,
1557 gnutls_datum_t *out);
1558
1559 #include <gnutls/pkcs7.h>
1560
1561 #ifdef __cplusplus
1562 }
1563 #endif
1564
1565 #endif