x509.h
mbedtls/config.h
mbedtls/asn1.h
mbedtls/pk.h
mbedtls/rsa.h
x509_crl.h
x509_crt.h
x509_csr.h
mbedtls/asn1.h
mbedtls/bignum.h
mbedtls/check_config.h
mbedtls/config.h
mbedtls/ecdsa.h
mbedtls/ecp.h
mbedtls/md.h
mbedtls/pk.h
mbedtls/platform_time.h
mbedtls/platform_util.h
mbedtls/rsa.h
mbedtls/threading.h
x509.h
limits.h
pthread.h
stddef.h
stdint.h
stdio.h
stdlib.h
time.h
debug.h
net.h
net_sockets.h
ssl.h
ssl_cache.h
ssl_cookie.h
ssl_ticket.h
x509.h
x509_crl.h
x509_crt.h
x509_csr.h
mbedtls_x509_time
X509 Error codes
- MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE
- MBEDTLS_ERR_X509_UNKNOWN_OID
- MBEDTLS_ERR_X509_INVALID_FORMAT
- MBEDTLS_ERR_X509_INVALID_VERSION
- MBEDTLS_ERR_X509_INVALID_SERIAL
- MBEDTLS_ERR_X509_INVALID_ALG
- MBEDTLS_ERR_X509_INVALID_NAME
- MBEDTLS_ERR_X509_INVALID_DATE
- MBEDTLS_ERR_X509_INVALID_SIGNATURE
- MBEDTLS_ERR_X509_INVALID_EXTENSIONS
- MBEDTLS_ERR_X509_UNKNOWN_VERSION
- MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG
- MBEDTLS_ERR_X509_SIG_MISMATCH
- MBEDTLS_ERR_X509_CERT_VERIFY_FAILED
- MBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT
- MBEDTLS_ERR_X509_BAD_INPUT_DATA
- MBEDTLS_ERR_X509_ALLOC_FAILED
- MBEDTLS_ERR_X509_FILE_IO_ERROR
- MBEDTLS_ERR_X509_BUFFER_TOO_SMALL
- MBEDTLS_ERR_X509_FATAL_ERROR
X509 Verify codes
- MBEDTLS_X509_BADCERT_EXPIRED
- MBEDTLS_X509_BADCERT_REVOKED
- MBEDTLS_X509_BADCERT_CN_MISMATCH
- MBEDTLS_X509_BADCERT_NOT_TRUSTED
- MBEDTLS_X509_BADCRL_NOT_TRUSTED
- MBEDTLS_X509_BADCRL_EXPIRED
- MBEDTLS_X509_BADCERT_MISSING
- MBEDTLS_X509_BADCERT_SKIP_VERIFY
- MBEDTLS_X509_BADCERT_OTHER
- MBEDTLS_X509_BADCERT_FUTURE
- MBEDTLS_X509_BADCRL_FUTURE
- MBEDTLS_X509_BADCERT_KEY_USAGE
- MBEDTLS_X509_BADCERT_EXT_KEY_USAGE
- MBEDTLS_X509_BADCERT_NS_CERT_TYPE
- MBEDTLS_X509_BADCERT_BAD_MD
- MBEDTLS_X509_BADCERT_BAD_PK
- MBEDTLS_X509_BADCERT_BAD_KEY
- MBEDTLS_X509_BADCRL_BAD_MD
- MBEDTLS_X509_BADCRL_BAD_PK
- MBEDTLS_X509_BADCRL_BAD_KEY
Structures for parsing X.509 certificates, CRLs and CSRs
- mbedtls_x509_buf
- mbedtls_x509_bitstring
- mbedtls_x509_name
- mbedtls_x509_sequence
- mbedtls_x509_time
- MBEDTLS_X509_MAX_INTERMEDIATE_CA
MBEDTLS_X509_SAN_OTHER_NAME
0
MBEDTLS_X509_SAN_RFC822_NAME
1
MBEDTLS_X509_SAN_DNS_NAME
2
MBEDTLS_X509_SAN_X400_ADDRESS_NAME
3
MBEDTLS_X509_SAN_DIRECTORY_NAME
4
MBEDTLS_X509_SAN_EDI_PARTY_NAME
5
MBEDTLS_X509_SAN_UNIFORM_RESOURCE_IDENTIFIER
6
MBEDTLS_X509_SAN_IP_ADDRESS
7
MBEDTLS_X509_SAN_REGISTERED_ID
8
MBEDTLS_X509_KU_DIGITAL_SIGNATURE
(0x80) /* bit 0 */
MBEDTLS_X509_KU_NON_REPUDIATION
(0x40) /* bit 1 */
MBEDTLS_X509_KU_KEY_ENCIPHERMENT
(0x20) /* bit 2 */
MBEDTLS_X509_KU_DATA_ENCIPHERMENT
(0x10) /* bit 3 */
MBEDTLS_X509_KU_KEY_AGREEMENT
(0x08) /* bit 4 */
MBEDTLS_X509_KU_KEY_CERT_SIGN
(0x04) /* bit 5 */
MBEDTLS_X509_KU_CRL_SIGN
(0x02) /* bit 6 */
MBEDTLS_X509_KU_ENCIPHER_ONLY
(0x01) /* bit 7 */
MBEDTLS_X509_KU_DECIPHER_ONLY
(0x8000) /* bit 8 */
MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT
(0x80) /* bit 0 */
MBEDTLS_X509_NS_CERT_TYPE_SSL_SERVER
(0x40) /* bit 1 */
MBEDTLS_X509_NS_CERT_TYPE_EMAIL
(0x20) /* bit 2 */
MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING
(0x10) /* bit 3 */
MBEDTLS_X509_NS_CERT_TYPE_RESERVED
(0x08) /* bit 4 */
MBEDTLS_X509_NS_CERT_TYPE_SSL_CA
(0x04) /* bit 5 */
MBEDTLS_X509_NS_CERT_TYPE_EMAIL_CA
(0x02) /* bit 6 */
MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING_CA
(0x01) /* bit 7 */
MBEDTLS_X509_EXT_AUTHORITY_KEY_IDENTIFIER
MBEDTLS_OID_X509_EXT_AUTHORITY_KEY_IDENTIFIER
MBEDTLS_X509_EXT_SUBJECT_KEY_IDENTIFIER
MBEDTLS_OID_X509_EXT_SUBJECT_KEY_IDENTIFIER
MBEDTLS_X509_EXT_KEY_USAGE
MBEDTLS_OID_X509_EXT_KEY_USAGE
MBEDTLS_X509_EXT_CERTIFICATE_POLICIES
MBEDTLS_OID_X509_EXT_CERTIFICATE_POLICIES
MBEDTLS_X509_EXT_POLICY_MAPPINGS
MBEDTLS_OID_X509_EXT_POLICY_MAPPINGS
MBEDTLS_X509_EXT_SUBJECT_ALT_NAME
MBEDTLS_OID_X509_EXT_SUBJECT_ALT_NAME
/* Supported (DNS) */
MBEDTLS_X509_EXT_ISSUER_ALT_NAME
MBEDTLS_OID_X509_EXT_ISSUER_ALT_NAME
MBEDTLS_X509_EXT_SUBJECT_DIRECTORY_ATTRS
MBEDTLS_OID_X509_EXT_SUBJECT_DIRECTORY_ATTRS
MBEDTLS_X509_EXT_BASIC_CONSTRAINTS
MBEDTLS_OID_X509_EXT_BASIC_CONSTRAINTS
/* Supported */
MBEDTLS_X509_EXT_NAME_CONSTRAINTS
MBEDTLS_OID_X509_EXT_NAME_CONSTRAINTS
MBEDTLS_X509_EXT_POLICY_CONSTRAINTS
MBEDTLS_OID_X509_EXT_POLICY_CONSTRAINTS
MBEDTLS_X509_EXT_EXTENDED_KEY_USAGE
MBEDTLS_OID_X509_EXT_EXTENDED_KEY_USAGE
MBEDTLS_X509_EXT_CRL_DISTRIBUTION_POINTS
MBEDTLS_OID_X509_EXT_CRL_DISTRIBUTION_POINTS
MBEDTLS_X509_EXT_INIHIBIT_ANYPOLICY
MBEDTLS_OID_X509_EXT_INIHIBIT_ANYPOLICY
MBEDTLS_X509_EXT_FRESHEST_CRL
MBEDTLS_OID_X509_EXT_FRESHEST_CRL
MBEDTLS_X509_EXT_NS_CERT_TYPE
MBEDTLS_OID_X509_EXT_NS_CERT_TYPE
MBEDTLS_X509_FORMAT_DER
1
MBEDTLS_X509_FORMAT_PEM
2
MBEDTLS_X509_MAX_DN_NAME_SIZE
256

