1 | #ifndef HEADER_CURL_X509ASN1_H
|
---|
2 | #define HEADER_CURL_X509ASN1_H
|
---|
3 |
|
---|
4 | /***************************************************************************
|
---|
5 | * _ _ ____ _
|
---|
6 | * Project ___| | | | _ \| |
|
---|
7 | * / __| | | | |_) | |
|
---|
8 | * | (__| |_| | _ <| |___
|
---|
9 | * \___|\___/|_| \_\_____|
|
---|
10 | *
|
---|
11 | * Copyright (C) 1998 - 2022, Daniel Stenberg, <[email protected]>, et al.
|
---|
12 | *
|
---|
13 | * This software is licensed as described in the file COPYING, which
|
---|
14 | * you should have received as part of this distribution. The terms
|
---|
15 | * are also available at https://curl.se/docs/copyright.html.
|
---|
16 | *
|
---|
17 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
---|
18 | * copies of the Software, and permit persons to whom the Software is
|
---|
19 | * furnished to do so, under the terms of the COPYING file.
|
---|
20 | *
|
---|
21 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
---|
22 | * KIND, either express or implied.
|
---|
23 | *
|
---|
24 | ***************************************************************************/
|
---|
25 |
|
---|
26 | #include "curl_setup.h"
|
---|
27 |
|
---|
28 | #if defined(USE_GSKIT) || defined(USE_NSS) || defined(USE_GNUTLS) || \
|
---|
29 | defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP)
|
---|
30 |
|
---|
31 | #include "urldata.h"
|
---|
32 |
|
---|
33 | /*
|
---|
34 | * Types.
|
---|
35 | */
|
---|
36 |
|
---|
37 | /* ASN.1 parsed element. */
|
---|
38 | struct Curl_asn1Element {
|
---|
39 | const char *header; /* Pointer to header byte. */
|
---|
40 | const char *beg; /* Pointer to element data. */
|
---|
41 | const char *end; /* Pointer to 1st byte after element. */
|
---|
42 | unsigned char class; /* ASN.1 element class. */
|
---|
43 | unsigned char tag; /* ASN.1 element tag. */
|
---|
44 | bool constructed; /* Element is constructed. */
|
---|
45 | };
|
---|
46 |
|
---|
47 | /* X509 certificate: RFC 5280. */
|
---|
48 | struct Curl_X509certificate {
|
---|
49 | struct Curl_asn1Element certificate;
|
---|
50 | struct Curl_asn1Element version;
|
---|
51 | struct Curl_asn1Element serialNumber;
|
---|
52 | struct Curl_asn1Element signatureAlgorithm;
|
---|
53 | struct Curl_asn1Element signature;
|
---|
54 | struct Curl_asn1Element issuer;
|
---|
55 | struct Curl_asn1Element notBefore;
|
---|
56 | struct Curl_asn1Element notAfter;
|
---|
57 | struct Curl_asn1Element subject;
|
---|
58 | struct Curl_asn1Element subjectPublicKeyInfo;
|
---|
59 | struct Curl_asn1Element subjectPublicKeyAlgorithm;
|
---|
60 | struct Curl_asn1Element subjectPublicKey;
|
---|
61 | struct Curl_asn1Element issuerUniqueID;
|
---|
62 | struct Curl_asn1Element subjectUniqueID;
|
---|
63 | struct Curl_asn1Element extensions;
|
---|
64 | };
|
---|
65 |
|
---|
66 | /*
|
---|
67 | * Prototypes.
|
---|
68 | */
|
---|
69 |
|
---|
70 | int Curl_parseX509(struct Curl_X509certificate *cert,
|
---|
71 | const char *beg, const char *end);
|
---|
72 | CURLcode Curl_extract_certinfo(struct Curl_easy *data, int certnum,
|
---|
73 | const char *beg, const char *end);
|
---|
74 | CURLcode Curl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
|
---|
75 | const char *beg, const char *end);
|
---|
76 | #endif /* USE_GSKIT or USE_NSS or USE_GNUTLS or USE_WOLFSSL or USE_SCHANNEL
|
---|
77 | * or USE_SECTRANSP */
|
---|
78 | #endif /* HEADER_CURL_X509ASN1_H */
|
---|