{"id":19579725,"url":"https://github.com/wolfssl/wolfhsm-examples","last_synced_at":"2025-04-27T08:31:53.318Z","repository":{"id":222864841,"uuid":"754826714","full_name":"wolfSSL/wolfHSM-examples","owner":"wolfSSL","description":"wolfHSM examples repository","archived":false,"fork":false,"pushed_at":"2025-02-18T21:23:47.000Z","size":195,"stargazers_count":4,"open_issues_count":0,"forks_count":9,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-04T23:11:15.288Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wolfSSL.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-02-08T20:49:46.000Z","updated_at":"2024-12-06T21:12:21.000Z","dependencies_parsed_at":"2024-04-19T17:44:48.818Z","dependency_job_id":"3fa3e13f-d650-4f1b-9e91-a69d88001afe","html_url":"https://github.com/wolfSSL/wolfHSM-examples","commit_stats":null,"previous_names":["wolfssl/wolfhsm-examples"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfSSL%2FwolfHSM-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfSSL%2FwolfHSM-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfSSL%2FwolfHSM-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfSSL%2FwolfHSM-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wolfSSL","download_url":"https://codeload.github.com/wolfSSL/wolfHSM-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251112529,"owners_count":21538162,"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-11T07:18:46.062Z","updated_at":"2025-04-27T08:31:49.316Z","avatar_url":"https://github.com/wolfSSL.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wolfHSM-examples\n\nThis repository contains examples code demonstrating how to use various wolfHSM features. The examples provided are split between port-agnostic demo code, and port-specific server/client applications that use the aformentioned demo code.\n\n- `demo/`: port-agnostic demonstration code (`demo/`). This code is intended to be used as a reference for how to use wolfHSM features, and are organized by high-level wolfHSM feature.\n- `port/`: Example server and client applications for each port. These applications initialize the server and client context and then run the demo code.\n\n## Current Examples\nCurrently, the only public example for wolfHSM uses the POSIX simulator. If you are interested in examples for NDA-restricted hardware platforms, please contact us at support@wolfssl.com.\n\n### Posix TCP server and client\nThis example spawns a wolfHSM client and server, both in their own thread, and runs the client-side unit tests against the server.\n\n### Building\nTo build the client and the server, wolfHSM must be configured and built along side wolfSSL.\n\nIn the Makefile for both the server and client in `wolfHSM-examples/posix/tcp/wh_\u003cclient or server\u003e_tcp/` under important directories is as follows :\n```\n# Important directories\nBUILD_DIR = ./Build\nWOLFHSM_DIR = $(CURDIR)/../../../../wolfHSM\n\nWOLFSSL_DIR ?= $(CURDIR)/../../../../wolfssl\n```\n\nSet the `WOLFHSM_DIR` and `WOLFSSL_DIR` variables to point to your local installation of wolfHSM and wolfSSL. Now the client and server demo application can be built.\n\n### Building wh_server_tcp\n`cd` into `wolfHSM-examples/posix/tcp/wh_server_tcp` and run `make`. Once completed, the output server executable `wh_server_tcp.elf` will be located in the `Build` directory.`\n\n### Building wh_client_tcp\n`cd` into `wolfHSM-examples/posix/tcp/wh_client_tcp` and run `make`. Once completed, the output server executable `wh_client_tcp.elf` will be located in the `Build` directory.\n\n### Executables\nIn the root directory for wolfHSM-examples run `./posix/tcp/wh_server_tcp/Build/wh_server_tcp.elf` to launch the server. In a separate shell, run `./posix/tcp/wh_client_tcp/Build/wh_client_tcp.elf` to launch the client.\n\n### Loading a key on the server\nThe example server supports loading a key at a specific keyId, passed as arguments on the command line. To load a key at a keyId in the server example, invoke the server with the `--key` and `--id` arguments.\n\n```\n./wh_server_tcp.elf --key /path/to/key.der --id \u003ckeyId\u003e\n```\n\n### Results\nAfter all steps are you complete you should see the following outputs.\n\nServer output :\n\n```\nWaiting for connection...\nSuccessful connection!\nServer disconnected\n```\n\nClient output :\n\n```\nClient connecting to server...\nClient sent request successfully\nClient sent request successfully\nClient sent request successfully\nClient sent request successfully\nClient sent request successfully\nClient sent request successfully\nClient sent request successfully\nClient sent request successfully\nClient sent request successfully\nClient sent request successfully\nClient disconnected\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfssl%2Fwolfhsm-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwolfssl%2Fwolfhsm-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfssl%2Fwolfhsm-examples/lists"}