Functions
CertManager API

Functions

WOLFSSL_API WOLFSSL_CERT_MANAGERwolfSSL_CertManagerNew_ex (void *heap)
 Allocates and initializes a new Certificate Manager context. This context may be used independent of SSL needs. It may be used to load certificates, verify certificates, and check the revocation status. More...
 
WOLFSSL_API WOLFSSL_CERT_MANAGERwolfSSL_CertManagerNew (void)
 Allocates and initializes a new Certificate Manager context. This context may be used independent of SSL needs. It may be used to load certificates, verify certificates, and check the revocation status. More...
 
WOLFSSL_API void wolfSSL_CertManagerFree (WOLFSSL_CERT_MANAGER *)
 Frees all resources associated with the Certificate Manager context. Call this when you no longer need to use the Certificate Manager. More...
 
WOLFSSL_API int wolfSSL_CertManagerLoadCA (WOLFSSL_CERT_MANAGER *, const char *f, const char *d)
 Specifies the locations for CA certificate loading into the manager context. The PEM certificate CAfile may contain several trusted CA certificates. If CApath is not NULL it specifies a directory containing CA certificates in PEM format. More...
 
WOLFSSL_API int wolfSSL_CertManagerLoadCABuffer (WOLFSSL_CERT_MANAGER *, const unsigned char *in, long sz, int format)
 Loads the CA Buffer by calling wolfSSL_CTX_load_verify_buffer and returning that result using a temporary cm so as not to lose the information in the cm passed into the function. More...
 
WOLFSSL_API int wolfSSL_CertManagerUnloadCAs (WOLFSSL_CERT_MANAGER *cm)
 This function unloads the CA signer list. More...
 
WOLFSSL_API int wolfSSL_CertManagerUnload_trust_peers (WOLFSSL_CERT_MANAGER *cm)
 The function will free the Trusted Peer linked list and unlocks the trusted peer list. More...
 
WOLFSSL_API int wolfSSL_CertManagerVerify (WOLFSSL_CERT_MANAGER *, const char *f, int format)
 Specifies the certificate to verify with the Certificate Manager context. The format can be SSL_FILETYPE_PEM or SSL_FILETYPE_ASN1. More...
 
WOLFSSL_API int wolfSSL_CertManagerVerifyBuffer (WOLFSSL_CERT_MANAGER *cm, const unsigned char *buff, long sz, int format)
 Specifies the certificate buffer to verify with the Certificate Manager context. The format can be SSL_FILETYPE_PEM or SSL_FILETYPE_ASN1. More...
 
WOLFSSL_API int wolfSSL_CertManagerEnableCRL (WOLFSSL_CERT_MANAGER *, int options)
 Turns on Certificate Revocation List checking when verifying certificates with the Certificate Manager. By default, CRL checking is off. options include WOLFSSL_CRL_CHECKALL which performs CRL checking on each certificate in the chain versus the Leaf certificate only which is the default. More...
 
WOLFSSL_API int wolfSSL_CertManagerDisableCRL (WOLFSSL_CERT_MANAGER *)
 Turns off Certificate Revocation List checking when verifying certificates with the Certificate Manager. By default, CRL checking is off. You can use this function to temporarily or permanently disable CRL checking with this Certificate Manager context that previously had CRL checking enabled. More...
 
WOLFSSL_API int wolfSSL_CertManagerLoadCRL (WOLFSSL_CERT_MANAGER *, const char *, int, int)
 Error checks and passes through to LoadCRL() in order to load the cert into the CRL for revocation checking. More...
 
WOLFSSL_API int wolfSSL_CertManagerLoadCRLBuffer (WOLFSSL_CERT_MANAGER *, const unsigned char *, long sz, int)
 The function loads the CRL file by calling BufferLoadCRL. More...
 
