int main() { int result; if (platform_init() == 0 && initialize_hsm_system() == 0) { HSM_CLIENT_HANDLE hsm_handle; if ((hsm_handle = hsm_client_riot_create()) == NULL) { (void)printf("Failure getting common name\r\n"); result = __LINE__; } else { char* enroll_type = get_user_input("Would you like to do Individual (i) or Group (g) enrollments: ", 1); if (enroll_type != NULL) { if (enroll_type[0] == 'g' || enroll_type[0] == 'G') { if (ca_root_certificate_info(hsm_handle) != 0) { result = __LINE__; } else { result = 0; } } else { if (alias_certificate_info(hsm_handle) != 0) { result = __LINE__; } else { result = 0; } } free(enroll_type); } else { (void)printf("Invalid option specified\r\n"); result = __LINE__; } hsm_client_riot_destroy(hsm_handle); } deinitialize_hsm_system(); platform_deinit(); } else { (void)printf("Failed calling platform_init\r\n"); result = __LINE__; } (void)printf("Press any key to continue:\r\n"); (void)getchar(); return result; }
void iothub_security_deinit() { deinitialize_hsm_system(); }