|
| int | RM_CERT_DeleteAll (void) |
| | Delete all the certificates stored in the flash memory. More...
|
| |
| rm_cert_err_t | RM_CERT_Write (rm_cert_module_t module, rm_cert_type_t type, rm_cert_format_t format, uint8_t *in, size_t inlen) |
| | Write the certificate specified by module and type to the flash memory. More...
|
| |
| rm_cert_err_t | RM_CERT_Read (rm_cert_module_t module, rm_cert_type_t type, rm_cert_format_t *format, uint8_t *out, size_t *outlen) |
| | Read the certificate specified by module and type from the flash memory. More...
|
| |
| rm_cert_err_t | RM_CERT_Delete (rm_cert_module_t module, rm_cert_type_t type) |
| | Delete the certificate specified by module and type from the flash memory. More...
|
| |
| int | RM_CERT_IsExistCert (rm_cert_module_t module, rm_cert_type_t type) |
| | Check whether the certificate specified by module and type exists or not in the flash memory. More...
|
| |
| rm_cert_module_t | RM_CERT_GetModule (uint32_t flash_addr) |
| | Get module ID from specific flash memory address. More...
|
| |
| rm_cert_type_t | RM_CERT_GetType (uint32_t flash_addr) |
| | Get certificate type from specific flash memory address. More...
|
| |
| int | RM_CERT_IsPemFormat (const char *buf) |
| | Check whether the certificate is pem format or not. More...
|
| |
This module reads/writes/deletes certificates from/to flash memory.
There is no clock configuration for the rm_cert module.
This module does not use I/O pins.
This is a basic example of minimal use of the RM_CERT module in an application.
#include "rm_cert.h"
static void error_handler ();
void rm_cert_example ();
#define EXAMPLE_ROOTCA \
"-----BEGIN CERTIFICATE-----\n" \
"MIIDUTCCAjkCFE5zJ+Pa9oKE1/+wPkASd2rm53KHMA0GCSqGSIb3DQEBCwUAMGUx\n" \
"CzAJBgNVBAYTAmpwMQ4wDAYDVQQIDAVPc2FrYTESMBAGA1UEBwwJT3Nha2Etc2hp\n" \
"MRYwFAYDVQQKDA0iRXhhbXBsZSBJbmMiMQwwCgYDVQQLDANGb28xDDAKBgNVBAMM\n" \
"A3RlazAeFw0yNDA5MTAyMjI0NTBaFw0yNTA5MTAyMjI0NTBaMGUxCzAJBgNVBAYT\n" \
"AmpwMQ4wDAYDVQQIDAVPc2FrYTESMBAGA1UEBwwJT3Nha2Etc2hpMRYwFAYDVQQK\n" \
"DA0iRXhhbXBsZSBJbmMiMQwwCgYDVQQLDANGb28xDDAKBgNVBAMMA3RlazCCASIw\n" \
"DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANJbt7+igiNpXlquBLnbn2urT9sz\n" \
"g5NKG7vL6JckAYm9Am/M/KGrcN3U7z6AKQI0Zt0uigN4b5QF3aeVqbwKXJO8lYCS\n" \
"LeRpyl64pXwIuSQa0x21SNFqojDLl7Bk520DqD76mG1MLq/HZirR6R5+VIJV182x\n" \
"c5ZqhskWLPQJ+ASdkYxYbma2FWeLClfJIdo6L6q1om6OB9jIc3wWqfE9ZFo7JHH2\n" \
"5fJAErRAF4jgVGFZOsXW8eVxjT5uTXHT7NKIqGmMjRjUlO/n5IBcsD+PE/jJh/Br\n" \
"gy+wU3cgfYudmirzueuoQipgrmCTBg5TCiXYrXQchwjenRjm3+PG1JLU/UcCAwEA\n" \
"ATANBgkqhkiG9w0BAQsFAAOCAQEAHTeQqLy6aB+GqDEfs6tE3p3kZOkjSw29hZDg\n" \
"CBnbGsh4BrGO/GBesTuRIV6Gl2g8tsGVeHMSnYw50hMtoLeDIjWL2jOElDlV/xxG\n" \
"6DOYGNYQ3W3uqsu4oEBZyoPTXEikeSB9i5AQUlqvH6vRxj35TD/U61Yd6sibT1OY\n" \
"jzk0NC1VmhHao3XcAsvJxxrkwj+vjMfairl6AYrSUqm0YImnxSnymF1f72rR+ZbP\n" \
"TEh6ddww5+UjlYt3arWx7EtZ1GGBTL1WJQXcdVKYn6/AUbqdhXWghO47KDjy8cAM\n" \
"k7+DzGzGV4OTzGjLKCZYKveYCIPCTaacnv/yALJG+p9qvi26UQ==\n" \
"-----END CERTIFICATE-----\n"
const char * p_root_ca;
uint32_t root_ca_size;
static void error_handler ()
{
}
void rm_cert_example ()
{
unsigned char buf[CERT_MAX_LENGTH] = {};
size_t buflen = CERT_MAX_LENGTH;
p_root_ca = EXAMPLE_ROOTCA;
root_ca_size = sizeof(EXAMPLE_ROOTCA);
(unsigned char *)p_root_ca, root_ca_size);
{
error_handler();
}
buf, &buflen);
{
error_handler();
}
{
{
error_handler();
}
}
}