{"id":48334420,"url":"https://github.com/marcizhu/dsa-verify","last_synced_at":"2026-04-05T01:37:13.609Z","repository":{"id":115142203,"uuid":"342313166","full_name":"marcizhu/dsa-verify","owner":"marcizhu","description":"🔐 Library to verify digitally-signed files based on a DSA public key \u0026 signature file","archived":false,"fork":false,"pushed_at":"2021-03-18T21:34:53.000Z","size":81,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-01-29T23:13:57.093Z","etag":null,"topics":["dsa","dsa-algorithm","pem"],"latest_commit_sha":null,"homepage":"","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/marcizhu.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":"SECURITY.md","support":null,"governance":null}},"created_at":"2021-02-25T16:48:12.000Z","updated_at":"2023-08-23T05:36:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"1ed6f641-4468-4f97-b450-56ad4a821ec0","html_url":"https://github.com/marcizhu/dsa-verify","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"034c90b2b38adcdf2237f3955efd8bc72935a1e0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marcizhu/dsa-verify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcizhu%2Fdsa-verify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcizhu%2Fdsa-verify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcizhu%2Fdsa-verify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcizhu%2Fdsa-verify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcizhu","download_url":"https://codeload.github.com/marcizhu/dsa-verify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcizhu%2Fdsa-verify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31421869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T00:25:07.052Z","status":"ssl_error","status_checked_at":"2026-04-05T00:25:05.923Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["dsa","dsa-algorithm","pem"],"created_at":"2026-04-05T01:37:12.998Z","updated_at":"2026-04-05T01:37:13.583Z","avatar_url":"https://github.com/marcizhu.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DSA signature verification library :closed_lock_with_key:\n\nSmall \u0026 straightforward C library to verify a blob or hash of data against a DSA public key and a DSA signature. Cross-platform and with a small memory footprint. Very intuitive and fast. Easily usable with other languages such as C++ due to its simple interface.\n\n\n## Generating DSA keys\nIn order to sign a document, you first need to create a DSA public/private key pair. This is easily doable using OpenSSL:\n```sh\n$ openssl dsaparam 4096 \u003e dsaparam.pem\n$ openssl gendsa -out dsa_priv.pem dsaparam.pem\n$ openssl dsa -in dsa_priv.pem -pubout -out dsa_pub.pem\n$ rm dsaparam.pem\n```\n\nAfter executing those commands, there should be two new files: `dsa_priv.pem` and `dsa_pub.pem`. This first one is your private key, and it will be used to sign documents. **DO NOT SHARE THAT FILE WITH ANYONE**, and backup it just in case. The other file is your public key, and it can be shared freely.\n\n\n## Signing a file\nTo sign a document, one can use OpenSSL once again:\n```sh\nopenssl dgst -sha1 -binary \u003c file | openssl dgst -sha1 -sign dsa_priv.pem | openssl enc -base64\n```\n\nThis command will sign the file `file` with the private key `dsa_priv.pem`. As a result, it will generate a signature encoded in [base64](https://en.wikipedia.org/wiki/Base64). You can save that signature in a plain text file.\n\n\n## Verifying a signature with dsa-verify\nIn order to verify a signature, you need the file, the public key and the signature itself. After that, it is as simple as calling `dsa_verify_blob()`:\n\n```c\n#include \"dsa_verify.h\"\n\nconst char* contents = \"The quick brown fox jumps over the lazy dog\\n\";\n\nconst char* public_key = \n    \"-----BEGIN PUBLIC KEY-----\\n\"\n    \"MIIGRzCCBDkGByqGSM44BAEwggQsAoICAQC8Kgf0rpKifA8/lAeAVago8W9YVKQK\\n\"\n    \"OoNkPiXkn80wDNdMfvSnnJdmHyIuYnNVb/Hfc902GvH9l8J/ZZm2cW8F7ZIUlcR5\\n\"\n    // ....\n    \"uTLUFAGFQNiCTKka0fGf7zeC5cgdqQqJhbsi\\n\"\n    \"-----END PUBLIC KEY-----\\n\";\n\nconst char* signature =\n    \"MEQCIBsQNidBcx7MOGcMEkItVEx0iru9T7Ln6cN+3OMB5lie\"\n    \"AiADvUlM2HhsZk9Uq/hK/DsSd6/+aMUMqeCDu92vPVuNBQ==\";\n\nif(dsa_verify_blob(contents, strlen(contents), public_key, signature) == DSA_VERIFICATION_OK)\n    puts(\"Verification OK\");\nelse\n    puts(\"Verification FAILURE\");\n```\n\nTake a look at [simple-verify.c](examples/simple-verify.c) for a complete working example.\n\nIt is also possible to verify the SHA1 hash of the file, or verify a SHA1 hash using a public key \u0026 signature in DER form (instead of the default PEM form). For more information, take a look at the [header file](include/dsa-verify.h) of the library.\n\n\n## Compiling\nThe included Makefile will compile the library into a static library as well as compile the examples. You can also use the provided `CMakeLists.txt` in order to compile this library into a static library or integrate this project with yours.\n\n\n## Credits\nThis library makes use of `mp_math`, a small subset of [LibTomMath](https://github.com/libtom/libtommath), in order to perform the key verification. It also uses a modified version of the [clibs/SHA1](https://github.com/clibs/sha1) implementation by Steve Reid, released into the Public Domain.\n\n\n## License\nCopyright (c) 2021 Marc Izquierdo  \nThis library is licensed under the [MIT License](https://choosealicense.com/licenses/mit/). See\n[LICENSE](https://github.com/marcizhu/dsa-verify/blob/master/LICENSE) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcizhu%2Fdsa-verify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcizhu%2Fdsa-verify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcizhu%2Fdsa-verify/lists"}