2013-07-16 00:16:13 +08:00
|
|
|
#ifndef HEADER_CURL_X509ASN1_H
|
|
|
|
#define HEADER_CURL_X509ASN1_H
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2023-01-02 20:51:48 +08:00
|
|
|
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
2013-07-16 00:16:13 +08:00
|
|
|
*
|
|
|
|
* This software is licensed as described in the file COPYING, which
|
|
|
|
* you should have received as part of this distribution. The terms
|
2020-11-04 21:02:01 +08:00
|
|
|
* are also available at https://curl.se/docs/copyright.html.
|
2013-07-16 00:16:13 +08:00
|
|
|
*
|
|
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
* copies of the Software, and permit persons to whom the Software is
|
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
2020-05-14 06:05:04 +08:00
|
|
|
* SPDX-License-Identifier: curl
|
2022-05-17 17:16:50 +08:00
|
|
|
*
|
2013-07-16 00:16:13 +08:00
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include "curl_setup.h"
|
|
|
|
|
2023-08-07 19:02:32 +08:00
|
|
|
#if defined(USE_GNUTLS) || defined(USE_WOLFSSL) || \
|
2023-07-30 05:44:28 +08:00
|
|
|
defined(USE_SCHANNEL) || defined(USE_SECTRANSP)
|
2013-07-16 00:16:13 +08:00
|
|
|
|
2022-11-22 16:55:41 +08:00
|
|
|
#include "cfilters.h"
|
2013-07-16 00:16:13 +08:00
|
|
|
#include "urldata.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Types.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ASN.1 parsed element. */
|
2020-05-14 06:05:04 +08:00
|
|
|
struct Curl_asn1Element {
|
|
|
|
const char *header; /* Pointer to header byte. */
|
|
|
|
const char *beg; /* Pointer to element data. */
|
|
|
|
const char *end; /* Pointer to 1st byte after element. */
|
|
|
|
unsigned char class; /* ASN.1 element class. */
|
|
|
|
unsigned char tag; /* ASN.1 element tag. */
|
|
|
|
bool constructed; /* Element is constructed. */
|
|
|
|
};
|
2013-07-16 00:16:13 +08:00
|
|
|
|
|
|
|
/* X509 certificate: RFC 5280. */
|
2020-05-14 06:05:04 +08:00
|
|
|
struct Curl_X509certificate {
|
|
|
|
struct Curl_asn1Element certificate;
|
|
|
|
struct Curl_asn1Element version;
|
|
|
|
struct Curl_asn1Element serialNumber;
|
|
|
|
struct Curl_asn1Element signatureAlgorithm;
|
|
|
|
struct Curl_asn1Element signature;
|
|
|
|
struct Curl_asn1Element issuer;
|
|
|
|
struct Curl_asn1Element notBefore;
|
|
|
|
struct Curl_asn1Element notAfter;
|
|
|
|
struct Curl_asn1Element subject;
|
|
|
|
struct Curl_asn1Element subjectPublicKeyInfo;
|
|
|
|
struct Curl_asn1Element subjectPublicKeyAlgorithm;
|
|
|
|
struct Curl_asn1Element subjectPublicKey;
|
|
|
|
struct Curl_asn1Element issuerUniqueID;
|
|
|
|
struct Curl_asn1Element subjectUniqueID;
|
|
|
|
struct Curl_asn1Element extensions;
|
|
|
|
};
|
2013-07-16 00:16:13 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Prototypes.
|
|
|
|
*/
|
|
|
|
|
2020-05-14 06:05:04 +08:00
|
|
|
int Curl_parseX509(struct Curl_X509certificate *cert,
|
2016-11-23 14:53:24 +08:00
|
|
|
const char *beg, const char *end);
|
2021-01-09 00:58:15 +08:00
|
|
|
CURLcode Curl_extract_certinfo(struct Curl_easy *data, int certnum,
|
2016-11-23 14:53:24 +08:00
|
|
|
const char *beg, const char *end);
|
2022-11-22 16:55:41 +08:00
|
|
|
CURLcode Curl_verifyhost(struct Curl_cfilter *cf, struct Curl_easy *data,
|
2016-11-23 14:53:24 +08:00
|
|
|
const char *beg, const char *end);
|
2023-08-07 19:02:32 +08:00
|
|
|
#endif /* USE_GNUTLS or USE_WOLFSSL or USE_SCHANNEL or USE_SECTRANSP */
|
2013-07-16 00:16:13 +08:00
|
|
|
#endif /* HEADER_CURL_X509ASN1_H */
|