WOLFSSL_API int wolfSSL_CertManagerSetCRL_Cb (WOLFSSL_CERT_MANAGER *, CbMissingCRL)
 This function sets the CRL Certificate Manager callback. If HAVE_CRL is defined and a matching CRL record is not found then the cbMissingCRL is called (set via wolfSSL_CertManagerSetCRL_Cb). This allows you to externally retrieve the CRL and load it. More...
 
WOLFSSL_API int wolfSSL_CertManagerCheckOCSP (WOLFSSL_CERT_MANAGER *, unsigned char *, int sz)
 The function enables the WOLFSSL_CERT_MANAGER’s member, ocspEnabled to signify that the OCSP check option is enabled. More...
 
WOLFSSL_API int wolfSSL_CertManagerEnableOCSP (WOLFSSL_CERT_MANAGER *, int options)
 Turns on OCSP if it’s turned off and if compiled with the set option available. More...
 
WOLFSSL_API int wolfSSL_CertManagerDisableOCSP (WOLFSSL_CERT_MANAGER *)
 Disables OCSP certificate revocation. More...
 
WOLFSSL_API int wolfSSL_CertManagerSetOCSPOverrideURL (WOLFSSL_CERT_MANAGER *, const char *)
 The function copies the url to the ocspOverrideURL member of the WOLFSSL_CERT_MANAGER structure. More...
 
WOLFSSL_API int wolfSSL_CertManagerSetOCSP_Cb (WOLFSSL_CERT_MANAGER *, CbOCSPIO, CbOCSPRespFree, void *)
 The function sets the OCSP callback in the WOLFSSL_CERT_MANAGER. More...
 
WOLFSSL_API int wolfSSL_CertManagerEnableOCSPStapling (WOLFSSL_CERT_MANAGER *cm)
 This function turns on OCSP stapling if it is not turned on as well as set the options. More...
 

Detailed Description

Function Documentation

◆ wolfSSL_CertManagerCheckOCSP()

WOLFSSL_API int wolfSSL_CertManagerCheckOCSP ( WOLFSSL_CERT_MANAGER ,
unsigned char *  ,
int  sz 
)

The function enables the WOLFSSL_CERT_MANAGER’s member, ocspEnabled to signify that the OCSP check option is enabled.

Returns
SSL_SUCCESS returned on successful execution of the function. The ocspEnabled member of the WOLFSSL_CERT_MANAGER is enabled.
BAD_FUNC_ARG returned if the WOLFSSL_CERT_MANAGER structure is NULL or if an argument value that is not allowed is passed to a subroutine.
MEMORY_E returned if there is an error allocating memory within this function or a subroutine.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().
dera byte pointer to the certificate.
szan int type representing the size of the DER cert.

Example

#import <wolfssl/ssl.h>
WOLFSSL* ssl = wolfSSL_new(ctx);
byte* der;
int sz; size of der
...
if(wolfSSL_CertManagerCheckOCSP(cm, der, sz) != SSL_SUCCESS){
Failure case.
}
See also
ParseCertRelative
CheckCertOCSP

◆ wolfSSL_CertManagerDisableCRL()

WOLFSSL_API int wolfSSL_CertManagerDisableCRL ( WOLFSSL_CERT_MANAGER )

Turns off Certificate Revocation List checking when verifying certificates with the Certificate Manager. By default, CRL checking is off. You can use this function to temporarily or permanently disable CRL checking with this Certificate Manager context that previously had CRL checking enabled.

Returns
SSL_SUCCESS If successful the call will return.
BAD_FUNC_ARG is the error that will be returned if a function pointer is not provided.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().

Example

#include <wolfssl/ssl.h>
int ret = 0;
...
if (ret != SSL_SUCCESS) {
error disabling cert manager
}
...
See also
wolfSSL_CertManagerEnableCRL

◆ wolfSSL_CertManagerDisableOCSP()

WOLFSSL_API int wolfSSL_CertManagerDisableOCSP ( WOLFSSL_CERT_MANAGER )

Disables OCSP certificate revocation.

