{"id":14155627,"url":"https://github.com/openziti/ziti-sdk-c","last_synced_at":"2026-01-16T12:27:28.983Z","repository":{"id":37367511,"uuid":"212601166","full_name":"openziti/ziti-sdk-c","owner":"openziti","description":"A C-based sdk for delivering secure applications over a Ziti Network","archived":false,"fork":false,"pushed_at":"2026-01-14T17:55:06.000Z","size":3359,"stargazers_count":82,"open_issues_count":25,"forks_count":22,"subscribers_count":8,"default_branch":"main","last_synced_at":"2026-01-14T21:38:32.780Z","etag":null,"topics":["appsec","netsec","networking","overlay-network","sdk","security","zero-trust","zero-trust-cloud","zero-trust-network","zero-trust-network-access","zero-trust-security","zerotrust","ziti-trust-network","ztaa","ztha","ztna"],"latest_commit_sha":null,"homepage":"https://openziti.io/docs/reference/developer/sdk/clang/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openziti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-10-03T14:30:24.000Z","updated_at":"2026-01-14T17:51:02.000Z","dependencies_parsed_at":"2023-10-13T06:05:35.511Z","dependency_job_id":"ed08ac65-8909-4698-b65c-b67d92e1b6c5","html_url":"https://github.com/openziti/ziti-sdk-c","commit_stats":null,"previous_names":[],"tags_count":472,"template":false,"template_full_name":null,"purl":"pkg:github/openziti/ziti-sdk-c","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openziti%2Fziti-sdk-c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openziti%2Fziti-sdk-c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openziti%2Fziti-sdk-c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openziti%2Fziti-sdk-c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openziti","download_url":"https://codeload.github.com/openziti/ziti-sdk-c/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openziti%2Fziti-sdk-c/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["appsec","netsec","networking","overlay-network","sdk","security","zero-trust","zero-trust-cloud","zero-trust-network","zero-trust-network-access","zero-trust-security","zerotrust","ziti-trust-network","ztaa","ztha","ztna"],"created_at":"2024-08-17T08:04:34.675Z","updated_at":"2026-01-16T12:27:28.958Z","avatar_url":"https://github.com/openziti.png","language":"C","funding_links":[],"categories":["security"],"sub_categories":[],"readme":"![Ziggy using the ziti-sdk-c](https://raw.githubusercontent.com/openziti/branding/main/images/banners/C.jpg)\n\n# OpenZiti C SDK\n\n![Build Status](https://github.com/openziti/ziti-sdk-c/actions/workflows/cmake.yml/badge.svg?branch=main)\n\nThe OpenZiti C SDK allows developers to create their own custom OpenZiti network endpoint applications.\n\nOpenZiti is a modern, programmable network overlay with associated edge components, for application-embedded,\nzero trust network connectivity, written by developers for developers.\nThe SDK harnesses that power via APIs that allow developers to imagine and develop solutions beyond what\nOpenZiti handles by default.\n\nThis SDK does the following:\n\n- enable network endpoint clients allow a device to [dial (access)](#dialing-a-service)\n  or [bind (host)](#binding-to-a-service) OpenZiti Services\n- provides [authentication](https://openziti.io/docs/learn/core-concepts/security/authentication/auth) interfaces for\n  [x509 certificates](#example-code-configuration) flows\n- collects and submits security posture collection/submission\n  for [Posture Checks](https://openziti.io/docs/learn/core-concepts/security/authorization/posture-checks)\n- allows applications to bind or dial services via standard [`socket`](#high-level-zitilib-api) interfaces\n\n## Configuring Your Application to use OpenZiti C SDK\n\nThe easiest way to embed Ziti SDK in your app is to pull the project into your CMake build\n\n```cmake\nFetchContent_Declare(ziti-sdk-c\n        GIT_REPOSITORY https://github.com/openziti/ziti-sdk-c.git\n        GIT_TAG ${LATEST_ZITI_RELEASE}\n        )\nFetchContent_MakeAvailable(ziti-sdk-c)\n\n# ...\n# ...\n\nadd_executable(most-secure-app-ever ${my_sources})\ntarget_link_libraries(most-secure-app-ever PRIVATE ziti)\n\n```\n\nYou will also need other libraries that OpenZiti SDK uses (they are specified in [vcpkg.json](vcpkg.json)):\n\n| library     | usage                          |\n|-------------|--------------------------------|\n| `libuv`     | event loop                     |\n| `openssl`   | TLS                            |\n| `zlib`      | HTTPS compression              |\n| `llhttp`    | HTTP parsing                   |\n| `libsodium` | OpenZiti end-to-end encryption |\n\nThere are multiple ways to get those 3rd party dependencies into your build: system level, CMake `FetchContent`, vcpkg,\netc.\nWe recommend using [`vcpkg`](https://vcpkg.io/).\n\nIf you want to contribute/build/hack this SDK in standalone mode\nsee the [BUILD.md](BUILD.md) for information on how to do it.\n\n## Using OpenZiti in Your Application\n\n### High-Level (`Zitilib`) API\n\nThe high-level API was developed to simplify embedding OpenZiti in an application.\nThe main feature of this API is presenting Ziti connections as regular socket file descriptors (or handles on Windows).\nThese sockets can be used both blocking and non-blocking modes.\n\n#### SDK Initialization and Teardown\n\nThere are just three functions that cover SDK initialization and teardown. \nAdditional steps may be required to complete authentication. See example below.\n\n| function              | purpose                                                                                                                    |\n|-----------------------|----------------------------------------------------------------------------------------------------------------------------|\n| `Ziti_lib_init()`     | initializes Ziti SDK background event loop that runs all internal SDK tasks                                                |\n| `Ziti_load_context()` | loads an enrolled [ziti identity](https://openziti.io/docs/learn/core-concepts/identities/overview) from the provided file |\n| `Ziti_lib_shutdown()` | gracefully shuts down all loaded identities and terminates the event loop                                                  |\n\n```c\n#include \u003cziti/zitilib.h\u003e\n\nint main(int argc, char *argv[]) {\n\n    const char *identity_file = process_args(argc, argv);\n\n    Ziti_lib_init();\n    \n    ziti_handle_t ztx = NULL;\n    int err = Ziti_load_context(\u0026ztx, identity_file);\n    \n    // simplest case, identity is loaded successfully with key/certificate\n    if (err == ZITI_OK) goto important_work;\n    \n    // identity does not have key/certificate or requires secondary auth with external provider\n    if (err == ZITI_EXTERNAL_LOGIN_REQUIRED) {\n        // optional step: query supported external login providers\n        ziti_jwt_signer_array signers = Ziti_get_ext_signers(ztx);\n\n        // select\n        const char *singer = ...; // prompt user or use a known provider\n        \n        char *url = Ziti_login_external(ztx, signer);\n        // prompt user to open URL in browser\n\n        // wait for external login to complete\n        err = Ziti_wait_for_auth(ztx, 60000); // wait for a minute\n    }\n    \n    // identity requires TOTP code for secondary authentication\n    if (err == ZITI_PARTIALLY_AUTHENTICATED) {\n        char *code = ...; // prompt user for TOTP code\n        err = Ziti_login_totp(ztx, code);\n    }\n    \n    if (err != ZITI_OK) {\n        fprintf(stderr, \"Failed to load identity: %s\\n\", Ziti_strerror(rc));\n        // handle error, e.g. exit\n    }\n    \nimportant_work:\n    ...\n    \n\n\n    Ziti_lib_shutdown();\n}\n```\n\nOnce `ziti_context` is loaded it can be used to dial a service or bind to a service (provided the identity has proper\naccess to it).\n\n#### Dialing a service\n\n| function                                       | usage                                                              |\n|------------------------------------------------|--------------------------------------------------------------------|\n| `Ziti_connect(sock, ztx, service, terminator)` | connects given socket to the service/terminator within the context |\n| `Ziti_connect_addr(sock, hostname, port)`      | connects given socket to the specified intercept address           |\n\n```c\n      ziti_socket_t sock = Ziti_socket(SOCK_STREAM);\n      int error = Ziti_connect(sock, ztx, \"my-secure-service\", NULL);\n\n      // use sock as normal socket\n      do {\n          write(sock, ...);\n          read(sock, ...);\n\n      } while (!done);\n\n      close(sock);\n\n```\n\n#### Binding to a service\n\n| function                                   | usage                                                                       |\n|--------------------------------------------|-----------------------------------------------------------------------------|\n| `Ziti_bind(srv, ztx, service, terminator)` | binds given socket to the service/terminator within the context             |\n| `Ziti_listen(sock, backlog)`               | sets maximum number of pending inbound connections (similar to TCP backlog) |\n| `Ziti_accept(srv, caller, caller_len)`     | accepts incoming connection and returns peer socket/handle                  |\n\n```c\n      ziti_socket_t srv = Ziti_socket(SOCK_STREAM);\n      int error = Ziti_bind(srv, ztx, \"my-secure-service\", NULL);\n      Ziti_listen(srv, 10); // sets accept backlog\n\n      do {\n          char caller[128];\n          ziti_socket_t clt = Ziti_accept(srv, caller, (int)sizeof(caller));\n\n          // use client as normal socket\n          process_client(clt);\n\n      } while (!done);\n\n      close(srv);\n```\n\n## Getting Help\n\n------------\nPlease use these community resources for getting help. We use GitHub [issues](https://github.com/openziti/ziti-sdk-c/issues)\nfor tracking bugs and feature requests and have limited bandwidth to address them.\n\n- Read [the docs](https://docs.openziti.io/)\n- Ask a question on [Discourse](https://openziti.discourse.group/)\n\nCopyright\u0026copy; NetFoundry Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenziti%2Fziti-sdk-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenziti%2Fziti-sdk-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenziti%2Fziti-sdk-c/lists"}