Go to the documentation of this file.00001 #ifndef HEADER_CURL_X509ASN1_H
00002 #define HEADER_CURL_X509ASN1_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
00035
00036
00037
00038 #define CURL_ASN1_MAX ((size_t) 0x40000)
00039
00040
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
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
00079
00080
00081
00082 typedef struct {
00083 const char * header;
00084 const char * beg;
00085 const char * end;
00086 unsigned char class;
00087 unsigned char tag;
00088 bool constructed;
00089 } curl_asn1Element;
00090
00091
00092
00093 typedef struct {
00094 const char * numoid;
00095 const char * textoid;
00096 } curl_OID;
00097
00098
00099
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
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
00134 #endif