1*2321e207Stb /* $OpenBSD: x509_local.h,v 1.34 2025/01/26 20:01:58 tb Exp $ */ 2c9675a23Stb /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3c9675a23Stb * project 2013. 4c9675a23Stb */ 5c9675a23Stb /* ==================================================================== 6c9675a23Stb * Copyright (c) 2013 The OpenSSL Project. All rights reserved. 7c9675a23Stb * 8c9675a23Stb * Redistribution and use in source and binary forms, with or without 9c9675a23Stb * modification, are permitted provided that the following conditions 10c9675a23Stb * are met: 11c9675a23Stb * 12c9675a23Stb * 1. Redistributions of source code must retain the above copyright 13c9675a23Stb * notice, this list of conditions and the following disclaimer. 14c9675a23Stb * 15c9675a23Stb * 2. Redistributions in binary form must reproduce the above copyright 16c9675a23Stb * notice, this list of conditions and the following disclaimer in 17c9675a23Stb * the documentation and/or other materials provided with the 18c9675a23Stb * distribution. 19c9675a23Stb * 20c9675a23Stb * 3. All advertising materials mentioning features or use of this 21c9675a23Stb * software must display the following acknowledgment: 22c9675a23Stb * "This product includes software developed by the OpenSSL Project 23c9675a23Stb * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 24c9675a23Stb * 25c9675a23Stb * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 26c9675a23Stb * endorse or promote products derived from this software without 27c9675a23Stb * prior written permission. For written permission, please contact 28c9675a23Stb * licensing@OpenSSL.org. 29c9675a23Stb * 30c9675a23Stb * 5. Products derived from this software may not be called "OpenSSL" 31c9675a23Stb * nor may "OpenSSL" appear in their names without prior written 32c9675a23Stb * permission of the OpenSSL Project. 33c9675a23Stb * 34c9675a23Stb * 6. Redistributions of any form whatsoever must retain the following 35c9675a23Stb * acknowledgment: 36c9675a23Stb * "This product includes software developed by the OpenSSL Project 37c9675a23Stb * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 38c9675a23Stb * 39c9675a23Stb * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 40c9675a23Stb * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41c9675a23Stb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 42c9675a23Stb * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 43c9675a23Stb * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44c9675a23Stb * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 45c9675a23Stb * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 46c9675a23Stb * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47c9675a23Stb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 48c9675a23Stb * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49c9675a23Stb * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50c9675a23Stb * OF THE POSSIBILITY OF SUCH DAMAGE. 51c9675a23Stb * ==================================================================== 52c9675a23Stb * 53c9675a23Stb * This product includes cryptographic software written by Eric Young 54c9675a23Stb * (eay@cryptsoft.com). This product includes software written by Tim 55c9675a23Stb * Hudson (tjh@cryptsoft.com). 56c9675a23Stb * 57c9675a23Stb */ 58c9675a23Stb 59a9199000Stb #ifndef HEADER_X509_LOCAL_H 60a9199000Stb #define HEADER_X509_LOCAL_H 61c9675a23Stb 62cb0df071Stb #include <openssl/x509v3.h> 63cb0df071Stb 64*2321e207Stb #include "bytestring.h" 65*2321e207Stb 66c9675a23Stb __BEGIN_HIDDEN_DECLS 67c9675a23Stb 68c9675a23Stb #define TS_HASH_EVP EVP_sha1() 69c9675a23Stb #define TS_HASH_LEN SHA_DIGEST_LENGTH 70c9675a23Stb 71c9675a23Stb #define X509_CERT_HASH_EVP EVP_sha512() 72c9675a23Stb #define X509_CERT_HASH_LEN SHA512_DIGEST_LENGTH 73c9675a23Stb #define X509_CRL_HASH_EVP EVP_sha512() 74c9675a23Stb #define X509_CRL_HASH_LEN SHA512_DIGEST_LENGTH 75c9675a23Stb 7675e21034Sbeck #define X509_TRUST_ACCEPT_ALL -1 7775e21034Sbeck 78b518871aStb /* check_trust return codes */ 79b518871aStb #define X509_TRUST_TRUSTED 1 80b518871aStb #define X509_TRUST_REJECTED 2 81b518871aStb #define X509_TRUST_UNTRUSTED 3 82b518871aStb 83b518871aStb int X509_check_trust(X509 *x, int id, int flags); 84b518871aStb 85030e5ab1Stb struct X509_val_st { 86030e5ab1Stb ASN1_TIME *notBefore; 87030e5ab1Stb ASN1_TIME *notAfter; 88030e5ab1Stb } /* X509_VAL */; 89030e5ab1Stb 90c9675a23Stb struct X509_pubkey_st { 91c9675a23Stb X509_ALGOR *algor; 92c9675a23Stb ASN1_BIT_STRING *public_key; 93c9675a23Stb EVP_PKEY *pkey; 94c9675a23Stb }; 95c9675a23Stb 96c9675a23Stb struct X509_sig_st { 97c9675a23Stb X509_ALGOR *algor; 98c9675a23Stb ASN1_OCTET_STRING *digest; 99c9675a23Stb } /* X509_SIG */; 100c9675a23Stb 101c9675a23Stb struct X509_name_entry_st { 102c9675a23Stb ASN1_OBJECT *object; 103c9675a23Stb ASN1_STRING *value; 104c9675a23Stb int set; 105c9675a23Stb int size; /* temp variable */ 106c9675a23Stb } /* X509_NAME_ENTRY */; 107c9675a23Stb 108c9675a23Stb /* we always keep X509_NAMEs in 2 forms. */ 109c9675a23Stb struct X509_name_st { 110c9675a23Stb STACK_OF(X509_NAME_ENTRY) *entries; 111c9675a23Stb int modified; /* true if 'bytes' needs to be built */ 112c9675a23Stb #ifndef OPENSSL_NO_BUFFER 113c9675a23Stb BUF_MEM *bytes; 114c9675a23Stb #else 115c9675a23Stb char *bytes; 116c9675a23Stb #endif 117c9675a23Stb /* unsigned long hash; Keep the hash around for lookups */ 118c9675a23Stb unsigned char *canon_enc; 119c9675a23Stb int canon_enclen; 120c9675a23Stb } /* X509_NAME */; 121c9675a23Stb 122c9675a23Stb struct X509_extension_st { 123c9675a23Stb ASN1_OBJECT *object; 124c9675a23Stb ASN1_BOOLEAN critical; 125c9675a23Stb ASN1_OCTET_STRING *value; 126c9675a23Stb } /* X509_EXTENSION */; 127c9675a23Stb 128c9675a23Stb struct x509_attributes_st { 129c9675a23Stb ASN1_OBJECT *object; 130c9675a23Stb STACK_OF(ASN1_TYPE) *set; 131c9675a23Stb } /* X509_ATTRIBUTE */; 132c9675a23Stb 133c9675a23Stb struct X509_req_info_st { 134c9675a23Stb ASN1_ENCODING enc; 135c9675a23Stb ASN1_INTEGER *version; 136c9675a23Stb X509_NAME *subject; 137c9675a23Stb X509_PUBKEY *pubkey; 138c9675a23Stb /* d=2 hl=2 l= 0 cons: cont: 00 */ 139c9675a23Stb STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ 140c9675a23Stb } /* X509_REQ_INFO */; 141c9675a23Stb 142c9675a23Stb struct X509_req_st { 143c9675a23Stb X509_REQ_INFO *req_info; 144c9675a23Stb X509_ALGOR *sig_alg; 145c9675a23Stb ASN1_BIT_STRING *signature; 146c9675a23Stb int references; 147c9675a23Stb } /* X509_REQ */; 148c9675a23Stb 149c9675a23Stb /* 150c9675a23Stb * This stuff is certificate "auxiliary info" it contains details which are 151c9675a23Stb * useful in certificate stores and databases. When used this is tagged onto 152c9675a23Stb * the end of the certificate itself. 153c9675a23Stb */ 154ac758cd1Stb typedef struct x509_cert_aux_st { 155c9675a23Stb STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */ 156c9675a23Stb STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */ 157c9675a23Stb ASN1_UTF8STRING *alias; /* "friendly name" */ 158c9675a23Stb ASN1_OCTET_STRING *keyid; /* key id of private key */ 159c9675a23Stb STACK_OF(X509_ALGOR) *other; /* other unspecified info */ 160ac758cd1Stb } X509_CERT_AUX; 161ac758cd1Stb 162ac758cd1Stb X509_CERT_AUX *X509_CERT_AUX_new(void); 163ac758cd1Stb void X509_CERT_AUX_free(X509_CERT_AUX *a); 164ac758cd1Stb X509_CERT_AUX *d2i_X509_CERT_AUX(X509_CERT_AUX **a, const unsigned char **in, long len); 165ac758cd1Stb int i2d_X509_CERT_AUX(X509_CERT_AUX *a, unsigned char **out); 166ac758cd1Stb extern const ASN1_ITEM X509_CERT_AUX_it; 167ac758cd1Stb int X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent); 168c9675a23Stb 169c9675a23Stb struct x509_cinf_st { 170c9675a23Stb ASN1_INTEGER *version; /* [ 0 ] default of v1 */ 171c9675a23Stb ASN1_INTEGER *serialNumber; 172c9675a23Stb X509_ALGOR *signature; 173c9675a23Stb X509_NAME *issuer; 174c9675a23Stb X509_VAL *validity; 175c9675a23Stb X509_NAME *subject; 176c9675a23Stb X509_PUBKEY *key; 177c9675a23Stb ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */ 178c9675a23Stb ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */ 179c9675a23Stb STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */ 180c9675a23Stb ASN1_ENCODING enc; 181c9675a23Stb } /* X509_CINF */; 182c9675a23Stb 183c9675a23Stb struct x509_st { 184c9675a23Stb X509_CINF *cert_info; 185c9675a23Stb X509_ALGOR *sig_alg; 186c9675a23Stb ASN1_BIT_STRING *signature; 187c9675a23Stb int valid; 188c9675a23Stb int references; 189c9675a23Stb char *name; 190c9675a23Stb CRYPTO_EX_DATA ex_data; 191c9675a23Stb /* These contain copies of various extension values */ 192c9675a23Stb long ex_pathlen; 193c9675a23Stb unsigned long ex_flags; 194c9675a23Stb unsigned long ex_kusage; 195c9675a23Stb unsigned long ex_xkusage; 196c9675a23Stb unsigned long ex_nscert; 197c9675a23Stb ASN1_OCTET_STRING *skid; 198c9675a23Stb AUTHORITY_KEYID *akid; 199c9675a23Stb STACK_OF(DIST_POINT) *crldp; 200c9675a23Stb STACK_OF(GENERAL_NAME) *altname; 201c9675a23Stb NAME_CONSTRAINTS *nc; 202c9675a23Stb #ifndef OPENSSL_NO_RFC3779 203c9675a23Stb STACK_OF(IPAddressFamily) *rfc3779_addr; 204aaa88f3dStb ASIdentifiers *rfc3779_asid; 205c9675a23Stb #endif 206c9675a23Stb unsigned char hash[X509_CERT_HASH_LEN]; 207c9675a23Stb X509_CERT_AUX *aux; 208c9675a23Stb } /* X509 */; 209c9675a23Stb 210c9675a23Stb struct x509_revoked_st { 211c9675a23Stb ASN1_INTEGER *serialNumber; 212c9675a23Stb ASN1_TIME *revocationDate; 213c9675a23Stb STACK_OF(X509_EXTENSION) /* optional */ *extensions; 214c9675a23Stb /* Set up if indirect CRL */ 215c9675a23Stb STACK_OF(GENERAL_NAME) *issuer; 216c9675a23Stb /* Revocation reason */ 217c9675a23Stb int reason; 218c9675a23Stb int sequence; /* load sequence */ 219c9675a23Stb }; 220c9675a23Stb 221c9675a23Stb struct X509_crl_info_st { 222c9675a23Stb ASN1_INTEGER *version; 223c9675a23Stb X509_ALGOR *sig_alg; 224c9675a23Stb X509_NAME *issuer; 225c9675a23Stb ASN1_TIME *lastUpdate; 226c9675a23Stb ASN1_TIME *nextUpdate; 227c9675a23Stb STACK_OF(X509_REVOKED) *revoked; 228c9675a23Stb STACK_OF(X509_EXTENSION) /* [0] */ *extensions; 229c9675a23Stb ASN1_ENCODING enc; 230c9675a23Stb } /* X509_CRL_INFO */; 231c9675a23Stb 232c9675a23Stb struct X509_crl_st { 233c9675a23Stb /* actual signature */ 234c9675a23Stb X509_CRL_INFO *crl; 235c9675a23Stb X509_ALGOR *sig_alg; 236c9675a23Stb ASN1_BIT_STRING *signature; 237c9675a23Stb int references; 238c9675a23Stb int flags; 239c9675a23Stb /* Copies of various extensions */ 240c9675a23Stb AUTHORITY_KEYID *akid; 241c9675a23Stb ISSUING_DIST_POINT *idp; 242c9675a23Stb /* Convenient breakdown of IDP */ 243c9675a23Stb int idp_flags; 244c9675a23Stb int idp_reasons; 245c9675a23Stb /* CRL and base CRL numbers for delta processing */ 246c9675a23Stb ASN1_INTEGER *crl_number; 247c9675a23Stb ASN1_INTEGER *base_crl_number; 248c9675a23Stb unsigned char hash[X509_CRL_HASH_LEN]; 249c9675a23Stb STACK_OF(GENERAL_NAMES) *issuers; 250c9675a23Stb } /* X509_CRL */; 251c9675a23Stb 252c9675a23Stb struct pkcs8_priv_key_info_st { 253c9675a23Stb ASN1_INTEGER *version; 254c9675a23Stb X509_ALGOR *pkeyalg; 255c9675a23Stb ASN1_OCTET_STRING *pkey; 256c9675a23Stb STACK_OF(X509_ATTRIBUTE) *attributes; 257c9675a23Stb }; 258c9675a23Stb 259c9675a23Stb struct x509_object_st { 260c9675a23Stb /* one of the above types */ 261c9675a23Stb int type; 262c9675a23Stb union { 263c9675a23Stb X509 *x509; 264c9675a23Stb X509_CRL *crl; 265c9675a23Stb } data; 266c9675a23Stb } /* X509_OBJECT */; 267c9675a23Stb 268c9675a23Stb struct x509_lookup_method_st { 269c9675a23Stb const char *name; 270c9675a23Stb int (*new_item)(X509_LOOKUP *ctx); 271c9675a23Stb void (*free)(X509_LOOKUP *ctx); 272c9675a23Stb int (*ctrl)(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, 273c9675a23Stb char **ret); 274c9675a23Stb int (*get_by_subject)(X509_LOOKUP *ctx, int type, X509_NAME *name, 275c9675a23Stb X509_OBJECT *ret); 276c9675a23Stb } /* X509_LOOKUP_METHOD */; 277c9675a23Stb 278c9675a23Stb struct X509_VERIFY_PARAM_st { 279c9675a23Stb char *name; 280c9675a23Stb time_t check_time; /* Time to use */ 281c9675a23Stb unsigned long inh_flags; /* Inheritance flags */ 282c9675a23Stb unsigned long flags; /* Various verify flags */ 283c9675a23Stb int purpose; /* purpose to check untrusted certificates */ 284c9675a23Stb int trust; /* trust setting to check */ 285c9675a23Stb int depth; /* Verify depth */ 286c9675a23Stb int security_level; /* 'Security level', see SP800-57. */ 287c9675a23Stb STACK_OF(ASN1_OBJECT) *policies; /* Permissible policies */ 288b6c35519Stb STACK_OF(OPENSSL_STRING) *hosts; /* Set of acceptable names */ 289b6c35519Stb unsigned int hostflags; /* Flags to control matching features */ 290b6c35519Stb char *peername; /* Matching hostname in peer certificate */ 291b6c35519Stb char *email; /* If not NULL email address to match */ 292b6c35519Stb size_t emaillen; 293b6c35519Stb unsigned char *ip; /* If not NULL IP address to match */ 294b6c35519Stb size_t iplen; /* Length of IP address */ 295b6c35519Stb int poisoned; 296c9675a23Stb } /* X509_VERIFY_PARAM */; 297c9675a23Stb 298c9675a23Stb /* 299c9675a23Stb * This is used to hold everything. It is used for all certificate 300c9675a23Stb * validation. Once we have a certificate chain, the 'verify' 301c9675a23Stb * function is then called to actually check the cert chain. 302c9675a23Stb */ 303c9675a23Stb struct x509_store_st { 304c9675a23Stb /* The following is a cache of trusted certs */ 305c9675a23Stb STACK_OF(X509_OBJECT) *objs; /* Cache of all objects */ 306c9675a23Stb 307c9675a23Stb /* These are external lookup methods */ 308c9675a23Stb STACK_OF(X509_LOOKUP) *get_cert_methods; 309c9675a23Stb 310c9675a23Stb X509_VERIFY_PARAM *param; 311c9675a23Stb 312c9675a23Stb /* Callbacks for various operations */ 313c9675a23Stb int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ 314c9675a23Stb int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ 315c9675a23Stb int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */ 316c9675a23Stb 317c9675a23Stb CRYPTO_EX_DATA ex_data; 318c9675a23Stb int references; 319c9675a23Stb } /* X509_STORE */; 320c9675a23Stb 321c9675a23Stb /* This is the functions plus an instance of the local variables. */ 322c9675a23Stb struct x509_lookup_st { 323787e4c65Stb const X509_LOOKUP_METHOD *method; /* the functions */ 32458c56706Stb void *method_data; /* method data */ 325c9675a23Stb 326c9675a23Stb X509_STORE *store_ctx; /* who owns us */ 327c9675a23Stb } /* X509_LOOKUP */; 328c9675a23Stb 329c9675a23Stb /* 330c9675a23Stb * This is used when verifying cert chains. Since the gathering of the cert 331c9675a23Stb * chain can take some time (and has to be 'retried'), this needs to be kept 332c9675a23Stb * and passed around. 333c9675a23Stb */ 334c9675a23Stb struct x509_store_ctx_st { 335c9675a23Stb X509_STORE *store; 336c9675a23Stb int current_method; /* used when looking up certs */ 337c9675a23Stb 338c9675a23Stb /* The following are set by the caller */ 339c9675a23Stb X509 *cert; /* The cert to check */ 340c9675a23Stb STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */ 3417922d92fStb STACK_OF(X509) *trusted; /* trusted stack for use with get_issuer() */ 342c9675a23Stb STACK_OF(X509_CRL) *crls; /* set of CRLs passed in */ 343c9675a23Stb 344c9675a23Stb X509_VERIFY_PARAM *param; 345c9675a23Stb 346c9675a23Stb /* Callbacks for various operations */ 347c9675a23Stb int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ 348c9675a23Stb int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ 349c9675a23Stb int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */ 350c9675a23Stb int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */ 351c9675a23Stb 352c9675a23Stb /* The following is built up */ 353c9675a23Stb int valid; /* if 0, rebuild chain */ 354c9675a23Stb int num_untrusted; /* number of untrusted certs in chain */ 355c9675a23Stb STACK_OF(X509) *chain; /* chain of X509s - built up and trusted */ 356c9675a23Stb 357c9675a23Stb int explicit_policy; /* Require explicit policy value */ 358c9675a23Stb 359c9675a23Stb /* When something goes wrong, this is why */ 360c9675a23Stb int error_depth; 361c9675a23Stb int error; 362c9675a23Stb X509 *current_cert; 363c9675a23Stb X509 *current_issuer; /* cert currently being tested as valid issuer */ 364c9675a23Stb X509_CRL *current_crl; /* current CRL */ 365c9675a23Stb 366c9675a23Stb int current_crl_score; /* score of current CRL */ 367c9675a23Stb unsigned int current_reasons; /* Reason mask */ 368c9675a23Stb 369c9675a23Stb X509_STORE_CTX *parent; /* For CRL path validation: parent context */ 370c9675a23Stb 371c9675a23Stb CRYPTO_EX_DATA ex_data; 372c9675a23Stb } /* X509_STORE_CTX */; 373c9675a23Stb 374c9675a23Stb int x509_check_cert_time(X509_STORE_CTX *ctx, X509 *x, int quiet); 375c9675a23Stb 376c9675a23Stb int name_cmp(const char *name, const char *cmp); 377c9675a23Stb 37805dcc22aStb int X509_ALGOR_set_evp_md(X509_ALGOR *alg, const EVP_MD *md); 37920811866Stb int X509_ALGOR_set0_by_nid(X509_ALGOR *alg, int nid, int parameter_type, 38020811866Stb void *parameter_value); 38105dcc22aStb 382e6cf98fcSbeck int X509_policy_check(const STACK_OF(X509) *certs, 383e6cf98fcSbeck const STACK_OF(ASN1_OBJECT) *user_policies, unsigned long flags, 384e6cf98fcSbeck X509 **out_current_cert); 3850f3cdff2Stb 3862c9362b1Stb PBEPARAM *PBEPARAM_new(void); 3872c9362b1Stb void PBEPARAM_free(PBEPARAM *a); 3882c9362b1Stb PBEPARAM *d2i_PBEPARAM(PBEPARAM **a, const unsigned char **in, long len); 3892c9362b1Stb int i2d_PBEPARAM(PBEPARAM *a, unsigned char **out); 3902c9362b1Stb 3912c9362b1Stb /* Password based encryption V2 structures */ 3922c9362b1Stb typedef struct PBE2PARAM_st { 3932c9362b1Stb X509_ALGOR *keyfunc; 3942c9362b1Stb X509_ALGOR *encryption; 3952c9362b1Stb } PBE2PARAM; 3962c9362b1Stb 3972c9362b1Stb PBE2PARAM *PBE2PARAM_new(void); 3982c9362b1Stb void PBE2PARAM_free(PBE2PARAM *a); 3992c9362b1Stb PBE2PARAM *d2i_PBE2PARAM(PBE2PARAM **a, const unsigned char **in, long len); 4002c9362b1Stb int i2d_PBE2PARAM(PBE2PARAM *a, unsigned char **out); 4012c9362b1Stb extern const ASN1_ITEM PBE2PARAM_it; 4022c9362b1Stb 4032c9362b1Stb typedef struct PBKDF2PARAM_st { 4042c9362b1Stb /* Usually OCTET STRING but could be anything */ 4052c9362b1Stb ASN1_TYPE *salt; 4062c9362b1Stb ASN1_INTEGER *iter; 4072c9362b1Stb ASN1_INTEGER *keylength; 4082c9362b1Stb X509_ALGOR *prf; 4092c9362b1Stb } PBKDF2PARAM; 4102c9362b1Stb 4112c9362b1Stb PBKDF2PARAM *PBKDF2PARAM_new(void); 4122c9362b1Stb void PBKDF2PARAM_free(PBKDF2PARAM *a); 4132c9362b1Stb PBKDF2PARAM *d2i_PBKDF2PARAM(PBKDF2PARAM **a, const unsigned char **in, long len); 4142c9362b1Stb int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **out); 4152c9362b1Stb extern const ASN1_ITEM PBKDF2PARAM_it; 4162c9362b1Stb 417fccc7e89Stb int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, 418fccc7e89Stb const unsigned char *salt, int saltlen); 419fccc7e89Stb X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, 420fccc7e89Stb unsigned char *salt, int saltlen); 421fccc7e89Stb X509_ALGOR *PKCS5_pbe_set(int alg, int iter, const unsigned char *salt, 422fccc7e89Stb int saltlen); 423fccc7e89Stb X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, 424fccc7e89Stb int prf_nid, int keylen); 425fccc7e89Stb 426cb0df071Stb int X509_PURPOSE_get_by_id(int id); 427cb0df071Stb int X509_PURPOSE_get_trust(const X509_PURPOSE *xp); 428cb0df071Stb 429aa491240Stb int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, 430aa491240Stb int lastpos); 431aa491240Stb int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, 432aa491240Stb const ASN1_OBJECT *obj, int lastpos); 433aa491240Stb STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, 434aa491240Stb X509_ATTRIBUTE *attr); 435aa491240Stb STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x, 436aa491240Stb const ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len); 437aa491240Stb STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x, 438aa491240Stb int nid, int type, const unsigned char *bytes, int len); 439aa491240Stb STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x, 440aa491240Stb const char *attrname, int type, const unsigned char *bytes, int len); 441aa491240Stb void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, 442aa491240Stb const ASN1_OBJECT *obj, int lastpos, int type); 443aa491240Stb 444*2321e207Stb int X509_NAME_ENTRY_add_cbb(CBB *cbb, const X509_NAME_ENTRY *ne); 445*2321e207Stb 4462d7706baStb int X509V3_add_value(const char *name, const char *value, 4472d7706baStb STACK_OF(CONF_VALUE) **extlist); 4482d7706baStb int X509V3_add_value_uchar(const char *name, const unsigned char *value, 4492d7706baStb STACK_OF(CONF_VALUE) **extlist); 4502d7706baStb int X509V3_add_value_bool(const char *name, int asn1_bool, 4512d7706baStb STACK_OF(CONF_VALUE) **extlist); 4522d7706baStb int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, 4532d7706baStb STACK_OF(CONF_VALUE) **extlist); 4542d7706baStb 4552d7706baStb int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); 4562d7706baStb int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); 4572d7706baStb 4582d7706baStb STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); 4592d7706baStb void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); 4602d7706baStb 4618b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_authority_key_identifier(void); 4628b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_basic_constraints(void); 4638b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_certificate_issuer(void); 4648b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_certificate_policies(void); 4658b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_crl_distribution_points(void); 4668b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_crl_number(void); 4678b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_crl_reason(void); 4688b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_ct_cert_scts(void); 4698b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_ct_precert_poison(void); 4708b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_ct_precert_scts(void); 4718b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_delta_crl(void); 4728b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_ext_key_usage(void); 4738b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_freshest_crl(void); 4748b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_hold_instruction_code(void); 4758b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_CrlID(void); 4768b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_Nonce(void); 4778b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_acceptableResponses(void); 4788b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_archiveCutoff(void); 4798b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_id_pkix_OCSP_serviceLocator(void); 4808b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_info_access(void); 4818b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_inhibit_any_policy(void); 4828b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_invalidity_date(void); 4838b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_issuer_alt_name(void); 4848b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_issuing_distribution_point(void); 4858b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_key_usage(void); 4868b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_name_constraints(void); 4878b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_netscape_base_url(void); 4888b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_netscape_ca_policy_url(void); 4898b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_netscape_ca_revocation_url(void); 4908b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_netscape_cert_type(void); 4918b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_netscape_comment(void); 4928b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_netscape_renewal_url(void); 4938b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_netscape_revocation_url(void); 4948b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_netscape_ssl_server_name(void); 4958b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_policy_constraints(void); 4968b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_policy_mappings(void); 4978b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_private_key_usage_period(void); 4988b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_sbgp_ipAddrBlock(void); 4998b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_sbgp_autonomousSysNum(void); 5008b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_sinfo_access(void); 5018b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_subject_alt_name(void); 5028b5faa71Stb const X509V3_EXT_METHOD *x509v3_ext_method_subject_key_identifier(void); 5038b5faa71Stb 504c9675a23Stb __END_HIDDEN_DECLS 505c9675a23Stb 506a9199000Stb #endif /* !HEADER_X509_LOCAL_H */ 507