{"id":18535947,"url":"https://github.com/tencent-rtc/tls-sig-api-v2-cpp","last_synced_at":"2025-05-15T00:34:29.352Z","repository":{"id":260442976,"uuid":"881242171","full_name":"Tencent-RTC/tls-sig-api-v2-cpp","owner":"Tencent-RTC","description":"This C++ project implements Tencent-RTC's UserSig authentication","archived":false,"fork":false,"pushed_at":"2024-10-31T10:26:40.000Z","size":676,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-26T03:24:30.028Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://trtc.io","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tencent-RTC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-31T07:14:11.000Z","updated_at":"2024-10-31T10:32:51.000Z","dependencies_parsed_at":"2024-10-31T11:25:18.261Z","dependency_job_id":"448fa20a-be18-4529-b46c-8d13ef584d31","html_url":"https://github.com/Tencent-RTC/tls-sig-api-v2-cpp","commit_stats":null,"previous_names":["tencent-rtc/tls-sig-api-v2-cpp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tencent-RTC%2Ftls-sig-api-v2-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tencent-RTC%2Ftls-sig-api-v2-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tencent-RTC%2Ftls-sig-api-v2-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tencent-RTC%2Ftls-sig-api-v2-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tencent-RTC","download_url":"https://codeload.github.com/Tencent-RTC/tls-sig-api-v2-cpp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239251001,"owners_count":19607552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T19:28:54.552Z","updated_at":"2025-02-17T07:28:02.661Z","avatar_url":"https://github.com/Tencent-RTC.png","language":"C","readme":"## Note\nThis C++  project implements Tencent-RTC's UserSig authentication, providing a secure server-side method for generating signatures to protect the keys from leakage.\n\n![](https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/12569f72920411ef810152540055f650.png)\n\n## Download code and sync dependencies\n```shell\ngit clone https://github.com/tencentcloud/tls-sig-api-v2-cpp.git\ncd tls-sig-api-v2-cpp\ngit submodule update --init --recursive\n```\n\nIf the above code sync fails, download the source code [here](https://github.com/tencentcloud/tls-sig-api-v2-cpp/releases).\n\n## Build\n\n### Unix-like system\n`CMake` 、 `Make` and `GCC` are required for project building. Ensure that they have been installed.\n```shell\ncmake CMakeLists.txt\ncmake --build .\n```\n\nIf you need to manually specify the OpenSSL path, add the following commands when running the `cmake CMakeLists.txt`  command:\n```shell\ncmake  -DOPENSSL_ROOT_DIR=your_openssl_root_dir CMakeLists.txt\ncmake --build .\n```\n\nThe header file path is as follows:\n```\nsrc/tls_sig_api_v2.h\n```\n\nThe library file path is as follows:\n```\n\n./libtlssigapi_v2.a\n```\n\nIn addition to linking `libtlssigapi_v2.a`, you need to introduce `zlib`  and `openssl` when building a project. They usually come with Unix-like systems, and you only need to add the following command:\n```\n-lz -lcrypto\n```\n\n### Windows\nProject building in Windows depends on `CMake` and `Visual Studio`. Ensure that they have been installed.\n\n```\n.\\build.bat\n```\n\nThe header file path is as follows:\n\n```\nsrc/tls_sig_api_v2.h\n```\n\nThe library file paths are as follows (including Win32 and x64 as well as Debug and Release versions):\n```\ntls-sig-api_xx/xxxx/tlssigapi_v2.lib\ntls-sig-api_xx/xxxx/zlibstatic.lib\ntls-sig-api_xx/xxxx/mbedcrypto.lib\n```\nzlib of the Debug version is named zlibstaticd.lib.\n\nWhen building a project, you only need to reference the header file `src/tls_sig_api_v2.h` and the three library files above.\n\n## Usage\n\n### API usage\n\n```C\n#include \"tls_sig_api_v2.h\"\n#include \u003cstring\u003e\n#include \u003ciostream\u003e\n\nstd::string key = \"5bd2850fff3ecb11d7c805251c51ee463a25727bddc2385f3fa8bfee1bb93b5e\";\n\nstd::string sig;\nstd::sgring errmsg;\nint ret = genUserSig(140000000, \"xiaojun\", key, 180*86400, sig, errmsg);\nif (0 != ret) {\n\tstd::cout \u003c\u003c \"genUserSig failed \" \u003c\u003c ret \u003c\u003c \" \" \u003c\u003c errmsg \u003c\u003c std::endl;\n} else {\n\tstd::cout \u003c\u003c \"genUserSig \" \u003c\u003c sig \u003c\u003c std::endl;\n}\n\n```\n\n### Multi-thread support\nBecause Unix-like systems use OpenSSL by default, you need to call the following function during multi-thread program initialization. This issue does not exist in the Windows version.\n```C\nthread_setup();\n```\nCall the following function when the program ends:\n```C\nthread_cleanup();\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftencent-rtc%2Ftls-sig-api-v2-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftencent-rtc%2Ftls-sig-api-v2-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftencent-rtc%2Ftls-sig-api-v2-cpp/lists"}