x509asn1.h
Go to the documentation of this file.
00001 #ifndef HEADER_CURL_X509ASN1_H
00002 #define HEADER_CURL_X509ASN1_H
00003 
00004 /***************************************************************************
00005  *                                  _   _ ____  _
00006  *  Project                     ___| | | |  _ \| |
00007  *                             / __| | | | |_) | |
00008  *                            | (__| |_| |  _ <| |___
00009  *                             \___|\___/|_| \_\_____|
00010  *
00011  * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
00012  *
00013  * This software is licensed as described in the file COPYING, which
00014  * you should have received as part of this distribution. The terms
00015  * are also available at https://curl.haxx.se/docs/copyright.html.
00016  *
00017  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
00018  * copies of the Software, and permit persons to whom the Software is
00019  * furnished to do so, under the terms of the COPYING file.
00020  *
00021  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
00022  * KIND, either express or implied.
00023  *
00024  ***************************************************************************/
00025 
00026 #include "curl_setup.h"
00027 
00028 #if defined(USE_GSKIT) || defined(USE_NSS) || defined(USE_GNUTLS) || \
00029     defined(USE_CYASSL) || defined(USE_SCHANNEL)
00030 
00031 #include "urldata.h"
00032 
00033 /*
00034  * Constants.
00035  */
00036 
00037 /* Largest supported ASN.1 structure. */
00038 #define CURL_ASN1_MAX                   ((size_t) 0x40000)      /* 256K */
00039 
00040 /* ASN.1 classes. */
00041 #define CURL_ASN1_UNIVERSAL             0
00042 #define CURL_ASN1_APPLICATION           1
00043 #define CURL_ASN1_CONTEXT_SPECIFIC      2
00044 #define CURL_ASN1_PRIVATE               3
00045 
00046 /* ASN.1 types. */
00047 #define CURL_ASN1_BOOLEAN               1
00048 #define CURL_ASN1_INTEGER               2
00049 #define CURL_ASN1_BIT_STRING            3
00050 #define CURL_ASN1_OCTET_STRING          4
00051 #define CURL_ASN1_NULL                  5
00052 #define CURL_ASN1_OBJECT_IDENTIFIER     6
00053 #define CURL_ASN1_OBJECT_DESCRIPTOR     7
00054 #define CURL_ASN1_INSTANCE_OF           8
00055 #define CURL_ASN1_REAL                  9
00056 #define CURL_ASN1_ENUMERATED            10
00057 #define CURL_ASN1_EMBEDDED              11
00058 #define CURL_ASN1_UTF8_STRING           12
00059 #define CURL_ASN1_RELATIVE_OID          13
00060 #define CURL_ASN1_SEQUENCE              16
00061 #define CURL_ASN1_SET                   17
00062 #define CURL_ASN1_NUMERIC_STRING        18
00063 #define CURL_ASN1_PRINTABLE_STRING      19
00064 #define CURL_ASN1_TELETEX_STRING        20
00065 #define CURL_ASN1_VIDEOTEX_STRING       21
00066 #define CURL_ASN1_IA5_STRING            22
00067 #define CURL_ASN1_UTC_TIME              23
00068 #define CURL_ASN1_GENERALIZED_TIME      24
00069 #define CURL_ASN1_GRAPHIC_STRING        25
00070 #define CURL_ASN1_VISIBLE_STRING        26
00071 #define CURL_ASN1_GENERAL_STRING        27
00072 #define CURL_ASN1_UNIVERSAL_STRING      28
00073 #define CURL_ASN1_CHARACTER_STRING      29
00074 #define CURL_ASN1_BMP_STRING            30
00075 
00076 
00077 /*
00078  * Types.
00079  */
00080 
00081 /* ASN.1 parsed element. */
00082 typedef struct {
00083   const char *  header;         /* Pointer to header byte. */
00084   const char *  beg;            /* Pointer to element data. */
00085   const char *  end;            /* Pointer to 1st byte after element. */
00086   unsigned char class;          /* ASN.1 element class. */
00087   unsigned char tag;            /* ASN.1 element tag. */
00088   bool          constructed;    /* Element is constructed. */
00089 }  curl_asn1Element;
00090 
00091 
00092 /* ASN.1 OID table entry. */
00093 typedef struct {
00094   const char *  numoid;         /* Dotted-numeric OID. */
00095   const char *  textoid;        /* OID name. */
00096 }  curl_OID;
00097 
00098 
00099 /* X509 certificate: RFC 5280. */
00100 typedef struct {
00101   curl_asn1Element      certificate;
00102   curl_asn1Element      version;
00103   curl_asn1Element      serialNumber;
00104   curl_asn1Element      signatureAlgorithm;
00105   curl_asn1Element      signature;
00106   curl_asn1Element      issuer;
00107   curl_asn1Element      notBefore;
00108   curl_asn1Element      notAfter;
00109   curl_asn1Element      subject;
00110   curl_asn1Element      subjectPublicKeyInfo;
00111   curl_asn1Element      subjectPublicKeyAlgorithm;
00112   curl_asn1Element      subjectPublicKey;
00113   curl_asn1Element      issuerUniqueID;
00114   curl_asn1Element      subjectUniqueID;
00115   curl_asn1Element      extensions;
00116 }  curl_X509certificate;
00117 
00118 
00119 /*
00120  * Prototypes.
00121  */
00122 
00123 const char *Curl_getASN1Element(curl_asn1Element *elem,
00124                                  const char *beg, const char *end);
00125 const char *Curl_ASN1tostr(curl_asn1Element *elem, int type);
00126 const char *Curl_DNtostr(curl_asn1Element *dn);
00127 int Curl_parseX509(curl_X509certificate *cert,
00128                    const char *beg, const char *end);
00129 CURLcode Curl_extract_certinfo(struct connectdata *conn, int certnum,
00130                                const char *beg, const char *end);
00131 CURLcode Curl_verifyhost(struct connectdata *conn,
00132                          const char *beg, const char *end);
00133 #endif /* USE_GSKIT or USE_NSS or USE_GNUTLS or USE_CYASSL or USE_SCHANNEL */
00134 #endif /* HEADER_CURL_X509ASN1_H */


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:07