2017-09-19 08:34:08 +00:00
|
|
|
|
2014-04-24 19:34:45 +00:00
|
|
|
// X509Cert.cpp
|
|
|
|
|
2017-08-30 14:00:06 +00:00
|
|
|
// Implements the cX509Cert class representing a wrapper over X509 certs in mbedTLS
|
2014-04-24 19:34:45 +00:00
|
|
|
|
|
|
|
#include "Globals.h"
|
|
|
|
#include "X509Cert.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cX509Cert::cX509Cert(void)
|
|
|
|
{
|
2017-08-30 14:00:06 +00:00
|
|
|
mbedtls_x509_crt_init(&m_Cert);
|
2014-04-24 19:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cX509Cert::~cX509Cert()
|
|
|
|
{
|
2017-08-30 14:00:06 +00:00
|
|
|
mbedtls_x509_crt_free(&m_Cert);
|
2014-04-24 19:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cX509Cert::Parse(const void * a_CertContents, size_t a_Size)
|
|
|
|
{
|
2017-08-30 14:00:06 +00:00
|
|
|
return mbedtls_x509_crt_parse(&m_Cert, reinterpret_cast<const unsigned char *>(a_CertContents), a_Size);
|
2014-04-24 19:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|