Returns
SSL_SUCCESS wolfSSL_CertMangerDisableCRL successfully disabled the crlEnabled member of the WOLFSSL_CERT_MANAGER structure.
BAD_FUNC_ARG the WOLFSSL structure was NULL.
Parameters
ssl- a pointer to a WOLFSSL structure, created using wolfSSL_new().

Example

#include <wolfssl/ssl.h>
WOLFSSL* ssl = wolfSSL_new(ctx);
...
if(wolfSSL_CertManagerDisableOCSP(ssl) != SSL_SUCCESS){
Fail case.
}
See also
wolfSSL_DisableCRL

◆ wolfSSL_CertManagerEnableCRL()

WOLFSSL_API int wolfSSL_CertManagerEnableCRL ( WOLFSSL_CERT_MANAGER ,
int  options 
)

Turns on Certificate Revocation List checking when verifying certificates with the Certificate Manager. By default, CRL checking is off. options include WOLFSSL_CRL_CHECKALL which performs CRL checking on each certificate in the chain versus the Leaf certificate only which is the default.

Returns
SSL_SUCCESS If successful the call will return.
NOT_COMPILED_IN will be returned if wolfSSL was not built with CRL enabled.
MEMORY_E will be returned if an out of memory condition occurs.
BAD_FUNC_ARG is the error that will be returned if a pointer is not provided.
SSL_FAILURE will be returned if the CRL context cannot be initialized properly.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().
optionsoptions to use when enabling the Certification Manager, cm.

Example

#include <wolfssl/ssl.h>
int ret = 0;
...
if (ret != SSL_SUCCESS) {
error enabling cert manager
}
...
See also
wolfSSL_CertManagerDisableCRL

◆ wolfSSL_CertManagerEnableOCSP()

WOLFSSL_API int wolfSSL_CertManagerEnableOCSP ( WOLFSSL_CERT_MANAGER ,
int  options 
)

Turns on OCSP if it’s turned off and if compiled with the set option available.

Returns
SSL_SUCCESS returned if the function call is successful.
BAD_FUNC_ARG if cm struct is NULL.
MEMORY_E if WOLFSSL_OCSP struct value is NULL.
SSL_FAILURE initialization of WOLFSSL_OCSP struct fails to initialize.
NOT_COMPILED_IN build not compiled with correct feature enabled.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().
optionsused to set values in WOLFSSL_CERT_MANAGER struct.

Example

#include <wolfssl/ssl.h>
WOLFSSL_CTX* ctx = wolfSSL_CTX_new(protocol method);
WOLFSSL* ssl = wolfSSL_new(ctx);
int options;
if(wolfSSL_CertManagerEnableOCSP(ssl->ctx->cm, options) != SSL_SUCCESS){
Failure case.
}
See also
wolfSSL_CertManagerNew

◆ wolfSSL_CertManagerEnableOCSPStapling()

WOLFSSL_API int wolfSSL_CertManagerEnableOCSPStapling ( WOLFSSL_CERT_MANAGER cm)

This function turns on OCSP stapling if it is not turned on as well as set the options.

Returns
SSL_SUCCESS returned if there were no errors and the function executed successfully.
BAD_FUNC_ARG returned if the WOLFSSL_CERT_MANAGER structure is NULL or otherwise if there was a unpermitted argument value passed to a subroutine.
MEMORY_E returned if there was an issue allocating memory.
SSL_FAILURE returned if the initialization of the OCSP structure failed.
NOT_COMPILED_IN returned if wolfSSL was not compiled with HAVE_CERTIFICATE_STATUS_REQUEST option.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, a member of the WOLFSSL_CTX structure.

Example

See also
wolfSSL_CTX_EnableOCSPStapling

◆ wolfSSL_CertManagerFree()

WOLFSSL_API void wolfSSL_CertManagerFree ( WOLFSSL_CERT_MANAGER )

