{"id":17330328,"url":"https://github.com/foxboron/go-uefi","last_synced_at":"2025-04-12T22:26:01.831Z","repository":{"id":43086610,"uuid":"257731293","full_name":"Foxboron/go-uefi","owner":"Foxboron","description":"Linux UEFI library written in pure Go.","archived":false,"fork":false,"pushed_at":"2025-02-07T20:43:44.000Z","size":8417,"stargazers_count":147,"open_issues_count":2,"forks_count":16,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-28T01:09:44.524Z","etag":null,"topics":["secure-boot","uefi","uefi-secureboot"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Foxboron.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":"2020-04-21T22:33:38.000Z","updated_at":"2025-03-22T07:05:59.000Z","dependencies_parsed_at":"2024-10-15T14:51:02.772Z","dependency_job_id":"f8547ba6-88d7-43eb-9e45-3e7674ad7c0d","html_url":"https://github.com/Foxboron/go-uefi","commit_stats":{"total_commits":251,"total_committers":11,"mean_commits":"22.818181818181817","dds":0.05976095617529875,"last_synced_commit":"fab4fdf2f2f3e29bce7f35396ab4b5241565e94c"},"previous_names":["foxboron/goefi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxboron%2Fgo-uefi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxboron%2Fgo-uefi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxboron%2Fgo-uefi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxboron%2Fgo-uefi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Foxboron","download_url":"https://codeload.github.com/Foxboron/go-uefi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247107828,"owners_count":20884797,"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":["secure-boot","uefi","uefi-secureboot"],"created_at":"2024-10-15T14:50:57.169Z","updated_at":"2025-04-04T02:07:03.341Z","avatar_url":"https://github.com/Foxboron.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-uefi\n=======\n\nA UEFI library written to interact with Linux efivars. The goal is to provide a\nGo library to enable application authors to better utilize secure boot and UEFI.\nThis also includes unit-testing to ensure the library is compatible with\nexisting tools, and integration tests to ensure the library is able of deal with\nfuture UEFI revisions.\n\n\n# Features\n* Implements most Secure Boot relevant structs as defined in UEFI Spec Version 2.8 Errata A (February 14th 2020).\n* PE/COFF Checksumming.\n* Microsoft Authenticode signing.\n* A subset of PKCS7\n* Working with EFI_SIGNATURE_LIST and EFI_SIGNATURE_DATABASE.\n* Integration tests utilizing [vmtest](https://github.com/hugelgupf/vmtest) and tianocore.\n* Virtual filesystem support for easier testing.\n\n\n# Examples\n\nSome example can be found under `cmd/`.\n\n# Code Examples\n\n## Append signatures to db\n\n```go\npackage main\nimport (\n\t\"github.com/foxboron/go-uefi/efi/signature\"\n\t\"github.com/foxboron/go-uefi/efi/util\"\n\t\"github.com/foxboron/go-uefi/efivar\"\n\t\"github.com/foxboron/go-uefi/efivarfs\"\n)\n\nvar (\n    cert, _ = util.ReadKeyFromFile(\"signing.key\")\n    key, _ = util.ReadCertFromFile(\"signing.cert\")\n    sigdata = signature.SignatureData{\n\t    Owner: util.EFIGUID{Data1: 0xc1095e1b, Data2: 0x8a3b, Data3: 0x4cf5, Data4: [8]uint8{0x9d, 0x4a, 0xaf, 0xc7, 0xd7, 0x5d, 0xca, 0x68}},\n\t    Data:  []uint8{}}\n)\n\nfunc main() {\n\tefifs := efivarfs.NewFS().Open()\n\tdb, _ := efifs.Getdb()\n\tdb.AppendSignature(signature.CERT_SHA256_GUID, \u0026sigdata)\n\tefifs.WriteSignedUpdate(efivar.Db, db, key, cert)\n}\n```\n\n## Use a in-memory efivarfs for tests\n\n```go\npackage main\nimport (\n\t\"github.com/foxboron/go-uefi/efi\"\n\t\"github.com/foxboron/go-uefi/efi/efitest\"\n\t\"github.com/foxboron/go-uefi/efi/signature\"\n\t\"github.com/foxboron/go-uefi/efivarfs\"\n)\n\nfunc TestSecureBootOn(t *testing.T) {\n\tefifs := efivarfs.NewTestFS().\n\t\tWith(efitest.SecureBootOn()).\n\t\tOpen()\n\tok, err := efifs.GetSetupMode()\n\tif err != nil {\n\t\tt.Fatalf(\"%v\", err)\n\t}\n\tif !ok {\n\t\tt.Fatalf(\"Secure Boot is not enabled\")\n\t}\n}\n```\n\n## Sign UEFI binary\n```go\npackage main\nimport (\n\t\"github.com/foxboron/go-uefi/authenticode\"\n\t\"github.com/foxboron/go-uefi/efi/util\"\n)\n\nvar (\n\tkey, _ := util.ReadKeyFromFile(\"signing.key\")\n\tcert, _ := util.ReadCertFromFile(\"signing.cert\")\n)\n\nfunc main(){\n\tpeFile, _ := os.ReadFile(\"somefile\")\n\tfile, _ := authenticode.Parse(peFile)\n\tfile.Sign(key, cert)\n\tos.WriteFile(\"somefile.signed\", file.Bytes(), 0644)\n}\n```\n\n## Checksum UEFI executable\n```go\npackage main\nimport (\n\t\"github.com/foxboron/go-uefi/authenticode\"\n)\n\nfunc main(){\n\tpeFile, _ := os.ReadFile(\"somefile\")\n\tfile, _ := authenticode.Parse(peFile)\n\tchecksum := file.Hash(crypto.SHA256)\n\tfmt.Printf(\"%x\\n\", checksum)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxboron%2Fgo-uefi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoxboron%2Fgo-uefi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxboron%2Fgo-uefi/lists"}