{"id":43975776,"url":"https://github.com/zebox/gojwk","last_synced_at":"2026-02-07T08:09:09.217Z","repository":{"id":57695383,"uuid":"441616793","full_name":"zebox/gojwk","owner":"zebox","description":"Simple JWKS tool which use asymmetric keys for sign and verify JWT  ","archived":false,"fork":false,"pushed_at":"2022-05-26T05:47:50.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-07-27T22:49:24.658Z","etag":null,"topics":["go","golang","jwk","jwks-rsa","jwt","ssl-certificates"],"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/zebox.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}},"created_at":"2021-12-25T06:13:42.000Z","updated_at":"2022-05-23T12:43:55.000Z","dependencies_parsed_at":"2022-09-06T10:41:12.563Z","dependency_job_id":null,"html_url":"https://github.com/zebox/gojwk","commit_stats":null,"previous_names":[],"tags_count":3,"template":null,"template_full_name":null,"purl":"pkg:github/zebox/gojwk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebox%2Fgojwk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebox%2Fgojwk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebox%2Fgojwk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebox%2Fgojwk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zebox","download_url":"https://codeload.github.com/zebox/gojwk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebox%2Fgojwk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29189675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"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":["go","golang","jwk","jwks-rsa","jwt","ssl-certificates"],"created_at":"2026-02-07T08:09:09.149Z","updated_at":"2026-02-07T08:09:09.209Z","avatar_url":"https://github.com/zebox.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"### JSON Web Key (JWK) tool\n---\n[![Build Status](https://github.com/zebox/gojwk/actions/workflows/main.yml/badge.svg)](https://github.com/zebox/gojwk/actions) [![Build Status](https://github.com/zebox/gojwk/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/zebox/gojwk/actions) [![Coverage Status](https://coveralls.io/repos/github/zebox/gojwk/badge.svg)](https://coveralls.io/github/zebox/gojwk) [![Go Report Card](https://goreportcard.com/badge/github.com/zebox/gojwk)](https://goreportcard.com/report/github.com/zebox/gojwk)\n\nThis simple library provides tools for work with private and public keys using RSA \nas [JWK](https://datatracker.ietf.org/doc/html/rfc7517).\nThe Library allows generating, save and load crypto keys pair based on RSA algorithm. \nJWKS usually use asymmetric encryption keys pair where public key (using in JWKS) for validate the \n[JWT](https://jwt.io/introduction) tokens which signed with private part of keys.\nA public key can be placed at different service or server for validate JWT signature.\n\nThe Library write in Go and you can either embed to golang projects or use as a standalone application.\n\n#### HOW TO USE\nMain items of this library is crypto keys pair. You can generate they or load from some storage. Library supports both of this way (in currently support only RSA keys).\n\nInit keys pair with `NewKeys`for create `Keys` instance.\n\nConstructor can accept two options:\n- Storage - this is interface which has `Load` and `Save` method. They define where keys will be stored and load from. \nUser can use pre-defined storage `File` provider in `storage` package. By default, this option is undefined and new generated keys will store in memory only.\nStorage `File` provider required path to private and public keys. \n  \n- BitSize - defined size for crypto key which will be generated. Option accept `int` value  By default - 2048.\n\nAfter `Keys` inited user should either `Generate` new key pair or `Load` from storage provider if keys doesn't exist in storage yet. \n  \n```go\nkeys,err:=NewKeys() // if storage option undefined key pair store in memory\n \nif err!=nil {\n        // handle error \n}\n\n// Generate new keys pair if need\nif err=keys.Generate();err!=nil {\n    // handle error\n}\n\nerr,jwk:=keys.JWK()\nif err!=nil {\n    // handle error\n}\n\nfmt.Println(jwk.ToString())\n```\nA after execute code above you get result like this:\n```javascript\n{\n          \"kty\": \"RSA\",\n          \"kid\": \"oI4f\",\n          \"use\": \"sig\",\n          \"alg\": \"RS256\",\n          \"n\": \"n5Y24DhSDIKIN6tJbrOMxfZpoedvAIAA5vKv...\",\n          \"e\": \"AQAB\"\n}\n```\nExample with options:\n```go\n// NewFileStorage accept rootPath, privateKey and publicKey names params\nfs := storage.NewFileStorage(\"./\",\"test_private.key\", \"test_public.key\")\nkeys, err := NewKeys(Storage(fs))\n\n// if storage provider hasn't keys pair yet user can generate they \n// after generated key pair will be save to defined storage\nif err=keys.Generate();err!=nil {\n    // handle error\n}\n\n// Load key pair from storage provider\nif err=keys.Load();err!=nil {\n    // handle error\n}\n\nerr,jwk:=keys.JWK()\nif err!=nil {\n    // handle error\n}\n```\n`Keys` has method `CreateCAROOT` for create Certificate Authority (CA) file with generated keys pair\n```go\n// create Keys instance\nkeys, err := NewKeys()\nif err=keys.Load();err!=nil {\n    // handle error\n}\n\n// create certificate data\nca := \u0026x509.Certificate{\n\t\tSerialNumber: big.NewInt(2019),\n\t\tSubject: pkix.Name{\n\n\t\t\tOrganization:  []string{\"TEST, INC.\"},\n\t\t\tCountry:       []string{\"RU\"},\n\t\t\tProvince:      []string{\"\"},\n\t\t\tLocality:      []string{\"Krasnodar\"},\n\t\t\tStreetAddress: []string{\"Krasnaya\"},\n\t\t\tPostalCode:    []string{\"350000\"},\n\t\t},\n\n\t\tNotBefore:             time.Now(),\n\t\tNotAfter:              time.Now().AddDate(5, 0, 0),\n\t\tIsCA:                  true,\n\t\tExtKeyUsage:           []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},\n\t\tKeyUsage:              x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,\n\t\tBasicConstraintsValid: true,\n\t}\n\n\t// add Subject Alternative Name for requested IP and Domain\n\t// it prevent error with untrusted certificate for client request\n\t// https://oidref.com/2.5.29.17\n\tca.IPAddresses = append(ca.IPAddresses, net.ParseIP(\"127.0.0.1\"))\n\tca.IPAddresses = append(ca.IPAddresses, net.ParseIP(\"::\"))\n\tca.DNSNames = append(ca.DNSNames, \"localhost\")\n\n// generate RSA keys pair (private and public)\nif err=keys.Generate();err!=nil {\n    // handle error\n}\n\n// create CA certificate for created keys pair\nif err = keys.CreateCAROOT(ca); err != nil {\n\treturn nil, nil, err\n}\n\n// if storage provider defined user should call Save function for store certificate and keys files\n```\nFull example with web service usage see here [example](https://github.com/zebox/gojwk/blob/master/_example/main.go)\n\n#### Status\nThe code still under development. Until v1.x released the API \u0026 protocol may change.\n\n\n\n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzebox%2Fgojwk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzebox%2Fgojwk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzebox%2Fgojwk/lists"}