Frees all resources associated with the Certificate Manager context. Call this when you no longer need to use the Certificate Manager.

Returns
none
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().

Example

#include <wolfssl/ssl.h>
...
wolfSSL_CertManagerFree(cm);
See also
wolfSSL_CertManagerNew

◆ wolfSSL_CertManagerLoadCA()

WOLFSSL_API int wolfSSL_CertManagerLoadCA ( WOLFSSL_CERT_MANAGER ,
const char *  f,
const char *  d 
)

Specifies the locations for CA certificate loading into the manager context. The PEM certificate CAfile may contain several trusted CA certificates. If CApath is not NULL it specifies a directory containing CA certificates in PEM format.

Returns
SSL_SUCCESS If successful the call will return.
SSL_BAD_FILETYPE will be returned if the file is the wrong format.
SSL_BAD_FILE will be returned if the file doesn’t exist, can’t be read, or is corrupted.
MEMORY_E will be returned if an out of memory condition occurs.
ASN_INPUT_E will be returned if Base16 decoding fails on the file.
BAD_FUNC_ARG is the error that will be returned if a pointer is not provided.
SSL_FATAL_ERROR - will be returned upon failure.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().
filepointer to the name of the file containing CA certificates to load.
pathpointer to the name of a directory path containing CA c ertificates to load. The NULL pointer may be used if no certificate directory is desired.

Example

#include <wolfssl/ssl.h>
int ret = 0;
...
ret = wolfSSL_CertManagerLoadCA(cm, “path/to/cert-file.pem”, 0);
if (ret != SSL_SUCCESS) {
// error loading CA certs into cert manager
}
See also
wolfSSL_CertManagerVerify

◆ wolfSSL_CertManagerLoadCABuffer()

WOLFSSL_API int wolfSSL_CertManagerLoadCABuffer ( WOLFSSL_CERT_MANAGER ,
const unsigned char *  in,
long  sz,
int  format 
)

Loads the CA Buffer by calling wolfSSL_CTX_load_verify_buffer and returning that result using a temporary cm so as not to lose the information in the cm passed into the function.

Returns
SSL_FATAL_ERROR is returned if the WOLFSSL_CERT_MANAGER struct is NULL or if wolfSSL_CTX_new() returns NULL.
SSL_SUCCESS is returned for a successful execution.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().
inbuffer for cert information.
szlength of the buffer.
formatcertificate format, either PEM or DER.

Example

const unsigned char* in;
long sz;
int format;
if(wolfSSL_CertManagerLoadCABuffer(vp, sz, format) != SSL_SUCCESS){
Error returned. Failure case code block.
}
See also
wolfSSL_CTX_load_verify_buffer
ProcessChainBuffer
ProcessBuffer
cm_pick_method

◆ wolfSSL_CertManagerLoadCRL()

WOLFSSL_API int wolfSSL_CertManagerLoadCRL ( WOLFSSL_CERT_MANAGER ,
const char *  ,
int  ,
int   
)

Error checks and passes through to LoadCRL() in order to load the cert into the CRL for revocation checking.

Returns
SSL_SUCCESS if there is no error in wolfSSL_CertManagerLoadCRL and if LoadCRL returns successfully.
BAD_FUNC_ARG if the WOLFSSL_CERT_MANAGER struct is NULL.
SSL_FATAL_ERROR if wolfSSL_CertManagerEnableCRL returns anything other than SSL_SUCCESS.
BAD_PATH_ERROR if the path is NULL.
MEMORY_E if LoadCRL fails to allocate heap memory.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().
patha constant char pointer holding the CRL path.
typetype of certificate to be loaded.
monitorrequests monitoring in LoadCRL().

Example

#include <wolfssl/ssl.h>
int wolfSSL_LoadCRL(WOLFSSL* ssl, const char* path, int type,
int monitor);
wolfSSL_CertManagerLoadCRL(ssl->ctx->cm, path, type, monitor);
See also
wolfSSL_CertManagerEnableCRL
wolfSSL_LoadCRL

