81 lines
2.9 KiB
C
Raw Normal View History

2015-04-27 22:25:09 +02:00
#ifndef HEADER_CURL_X509ASN1_H
#define HEADER_CURL_X509ASN1_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
2022-08-04 22:12:04 +02:00
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
2015-04-27 22:25:09 +02:00
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
2021-09-14 00:13:48 +02:00
* are also available at https://curl.se/docs/copyright.html.
2015-04-27 22:25:09 +02: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.
*
2022-11-16 20:14:03 +01:00
* SPDX-License-Identifier: curl
*
2015-04-27 22:25:09 +02:00
***************************************************************************/
#include "curl_setup.h"
2015-11-17 17:22:37 +01:00
#if defined(USE_GSKIT) || defined(USE_NSS) || defined(USE_GNUTLS) || \
2021-11-20 13:41:27 +01:00
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP)
2015-04-27 22:25:09 +02:00
#include "urldata.h"
/*
* Types.
*/
/* ASN.1 parsed element. */
2020-08-30 11:54:41 +02: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. */
};
2015-04-27 22:25:09 +02:00
/* X509 certificate: RFC 5280. */
2020-08-30 11:54:41 +02: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;
};
2015-04-27 22:25:09 +02:00
/*
* Prototypes.
*/
2020-08-30 11:54:41 +02:00
int Curl_parseX509(struct Curl_X509certificate *cert,
2017-07-20 19:35:53 +02:00
const char *beg, const char *end);
2021-09-14 00:13:48 +02:00
CURLcode Curl_extract_certinfo(struct Curl_easy *data, int certnum,
2017-07-20 19:35:53 +02:00
const char *beg, const char *end);
2021-09-14 00:13:48 +02:00
CURLcode Curl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
2017-07-20 19:35:53 +02:00
const char *beg, const char *end);
2021-11-20 13:41:27 +01:00
#endif /* USE_GSKIT or USE_NSS or USE_GNUTLS or USE_WOLFSSL or USE_SCHANNEL
* or USE_SECTRANSP */
2015-04-27 22:25:09 +02:00
#endif /* HEADER_CURL_X509ASN1_H */