Maximum value size of a DN entry

MBEDTLS_X509_SAFE_SNPRINTF
do { \ if (ret < 0 || (size_t) ret >= n) \ return MBEDTLS_ERR_X509_BUFFER_TOO_SMALL; \ \ n -= (size_t) ret; \ p += (size_t) ret; \ } while (0)
- mbedtls_x509_dn_gets
- mbedtls_x509_serial_gets
- mbedtls_x509_time_is_past
- mbedtls_x509_time_is_future
int int mbedtls_x509_self_test (int verbose) mbedtls_x509_self_test int verbose

Checkup routine.

0 if successful, or 1 if the test failed

int int mbedtls_x509_get_name (unsigned char **p, const unsigned char *end, mbedtls_x509_name *cur) mbedtls_x509_get_name unsigned char ** p const unsigned char * end mbedtls_x509_name * cur
int int mbedtls_x509_get_alg_null (unsigned char **p, const unsigned char *end, mbedtls_x509_buf *alg) mbedtls_x509_get_alg_null unsigned char ** p const unsigned char * end mbedtls_x509_buf * alg
int int mbedtls_x509_get_alg (unsigned char **p, const unsigned char *end, mbedtls_x509_buf *alg, mbedtls_x509_buf *params) mbedtls_x509_get_alg unsigned char ** p const unsigned char * end mbedtls_x509_buf * alg mbedtls_x509_buf * params
int int mbedtls_x509_get_rsassa_pss_params (const mbedtls_x509_buf *params, mbedtls_md_type_t *md_alg, mbedtls_md_type_t *mgf_md, int *salt_len) mbedtls_x509_get_rsassa_pss_params const mbedtls_x509_buf * params mbedtls_md_type_t * md_alg mbedtls_md_type_t * mgf_md int * salt_len
int int mbedtls_x509_get_sig (unsigned char **p, const unsigned char *end, mbedtls_x509_buf *sig) mbedtls_x509_get_sig unsigned char ** p const unsigned char * end mbedtls_x509_buf * sig
int int mbedtls_x509_get_sig_alg (const mbedtls_x509_buf *sig_oid, const mbedtls_x509_buf *sig_params, mbedtls_md_type_t *md_alg, mbedtls_pk_type_t *pk_alg, void **sig_opts) mbedtls_x509_get_sig_alg const mbedtls_x509_buf * sig_oid const mbedtls_x509_buf * sig_params mbedtls_md_type_t * md_alg mbedtls_pk_type_t * pk_alg void ** sig_opts
int int mbedtls_x509_get_time (unsigned char **p, const unsigned char *end, mbedtls_x509_time *t) mbedtls_x509_get_time unsigned char ** p const unsigned char * end mbedtls_x509_time * t
int int mbedtls_x509_get_serial (unsigned char **p, const unsigned char *end, mbedtls_x509_buf *serial) mbedtls_x509_get_serial unsigned char ** p const unsigned char * end mbedtls_x509_buf * serial
int int mbedtls_x509_get_ext (unsigned char **p, const unsigned char *end, mbedtls_x509_buf *ext, int tag) mbedtls_x509_get_ext unsigned char ** p const unsigned char * end mbedtls_x509_buf * ext int tag
int int mbedtls_x509_sig_alg_gets (char *buf, size_t size, const mbedtls_x509_buf *sig_oid, mbedtls_pk_type_t pk_alg, mbedtls_md_type_t md_alg, const void *sig_opts) mbedtls_x509_sig_alg_gets char * buf size_t size const mbedtls_x509_buf * sig_oid mbedtls_pk_type_t pk_alg mbedtls_md_type_t md_alg const void * sig_opts
int int mbedtls_x509_key_size_helper (char *buf, size_t buf_size, const char *name) mbedtls_x509_key_size_helper char * buf size_t buf_size const char * name
int int mbedtls_x509_string_to_names (mbedtls_asn1_named_data **head, const char *name) mbedtls_x509_string_to_names mbedtls_asn1_named_data ** head const char * name
int int mbedtls_x509_set_extension (mbedtls_asn1_named_data **head, const char *oid, size_t oid_len, int critical, const unsigned char *val, size_t val_len) mbedtls_x509_set_extension mbedtls_asn1_named_data ** head const char * oid size_t oid_len int critical const unsigned char * val size_t val_len
int int mbedtls_x509_write_extensions (unsigned char **p, unsigned char *start, mbedtls_asn1_named_data *first) mbedtls_x509_write_extensions unsigned char ** p unsigned char * start mbedtls_asn1_named_data * first
int int mbedtls_x509_write_names (unsigned char **p, unsigned char *start, mbedtls_asn1_named_data *first) mbedtls_x509_write_names unsigned char ** p unsigned char * start mbedtls_asn1_named_data * first
int int mbedtls_x509_write_sig (unsigned char **p, unsigned char *start, const char *oid, size_t oid_len, unsigned char *sig, size_t size, mbedtls_pk_type_t pk_alg) mbedtls_x509_write_sig unsigned char ** p unsigned char * start const char * oid size_t oid_len unsigned char * sig size_t size mbedtls_pk_type_t pk_alg

