#include #include #include #include const char TEST_MSRC_INCIDENT_PASSWORD_TYPE1[] = "Password1"; static const char TEST_MSRC_INCIDENT_FILE_TYPE1[] = "" "" "" ""; const BYTE TEST_MSRC_INCIDENT_EXPERT_BLOB_TYPE1[32] = "\x3C\x9C\xAE\x0B\xCE\x7A\xB1\x5C\x8A\xAC\x01\xD6\x76\x04\x5E\xDF" "\x3F\xFA\xF0\x92\xE2\xDE\x36\x8A\x20\x17\xE6\x8A\x0D\xED\x7C\x90"; const char TEST_MSRC_INCIDENT_PASSWORD_TYPE2[] = "48BJQ853X3B4"; static const char TEST_MSRC_INCIDENT_FILE_TYPE2[] = "" "" "" ""; /** * Decrypted Connection String 2: * * * * * * * * * * * * */ static int test_msrsc_incident_file_type1(void) { int status; char* pass; char* expertBlob; const char* EncryptedPassStub; size_t EncryptedPassStubLength; rdpAssistanceFile* file; file = freerdp_assistance_file_new(); if (!file) return -1; status = freerdp_assistance_parse_file_buffer(file, TEST_MSRC_INCIDENT_FILE_TYPE1, sizeof(TEST_MSRC_INCIDENT_FILE_TYPE1), TEST_MSRC_INCIDENT_PASSWORD_TYPE1); printf("freerdp_assistance_parse_file_buffer: %d\n", status); if (status < 0) return -1; freerdp_assistance_print_file(file, WLog_Get("foo"), WLOG_INFO); if (!freerdp_assistance_get_encrypted_pass_stub(file, &EncryptedPassStub, &EncryptedPassStubLength)) return -1; pass = freerdp_assistance_bin_to_hex_string(EncryptedPassStub, EncryptedPassStubLength); if (!pass) return -1; expertBlob = freerdp_assistance_construct_expert_blob("Edgar Olougouna", pass); freerdp_assistance_file_free(file); free(pass); free(expertBlob); return 0; } static int test_msrsc_incident_file_type2(void) { int status; rdpAssistanceFile* file; file = freerdp_assistance_file_new(); if (!file) return -1; status = freerdp_assistance_parse_file_buffer(file, TEST_MSRC_INCIDENT_FILE_TYPE2, sizeof(TEST_MSRC_INCIDENT_FILE_TYPE2), NULL); printf("freerdp_assistance_parse_file_buffer: %d\n", status); if (status < 0) return -1; freerdp_assistance_print_file(file, WLog_Get("foo"), WLOG_INFO); status = freerdp_assistance_decrypt(file, TEST_MSRC_INCIDENT_PASSWORD_TYPE2); printf("freerdp_assistance_decrypt: %d\n", status); if (status < 0) return -1; freerdp_assistance_file_free(file); return 0; } int TestCommonAssistance(int argc, char* argv[]) { winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT); if (test_msrsc_incident_file_type1() != 0) { printf("test_msrsc_incident_file_type1 failed\n"); return -1; } if (test_msrsc_incident_file_type2() != 0) { printf("test_msrsc_incident_file_type1 failed\n"); return -1; } return 0; }