24#if defined(NB_SSL_SUPPORTED) || defined(NB_SSH_SUPPORTED)
26#include <crypto/ssl.h>
27#include <crypto/wolfssl/wolfcrypt/ecc.h>
30#define MAX_CERT_SNAME_LEN 64
33#if defined(HAVE_ECC) && defined(ENABLE_ECCKEY_CREATE)
35#elif defined(ENABLE_RSAKEY_CREATE)
56#if defined(SSL_KEY_ECC)
104 const char * m_country;
105 const char * m_state;
106 const char * m_locality;
109 const char * m_email;
149#include <config_obj.h>
151extern const char * DEFAULT_CERT_COUNTRY;
152extern const char * DEFAULT_CERT_STATE;
153extern const char * DEFAULT_CERT_LOCALITY;
154extern const char * DEFAULT_CERT_ORG;
155extern const char * DEFAULT_CERT_UNIT;
156extern const char * DEFAULT_CERT_EMAIL;
157extern const char * DEFAULT_CERT_COM_NAME;
158extern const char * DEFAULT_CERT_ALT_NAMES;
176 CertData(
const char * Country=DEFAULT_CERT_COUNTRY,
177 const char * State=DEFAULT_CERT_STATE,
178 const char * Locality=DEFAULT_CERT_LOCALITY,
179 const char * Org=DEFAULT_CERT_ORG,
180 const char * Unit=DEFAULT_CERT_UNIT,
181 const char * Email=DEFAULT_CERT_EMAIL,
182 const char * Name=DEFAULT_CERT_COM_NAME,
183 const char * AltNames=DEFAULT_CERT_ALT_NAMES
184 ) :
config_obj(sys,
"CertData" ,
"Object to hold the data for certificate generation"),
185 m_country(Country,
"Country"),
186 m_state (State,
"State"),
187 m_locality(Locality,
"Locality"),
190 m_email(Email,
"Email"),
191 m_comname(Name,
"Comname"),
192 m_altNames(AltNames,
"AltNames")
Lightweight alternative to C++ CString class.
Definition nbstring.h:118
Base class used to create configuration objects.
Definition config_obj.h:320
String Configuration Variable.
Definition config_obj.h:1127
CertGenReturnCode
Certificate Generation Function Return Codes.
Definition certgen.h:77
void FillInAltNamesASN1(Cert &TheCert, NBString &altNameString)
Helper function used to build ASN1 representation of alt names.
CertGenReturnCode SSL_CreateNewSelfSignedCert(CertGenData &pGenData)
Generates a new self-signed certificate that will be stored on the device.
CertGenReturnCode CheckAndCreateHalCertAndKey()
Check for a valid SSL certificate and generate one if not found.
SslKeyType_t
Certificate Generation Key Types.
Definition certgen.h:45
CertGenData * GetDataForCertGen()
A function to be overridden to pass certificate details to the certificate generator.
Definition SSL/SslOnboardCertGeneration/CompiledCa/src/main.cpp:17
void EnableOnboardCertificateCreation(CertGenReturnCode(*createCertFunc)(CertGenData &cGenData)=SSL_CreateNewSelfSignedCert)
Enables the ability for the module to automatically generate self-signed certificates for use in SSL/...
AltNameType_t
Certificate Generation Alternate Name Types.
Definition certgen.h:66
@ CERT_GEN_RETURN_NOT_REQUIRED
Returned when the a new certificate was not required to be generated.
Definition certgen.h:79
@ CERT_GEN_RETURN_CERT_SAVING_ERROR
Returned when the device was unable to properly save the certificate.
Definition certgen.h:89
@ CERT_GEN_RETURN_CERT_INIT_ERROR
Returned when the device was unable to initialize the required certificate object.
Definition certgen.h:86
@ CERT_GEN_RETURN_INVALID_RANDOM
Returned when the device was unable to generate a valid random number.
Definition certgen.h:80
@ CERT_GEN_RETURN_RSA_INIT_ERROR
Returned when the device was unable to initialize the required RSA object.
Definition certgen.h:84
@ CERT_GEN_RETURN_CERT_SIGNING_ERROR
Returned when the device was unable to sign the created certificate.
Definition certgen.h:88
@ CERT_GEN_RETURN_SUCCESS
Returned when the certificate was successfully generated.
Definition certgen.h:78
@ CERT_GEN_RETURN_MALLOC_ERROR
Returned when the device is unable to malloc enough space to generate the certificate.
Definition certgen.h:81
@ CERT_GEN_RETURN_CERT_CREATE_ERROR
Returned when the device was unable to create the certificate.
Definition certgen.h:87
@ CERT_GEN_RETURN_KEY_SAVING_ERROR
Returned when the device was unable to save the key.
Definition certgen.h:91
@ CERT_GEN_RETURN_ECC_CREATE_ERROR
Returned when the device was unable to create the ECC key.
Definition certgen.h:83
@ CERT_GEN_RETURN_SET_ISSUER_ERROR
Returned when the device was unable to set the issuer if a CA was used.
Definition certgen.h:92
@ CERT_GEN_RETURN_ECC_INIT_ERROR
Returned when the device was unable to initialize the required ECC object.
Definition certgen.h:82
@ CERT_GEN_RETURN_KEY_CONVERT_ERROR
Returned when the device was unable to convert the certificate from PEM to DER format.
Definition certgen.h:90
@ CERT_GEN_RETURN_RSA_CREATE_ERROR
Returned when the device was unable to create the RSA key.
Definition certgen.h:85
@ SSL_KEY_RSA_1024
RSA 1024.
Definition certgen.h:52
@ SSL_KEY_ECC_SECP224R1
Defined in wolfssl/wolfcrypt/ecc.h.
Definition certgen.h:48
@ SSL_KEY_ECC_SECP384R1
Defined in wolfssl/wolfcrypt/ecc.h.
Definition certgen.h:50
@ SSL_KEY_ECC_SECP192R1
Defined in wolfssl/wolfcrypt/ecc.h.
Definition certgen.h:47
@ SSL_KEY_ECC_SECP521R1
Defined in wolfssl/wolfcrypt/ecc.h.
Definition certgen.h:51
@ SSL_KEY_RSA_4096
RSA 4096.
Definition certgen.h:54
@ SSL_KEY_RSA_2048
RSA 2048.
Definition certgen.h:53
@ SSL_KEY_ECC_SECP256R1
Defined in wolfssl/wolfcrypt/ecc.h.
Definition certgen.h:49
@ ALT_NAME_TYPE_IP
IP Address.
Definition certgen.h:69
@ ALT_NAME_TYPE_NONE
None.
Definition certgen.h:67
@ ALT_NAME_TYPE_DNS
DNS Name.
Definition certgen.h:68
Used to store the information that is passed in when enabling onboard generated certificates,...
Definition certgen.h:101
const char * m_commonName
Common Name.
Definition certgen.h:110
NBString m_altNamesString
Alternate names string.
Definition certgen.h:112
time_t m_certExpTime
Certificate expiration time.
Definition certgen.h:134
int m_yrsValid
Number of years.
Definition certgen.h:111