◆ wolfSSL_CertManagerLoadCRLBuffer()

WOLFSSL_API int wolfSSL_CertManagerLoadCRLBuffer ( WOLFSSL_CERT_MANAGER ,
const unsigned char *  ,
long  sz,
int   
)

The function loads the CRL file by calling BufferLoadCRL.

Returns
SSL_SUCCESS returned if the function completed without errors.
BAD_FUNC_ARG returned if the WOLFSSL_CERT_MANAGER is NULL.
SSL_FATAL_ERROR returned if there is an error associated with the WOLFSSL_CERT_MANAGER.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure.
buffa constant byte type and is the buffer.
sza long int representing the size of the buffer.
typea long integer that holds the certificate type.

Example

#include <wolfssl/ssl.h>
const unsigned char* buff;
long sz; size of buffer
int type; cert type
...
int ret = wolfSSL_CertManagerLoadCRLBuffer(cm, buff, sz, type);
if(ret == SSL_SUCCESS){
return ret;
} else {
Failure case.
}
See also
BufferLoadCRL
wolfSSL_CertManagerEnableCRL

◆ wolfSSL_CertManagerNew()

WOLFSSL_API WOLFSSL_CERT_MANAGER* wolfSSL_CertManagerNew ( void  )

Allocates and initializes a new Certificate Manager context. This context may be used independent of SSL needs. It may be used to load certificates, verify certificates, and check the revocation status.

Returns
WOLFSSL_CERT_MANAGER If successful the call will return a valid WOLFSSL_CERT_MANAGER pointer.
NULL will be returned for an error state.
Parameters
noneNo parameters.

Example

#import <wolfssl/ssl.h>
if (cm == NULL) {
// error creating new cert manager
}
See also
wolfSSL_CertManagerFree

◆ wolfSSL_CertManagerNew_ex()

WOLFSSL_API WOLFSSL_CERT_MANAGER* wolfSSL_CertManagerNew_ex ( void *  heap)

Allocates and initializes a new Certificate Manager context. This context may be used independent of SSL needs. It may be used to load certificates, verify certificates, and check the revocation status.

Returns
WOLFSSL_CERT_MANAGER If successful the call will return a valid WOLFSSL_CERT_MANAGER pointer.
NULL will be returned for an error state.
Parameters
noneNo parameters.
See also
wolfSSL_CertManagerFree

◆ wolfSSL_CertManagerSetCRL_Cb()

WOLFSSL_API int wolfSSL_CertManagerSetCRL_Cb ( WOLFSSL_CERT_MANAGER ,
CbMissingCRL   
)

This function sets the CRL Certificate Manager callback. If HAVE_CRL is defined and a matching CRL record is not found then the cbMissingCRL is called (set via wolfSSL_CertManagerSetCRL_Cb). This allows you to externally retrieve the CRL and load it.

Returns
SSL_SUCCESS returned upon successful execution of the function and subroutines.
BAD_FUNC_ARG returned if the WOLFSSL_CERT_MANAGER structure is NULL.
Parameters
cmthe WOLFSSL_CERT_MANAGER structure holding the information for the certificate.
cba function pointer to (*CbMissingCRL) that is set to the cbMissingCRL member of the WOLFSSL_CERT_MANAGER.

Example

#include <wolfssl/ssl.h>
WOLFSSL_CTX* ctx = wolfSSL_CTX_new(protocol method);
WOLFSSL* ssl = wolfSSL_new(ctx);
void cb(const char* url){
Function body.
}
CbMissingCRL cb = CbMissingCRL;
if(ctx){
return wolfSSL_CertManagerSetCRL_Cb(ssl->ctx->cm, cb);
}
See also
CbMissingCRL
wolfSSL_SetCRL_Cb

◆ wolfSSL_CertManagerSetOCSP_Cb()

