SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
SharkSslEx.h
Go to the documentation of this file.
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 * SharkSSL Embedded SSL/TLS Stack
10 ****************************************************************************
11 * PROGRAM MODULE
12 *
13 * $Id: SharkSslEx.h 6825 2026-11-10 21:17:44Z wini $
14 *
15 * COPYRIGHT: Real Time Logic LLC, 2013 - 2026
16 *
17 * This software is copyrighted by and is the sole property of Real
18 * Time Logic LLC. All rights, title, ownership, or other interests in
19 * the software remain the property of Real Time Logic LLC. This
20 * software may only be used in accordance with the terms and
21 * conditions stipulated in the corresponding license agreement under
22 * which the software has been supplied. Any unauthorized use,
23 * duplication, transmission, distribution, or disclosure of this
24 * software is expressly forbidden.
25 *
26 * This Copyright notice may not be removed or modified without prior
27 * written consent of Real Time Logic LLC.
28 *
29 * Real Time Logic LLC. reserves the right to modify this software
30 * without notice.
31 *
32 * http://www.realtimelogic.com
33 * http://www.sharkssl.com
34 ****************************************************************************
35 *
36 */
37#ifndef _SharkSslEx_h
38#define _SharkSslEx_h
39
40#include "SharkSSL.h"
41
42/* Macro set for the host-integrated build */
43#ifndef ThreadLib_hpp
44#ifndef BaTime
45#include <time.h>
46typedef time_t BaTime;
47#endif
48#endif
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
56{
57 U8 *ptr, *dataptr;
59}
61
64typedef struct SubjectAltName
65{
66 U8 *ptr;
68 U8 tag;
70
71#define SubjectAltName_getTag(o) ((o)->tag)
72#define SubjectAltName_getLen(o) ((o)->len)
73#define SubjectAltName_getPtr(o) ((o)->ptr)
74#define SubjectAltName_isValid(o) (NULL != SubjectAltName_getPtr(o))
75
78#define SubjectAltNameEnumerator_nextElement SubjectAltNameEnumerator_getElement
79
83#define SUBJECTALTNAME_OTHERNAME 0
84#define SUBJECTALTNAME_RFC822NAME 1
85#define SUBJECTALTNAME_DNSNAME 2
86#define SUBJECTALTNAME_X400ADDRESS 3
87#define SUBJECTALTNAME_DIRECTORYNAME 4
88#define SUBJECTALTNAME_EDIPARTYNAME 5
89#define SUBJECTALTNAME_URI 6
90#define SUBJECTALTNAME_IPADDRESS 7
91
92
95SHARKSSL_API int sharkStrCaseCmp(
96 const char *a, int aLen, const char *b, int bLen);
97
98
106 const char *cn, U16 cnLen, U8 *subjAltPtr, SharkSslSANLen subjAltLen, const char *name, U16 nameLen);
107
112SHARKSSL_API BaTime sharkParseCertTime(const U8 *utc, U8 len);
113
114
115
121typedef enum
122{
126
131
136
142
147
157
158#if SHARKSSL_CHECK_DATE == 0
159#define SharkSslConTrust_CertCnDate SharkSslConTrust_CertCn
160#endif
161
162 /* end group SharkSslInfoAndCodes */
164
187 SharkSslCon *o, const char *name, SharkSslCertInfo **cPtr);
188 /* end group SharkSslApi */
190
191#ifdef __cplusplus
192}
193#endif
194
195#endif
TLS objects, certificate/session operations, and public-key interfaces.
U16 SharkSslSANLen
Preserve 16-bit Subject Alternative Name lengths unless the configured handshake limit permits a cert...
Definition: SharkSSL.h:664
struct SubjectAltNameEnumerator SubjectAltNameEnumerator
SubjectAltName Iterator.
time_t BaTime
Definition: SharkSslEx.h:46
SHARKSSL_API int sharkSubjectSubjectAltCmp(const char *cn, U16 cnLen, U8 *subjAltPtr, SharkSslSANLen subjAltLen, const char *name, U16 nameLen)
Compare a length-delimited ASCII reference name with the certificate.
struct SubjectAltName SubjectAltName
SubjectAltName.
SHARKSSL_API int sharkStrCaseCmp(const char *a, int aLen, const char *b, int bLen)
Case insensitive string compare.
SHARKSSL_API BaTime sharkParseCertTime(const U8 *utc, U8 len)
Converts the expected certificate time string format YY[YY]MMDDHHMMSSZ to seconds since Jan 1,...
SHARKSSL_API SharkSslConTrust SharkSslCon_trusted(SharkSslCon *o, const char *name, SharkSslCertInfo **cPtr)
Return the peer's trust status and certificate.
SHARKSSL_API void SubjectAltNameEnumerator_constructor(SubjectAltNameEnumerator *o, U8 *ptr, SharkSslSANLen len)
Initialize a cursor over encoded subject alternative names.
SHARKSSL_API void SubjectAltNameEnumerator_getElement(SubjectAltNameEnumerator *o, SubjectAltName *s)
Return the next SAN and advance the cursor.
struct SharkSslCon SharkSslCon
SharkSslCon is an opaque handle returned by function SharkSsl_createCon.
Definition: SharkSSL.h:495
SharkSslConTrust
SharkSslCon_trusted return values
Definition: SharkSslEx.h:122
@ SharkSslConTrust_Cn
The subject's common name matches the host name of the URL, but the certificate is not trusted.
Definition: SharkSslEx.h:141
@ SharkSslConTrust_CertCnDate
This value is returned instead of SharkSslConTrust_CertCn when a certificate is trusted and the Shark...
Definition: SharkSslEx.h:155
@ SharkSslConTrust_None
The SSL certificate is not trusted and the subject's common name does not matches the host name of th...
Definition: SharkSslEx.h:130
@ SharkSslConTrust_NotSSL
Not a secure connection (SSL handshake not completed).
Definition: SharkSslEx.h:125
@ SharkSslConTrust_Cert
Domain mismatch: The SSL certificate is trusted but the subject's common name does not matches the ho...
Definition: SharkSslEx.h:135
@ SharkSslConTrust_CertCn
The peer's SSL certificate is trusted and the subject's common name matches the host name of the URL.
Definition: SharkSslEx.h:146
The peer's certificate information returned by SharkSslCon_getCertInfo.
Definition: SharkSSL.h:796
SubjectAltName Iterator.
Definition: SharkSslEx.h:56
U8 * ptr
Definition: SharkSslEx.h:57
U32 len
Definition: SharkSslEx.h:58
U32 datalen
Definition: SharkSslEx.h:58
U8 * dataptr
Definition: SharkSslEx.h:57
SubjectAltName.
Definition: SharkSslEx.h:65
U8 * ptr
Definition: SharkSslEx.h:66
U8 tag
Definition: SharkSslEx.h:68
SharkSslSANLen len
Definition: SharkSslEx.h:67