X.509 generic defines and structures.

    /*
    *CopyrightTheMbedTLSContributors
    *SPDX-License-Identifier:Apache-2.0ORGPL-2.0-or-later
    */
    #ifndefMBEDTLS_X509_H
    #defineMBEDTLS_X509_H

    #if!defined(MBEDTLS_CONFIG_FILE)
    #include"mbedtls/config.h"
    #else
    #includeMBEDTLS_CONFIG_FILE
    #endif

    #include"mbedtls/asn1.h"
    #include"mbedtls/pk.h"

    #ifdefined(MBEDTLS_RSA_C)
    #include"mbedtls/rsa.h"
    #endif

    #if!defined(MBEDTLS_X509_MAX_INTERMEDIATE_CA)
    #defineMBEDTLS_X509_MAX_INTERMEDIATE_CA8
    #endif

    #defineMBEDTLS_ERR_X509_FEATURE_UNAVAILABLE-0x2080
    #defineMBEDTLS_ERR_X509_UNKNOWN_OID-0x2100
    #defineMBEDTLS_ERR_X509_INVALID_FORMAT-0x2180
    #defineMBEDTLS_ERR_X509_INVALID_VERSION-0x2200
    #defineMBEDTLS_ERR_X509_INVALID_SERIAL-0x2280
    #defineMBEDTLS_ERR_X509_INVALID_ALG-0x2300
    #defineMBEDTLS_ERR_X509_INVALID_NAME-0x2380
    #defineMBEDTLS_ERR_X509_INVALID_DATE-0x2400
    #defineMBEDTLS_ERR_X509_INVALID_SIGNATURE-0x2480
    #defineMBEDTLS_ERR_X509_INVALID_EXTENSIONS-0x2500
    #defineMBEDTLS_ERR_X509_UNKNOWN_VERSION-0x2580
    #defineMBEDTLS_ERR_X509_UNKNOWN_SIG_ALG-0x2600
    #defineMBEDTLS_ERR_X509_SIG_MISMATCH-0x2680
    #defineMBEDTLS_ERR_X509_CERT_VERIFY_FAILED-0x2700
    #defineMBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT-0x2780
    #defineMBEDTLS_ERR_X509_BAD_INPUT_DATA-0x2800
    #defineMBEDTLS_ERR_X509_ALLOC_FAILED-0x2880
    #defineMBEDTLS_ERR_X509_FILE_IO_ERROR-0x2900
    #defineMBEDTLS_ERR_X509_BUFFER_TOO_SMALL-0x2980
    #defineMBEDTLS_ERR_X509_FATAL_ERROR-0x3000
    /*Reminder:updatex509_crt_verify_strings[]inlibrary/x509_crt.c*/
    #defineMBEDTLS_X509_BADCERT_EXPIRED0x01
    #defineMBEDTLS_X509_BADCERT_REVOKED0x02
    #defineMBEDTLS_X509_BADCERT_CN_MISMATCH0x04
    #defineMBEDTLS_X509_BADCERT_NOT_TRUSTED0x08
    #defineMBEDTLS_X509_BADCRL_NOT_TRUSTED0x10
    #defineMBEDTLS_X509_BADCRL_EXPIRED0x20
    #defineMBEDTLS_X509_BADCERT_MISSING0x40
    #defineMBEDTLS_X509_BADCERT_SKIP_VERIFY0x80
    #defineMBEDTLS_X509_BADCERT_OTHER0x0100
    #defineMBEDTLS_X509_BADCERT_FUTURE0x0200
    #defineMBEDTLS_X509_BADCRL_FUTURE0x0400
    #defineMBEDTLS_X509_BADCERT_KEY_USAGE0x0800
    #defineMBEDTLS_X509_BADCERT_EXT_KEY_USAGE0x1000
    #defineMBEDTLS_X509_BADCERT_NS_CERT_TYPE0x2000
    #defineMBEDTLS_X509_BADCERT_BAD_MD0x4000
    #defineMBEDTLS_X509_BADCERT_BAD_PK0x8000
    #defineMBEDTLS_X509_BADCERT_BAD_KEY0x010000
    #defineMBEDTLS_X509_BADCRL_BAD_MD0x020000
    #defineMBEDTLS_X509_BADCRL_BAD_PK0x040000
    #defineMBEDTLS_X509_BADCRL_BAD_KEY0x080000
    /*
    *X.509v3SubjectAlternativeNametypes.
    *otherName[0]OtherName,
    *rfc822Name[1]IA5String,
    *dNSName[2]IA5String,
    *x400Address[3]ORAddress,
    *directoryName[4]Name,
    *ediPartyName[5]EDIPartyName,
    *uniformResourceIdentifier[6]IA5String,
    *iPAddress[7]OCTETSTRING,
    *registeredID[8]OBJECTIDENTIFIER
    */
    #defineMBEDTLS_X509_SAN_OTHER_NAME0
    #defineMBEDTLS_X509_SAN_RFC822_NAME1
    #defineMBEDTLS_X509_SAN_DNS_NAME2
    #defineMBEDTLS_X509_SAN_X400_ADDRESS_NAME3
    #defineMBEDTLS_X509_SAN_DIRECTORY_NAME4
    #defineMBEDTLS_X509_SAN_EDI_PARTY_NAME5
    #defineMBEDTLS_X509_SAN_UNIFORM_RESOURCE_IDENTIFIER6
    #defineMBEDTLS_X509_SAN_IP_ADDRESS7
    #defineMBEDTLS_X509_SAN_REGISTERED_ID8

    /*
    *X.509v3KeyUsageExtensionflags
    *Reminder:updatex509_info_key_usage()whenaddingnewflags.
    */
    #defineMBEDTLS_X509_KU_DIGITAL_SIGNATURE(0x80)/*bit0*/
    #defineMBEDTLS_X509_KU_NON_REPUDIATION(0x40)/*bit1*/
    #defineMBEDTLS_X509_KU_KEY_ENCIPHERMENT(0x20)/*bit2*/
    #defineMBEDTLS_X509_KU_DATA_ENCIPHERMENT(0x10)/*bit3*/
    #defineMBEDTLS_X509_KU_KEY_AGREEMENT(0x08)/*bit4*/
    #defineMBEDTLS_X509_KU_KEY_CERT_SIGN(0x04)/*bit5*/
    #defineMBEDTLS_X509_KU_CRL_SIGN(0x02)/*bit6*/
    #defineMBEDTLS_X509_KU_ENCIPHER_ONLY(0x01)/*bit7*/
    #defineMBEDTLS_X509_KU_DECIPHER_ONLY(0x8000)/*bit8*/

    /*
    *Netscapecertificatetypes
    *(http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn3.html)
    */

    #defineMBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT(0x80)/*bit0*/
    #defineMBEDTLS_X509_NS_CERT_TYPE_SSL_SERVER(0x40)/*bit1*/
    #defineMBEDTLS_X509_NS_CERT_TYPE_EMAIL(0x20)/*bit2*/
    #defineMBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING(0x10)/*bit3*/
    #defineMBEDTLS_X509_NS_CERT_TYPE_RESERVED(0x08)/*bit4*/
    #defineMBEDTLS_X509_NS_CERT_TYPE_SSL_CA(0x04)/*bit5*/
    #defineMBEDTLS_X509_NS_CERT_TYPE_EMAIL_CA(0x02)/*bit6*/
    #defineMBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING_CA(0x01)/*bit7*/

    /*
    *X.509extensiontypes
    *
    *Commentsrefertothestatusforusingcertificates.Statuscanbe
    *differentforwritingcertificatesorreadingCRLsorCSRs.
    *
    *Thosearedefinedinoid.hasoid.cneedstheminadatastructure.Since
    *thesewerepreviouslydefinedhere,let'shavealiasesforcompatibility.
    */
    #defineMBEDTLS_X509_EXT_AUTHORITY_KEY_IDENTIFIERMBEDTLS_OID_X509_EXT_AUTHORITY_KEY_IDENTIFIER
    #defineMBEDTLS_X509_EXT_SUBJECT_KEY_IDENTIFIERMBEDTLS_OID_X509_EXT_SUBJECT_KEY_IDENTIFIER
    #defineMBEDTLS_X509_EXT_KEY_USAGEMBEDTLS_OID_X509_EXT_KEY_USAGE
    #defineMBEDTLS_X509_EXT_CERTIFICATE_POLICIESMBEDTLS_OID_X509_EXT_CERTIFICATE_POLICIES
    #defineMBEDTLS_X509_EXT_POLICY_MAPPINGSMBEDTLS_OID_X509_EXT_POLICY_MAPPINGS
    #defineMBEDTLS_X509_EXT_SUBJECT_ALT_NAMEMBEDTLS_OID_X509_EXT_SUBJECT_ALT_NAME/*Supported(DNS)*/
    #defineMBEDTLS_X509_EXT_ISSUER_ALT_NAMEMBEDTLS_OID_X509_EXT_ISSUER_ALT_NAME
    #defineMBEDTLS_X509_EXT_SUBJECT_DIRECTORY_ATTRSMBEDTLS_OID_X509_EXT_SUBJECT_DIRECTORY_ATTRS
    #defineMBEDTLS_X509_EXT_BASIC_CONSTRAINTSMBEDTLS_OID_X509_EXT_BASIC_CONSTRAINTS/*Supported*/
    #defineMBEDTLS_X509_EXT_NAME_CONSTRAINTSMBEDTLS_OID_X509_EXT_NAME_CONSTRAINTS
    #defineMBEDTLS_X509_EXT_POLICY_CONSTRAINTSMBEDTLS_OID_X509_EXT_POLICY_CONSTRAINTS
    #defineMBEDTLS_X509_EXT_EXTENDED_KEY_USAGEMBEDTLS_OID_X509_EXT_EXTENDED_KEY_USAGE
    #defineMBEDTLS_X509_EXT_CRL_DISTRIBUTION_POINTSMBEDTLS_OID_X509_EXT_CRL_DISTRIBUTION_POINTS
    #defineMBEDTLS_X509_EXT_INIHIBIT_ANYPOLICYMBEDTLS_OID_X509_EXT_INIHIBIT_ANYPOLICY
    #defineMBEDTLS_X509_EXT_FRESHEST_CRLMBEDTLS_OID_X509_EXT_FRESHEST_CRL
    #defineMBEDTLS_X509_EXT_NS_CERT_TYPEMBEDTLS_OID_X509_EXT_NS_CERT_TYPE

    /*
    *Storageformatidentifiers
    *Recognizedformats:PEMandDER
    */
    #defineMBEDTLS_X509_FORMAT_DER1
    #defineMBEDTLS_X509_FORMAT_PEM2

    #defineMBEDTLS_X509_MAX_DN_NAME_SIZE256
    #ifdef__cplusplus
    extern"C"{
    #endif

    typedefmbedtls_asn1_bufmbedtls_x509_buf;

    typedefmbedtls_asn1_bitstringmbedtls_x509_bitstring;

    typedefmbedtls_asn1_named_datambedtls_x509_name;

    typedefmbedtls_asn1_sequencembedtls_x509_sequence;

    typedefstructmbedtls_x509_time{
    intyear,mon,day;
    inthour,min,sec;
    }
    mbedtls_x509_time;

    intmbedtls_x509_dn_gets(char*buf,size_tsize,constmbedtls_x509_name*dn);

    intmbedtls_x509_serial_gets(char*buf,size_tsize,constmbedtls_x509_buf*serial);

    intmbedtls_x509_time_is_past(constmbedtls_x509_time*to);

    intmbedtls_x509_time_is_future(constmbedtls_x509_time*from);

    #ifdefined(MBEDTLS_SELF_TEST)

    intmbedtls_x509_self_test(intverbose);

    #endif/*MBEDTLS_SELF_TEST*/

    /*
    *Internalmodulefunctions.Youprobablydonotwanttousetheseunlessyou
    *knowyoudo.
    */
    intmbedtls_x509_get_name(unsignedchar**p,constunsignedchar*end,
    mbedtls_x509_name*cur);
    intmbedtls_x509_get_alg_null(unsignedchar**p,constunsignedchar*end,
    mbedtls_x509_buf*alg);
    intmbedtls_x509_get_alg(unsignedchar**p,constunsignedchar*end,
    mbedtls_x509_buf*alg,mbedtls_x509_buf*params);
    #ifdefined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)
    intmbedtls_x509_get_rsassa_pss_params(constmbedtls_x509_buf*params,
    mbedtls_md_type_t*md_alg,mbedtls_md_type_t*mgf_md,
    int*salt_len);
    #endif
    intmbedtls_x509_get_sig(unsignedchar**p,constunsignedchar*end,mbedtls_x509_buf*sig);
    intmbedtls_x509_get_sig_alg(constmbedtls_x509_buf*sig_oid,constmbedtls_x509_buf*sig_params,
    mbedtls_md_type_t*md_alg,mbedtls_pk_type_t*pk_alg,
    void**sig_opts);
    intmbedtls_x509_get_time(unsignedchar**p,constunsignedchar*end,
    mbedtls_x509_time*t);
    intmbedtls_x509_get_serial(unsignedchar**p,constunsignedchar*end,
    mbedtls_x509_buf*serial);
    intmbedtls_x509_get_ext(unsignedchar**p,constunsignedchar*end,
    mbedtls_x509_buf*ext,inttag);
    intmbedtls_x509_sig_alg_gets(char*buf,size_tsize,constmbedtls_x509_buf*sig_oid,
    mbedtls_pk_type_tpk_alg,mbedtls_md_type_tmd_alg,
    constvoid*sig_opts);
    intmbedtls_x509_key_size_helper(char*buf,size_tbuf_size,constchar*name);
    intmbedtls_x509_string_to_names(mbedtls_asn1_named_data**head,constchar*name);
    intmbedtls_x509_set_extension(mbedtls_asn1_named_data**head,constchar*oid,size_toid_len,
    intcritical,constunsignedchar*val,
    size_tval_len);
    intmbedtls_x509_write_extensions(unsignedchar**p,unsignedchar*start,
    mbedtls_asn1_named_data*first);
    intmbedtls_x509_write_names(unsignedchar**p,unsignedchar*start,
    mbedtls_asn1_named_data*first);
    intmbedtls_x509_write_sig(unsignedchar**p,unsignedchar*start,
    constchar*oid,size_toid_len,
    unsignedchar*sig,size_tsize,
    mbedtls_pk_type_tpk_alg);

    #defineMBEDTLS_X509_SAFE_SNPRINTF\
    do{\
    if(ret<0||(size_t)ret>=n)\
    returnMBEDTLS_ERR_X509_BUFFER_TOO_SMALL;\
    \
    n-=(size_t)ret;\
    p+=(size_t)ret;\
    }while(0)

    #ifdef__cplusplus
    }
    #endif

    #endif/*x509.h*/