WOLFSSL_API int wolfSSL_CertManagerSetOCSP_Cb ( WOLFSSL_CERT_MANAGER ,
CbOCSPIO  ,
CbOCSPRespFree  ,
void *   
)

The function sets the OCSP callback in the WOLFSSL_CERT_MANAGER.

Returns
SSL_SUCCESS returned on successful execution. The arguments are saved in the WOLFSSL_CERT_MANAGER structure.
BAD_FUNC_ARG returned if the WOLFSSL_CERT_MANAGER is NULL.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure.
ioCba function pointer of type CbOCSPIO.
respFreeCb- a function pointer of type CbOCSPRespFree.
ioCbCtx- a void pointer variable to the I/O callback user registered context.

Example

#include <wolfssl/ssl.h>
wolfSSL_SetOCSP_Cb(WOLFSSL* ssl, CbOCSPIO ioCb,
CbOCSPRespFree respFreeCb, void* ioCbCtx){
return wolfSSL_CertManagerSetOCSP_Cb(ssl->ctx->cm, ioCb, respFreeCb, ioCbCtx);
See also
wolfSSL_CertManagerSetOCSPOverrideURL
wolfSSL_CertManagerCheckOCSP
wolfSSL_CertManagerEnableOCSPStapling
wolfSSL_ENableOCSP
wolfSSL_DisableOCSP
wolfSSL_SetOCSP_Cb

◆ wolfSSL_CertManagerSetOCSPOverrideURL()

WOLFSSL_API int wolfSSL_CertManagerSetOCSPOverrideURL ( WOLFSSL_CERT_MANAGER ,
const char *   
)

The function copies the url to the ocspOverrideURL member of the WOLFSSL_CERT_MANAGER structure.

Returns
SSL_SUCCESS the function was able to execute as expected.
BAD_FUNC_ARG the WOLFSSL_CERT_MANAGER struct is NULL.
MEMEORY_E Memory was not able to be allocated for the ocspOverrideURL member of the certificate manager.
Parameters
ssla pointer to a WOLFSSL structure, created using wolfSSL_new().

Example

#include <wolfssl/ssl.h>
const char* url;
int wolfSSL_SetOCSP_OverrideURL(WOLFSSL* ssl, const char* url)
if(wolfSSL_CertManagerSetOCSPOverrideURL(ssl->ctx->cm, url) != SSL_SUCCESS){
Failure case.
}
See also
ocspOverrideURL
wolfSSL_SetOCSP_OverrideURL

◆ wolfSSL_CertManagerUnload_trust_peers()

WOLFSSL_API int wolfSSL_CertManagerUnload_trust_peers ( WOLFSSL_CERT_MANAGER cm)

The function will free the Trusted Peer linked list and unlocks the trusted peer list.

Returns
SSL_SUCCESS if the function completed normally.
BAD_FUNC_ARG if the WOLFSSL_CERT_MANAGER is NULL.
BAD_MUTEX_E mutex error if tpLock, a member of the WOLFSSL_CERT_MANAGER struct, is 0 (nill).
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().

Example

#include <wolfssl/ssl.h>
WOLFSSL_CTX* ctx = WOLFSSL_CTX_new(Protocol define);
...
The function did not execute successfully.
}
See also
UnLockMutex

◆ wolfSSL_CertManagerUnloadCAs()

WOLFSSL_API int wolfSSL_CertManagerUnloadCAs ( WOLFSSL_CERT_MANAGER cm)

This function unloads the CA signer list.

Returns
SSL_SUCCESS returned on successful execution of the function.
BAD_FUNC_ARG returned if the WOLFSSL_CERT_MANAGER is NULL.
BAD_MUTEX_E returned if there was a mutex error.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().

Example

#include <wolfssl/ssl.h>
WOLFSSL_CTX* ctx = wolfSSL_CTX_new(protocol method);
...
if(wolfSSL_CertManagerUnloadCAs(ctx->cm) != SSL_SUCCESS){
Failure case.
}
See also
FreeSignerTable
UnlockMutex

◆ wolfSSL_CertManagerVerify()

WOLFSSL_API int wolfSSL_CertManagerVerify ( WOLFSSL_CERT_MANAGER ,
const char *  f,
int  format 
)

Specifies the certificate to verify with the Certificate Manager context. The format can be SSL_FILETYPE_PEM or SSL_FILETYPE_ASN1.

Returns
SSL_SUCCESS If successfull.
ASN_SIG_CONFIRM_E will be returned if the signature could not be verified.
ASN_SIG_OID_E will be returned if the signature type is not supported.
CRL_CERT_REVOKED is an error that is returned if this certificate has been revoked.
CRL_MISSING is an error that is returned if a current issuer CRL is not available.
ASN_BEFORE_DATE_E will be returned if the current date is before the before date.
ASN_AFTER_DATE_E will be returned if the current date is after the after date.
SSL_BAD_FILETYPE will be returned if the file is the wrong format.
SSL_BAD_FILE will be returned if the file doesn’t exist, can’t be read, or is corrupted.
MEMORY_E will be returned if an out of memory condition occurs.
ASN_INPUT_E will be returned if Base16 decoding fails on the file.
BAD_FUNC_ARG is the error that will be returned if a pointer is not provided.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().
fnamepointer to the name of the file containing the certificates to verify.
formatformat of the certificate to verify - either SSL_FILETYPE_ASN1 or SSL_FILETYPE_PEM.

Example

int ret = 0;
...
ret = wolfSSL_CertManagerVerify(cm, “path/to/cert-file.pem”,
SSL_FILETYPE_PEM);
if (ret != SSL_SUCCESS) {
error verifying certificate
}
See also
wolfSSL_CertManagerLoadCA
wolfSSL_CertManagerVerifyBuffer

◆ wolfSSL_CertManagerVerifyBuffer()

WOLFSSL_API int wolfSSL_CertManagerVerifyBuffer ( WOLFSSL_CERT_MANAGER cm,
const unsigned char *  buff,
long  sz,
int  format 
)

Specifies the certificate buffer to verify with the Certificate Manager context. The format can be SSL_FILETYPE_PEM or SSL_FILETYPE_ASN1.

Returns
SSL_SUCCESS If successful.
ASN_SIG_CONFIRM_E will be returned if the signature could not be verified.
ASN_SIG_OID_E will be returned if the signature type is not supported.
CRL_CERT_REVOKED is an error that is returned if this certificate has been revoked.
CRL_MISSING is an error that is returned if a current issuer CRL is not available.
ASN_BEFORE_DATE_E will be returned if the current date is before the before date.
ASN_AFTER_DATE_E will be returned if the current date is after the after date.
SSL_BAD_FILETYPE will be returned if the file is the wrong format.
SSL_BAD_FILE will be returned if the file doesn’t exist, can’t be read, or is corrupted.
MEMORY_E will be returned if an out of memory condition occurs.
ASN_INPUT_E will be returned if Base16 decoding fails on the file.
BAD_FUNC_ARG is the error that will be returned if a pointer is not provided.
Parameters
cma pointer to a WOLFSSL_CERT_MANAGER structure, created using wolfSSL_CertManagerNew().
buffbuffer containing the certificates to verify.
szsize of the buffer, buf.
formatformat of the certificate to verify, located in buf - either SSL_FILETYPE_ASN1 or SSL_FILETYPE_PEM.

Example

#include <wolfssl/ssl.h>
int ret = 0;
int sz = 0;
byte certBuff[...];
...
ret = wolfSSL_CertManagerVerifyBuffer(cm, certBuff, sz, SSL_FILETYPE_PEM);
if (ret != SSL_SUCCESS) {
error verifying certificate
}
See also
wolfSSL_CertManagerLoadCA
wolfSSL_CertManagerVerify