{"id":42079359,"url":"https://github.com/dmjones/certs","last_synced_at":"2026-01-26T09:43:26.745Z","repository":{"id":57551902,"uuid":"201120780","full_name":"dmjones/certs","owner":"dmjones","description":"Generate certificates for Go tests","archived":false,"fork":false,"pushed_at":"2019-08-27T15:04:48.000Z","size":11,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T01:51:34.173Z","etag":null,"topics":["certificates","go","golang","keys","testing"],"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/dmjones.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":"2019-08-07T20:10:54.000Z","updated_at":"2024-06-20T01:51:34.174Z","dependencies_parsed_at":"2022-09-26T18:41:38.158Z","dependency_job_id":null,"html_url":"https://github.com/dmjones/certs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dmjones/certs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmjones%2Fcerts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmjones%2Fcerts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmjones%2Fcerts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmjones%2Fcerts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmjones","download_url":"https://codeload.github.com/dmjones/certs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmjones%2Fcerts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28773071,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T09:42:00.929Z","status":"ssl_error","status_checked_at":"2026-01-26T09:42:00.591Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["certificates","go","golang","keys","testing"],"created_at":"2026-01-26T09:43:26.005Z","updated_at":"2026-01-26T09:43:26.740Z","avatar_url":"https://github.com/dmjones.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/dmjones/certs?status.svg)](https://godoc.org/github.com/dmjones/certs)\n\nGenerate test certificates for Go programs.\n\n## Basic Usage\n\nGrab a copy of the package:\n\n```\ngo get github.com/dmjones/certs\n```\n\nSimple certificates can be created using `Cert`, `CertDER` and `CertPEM`:\n\n```go\ncert, key, err := certs.New()           // returns *x509.Certificate and crypto.Signer\ncertDER, keyDER, err := certs.NewDER()  // returns DER-encoded\ncertPEM, keyPEM, err := certs.NewPEM()  // returns PEM-encoded\n```\n\nThese certificate will have default properties, including:\n\n- Self-signed (using SHA256WithRSA)\n- RSA 2048-bit keys\n- One year validity\n- Random serial number\n- Random Common Name (all other DN fields blank)\n\nThese properties can be overriden. See examples below, or \nthe docs for the `Config` class for more details.\n\n### Avoid the error check\n\nIn a testing environment, you can avoid checking for the error by using the\nequivalent TNew, TNewDER and TNewPEM functions:\n\n```go\nfunc TestSomething(t *testing.T) {\n    cert, key, err := certs.TNew(t)           // returns *x509.Certificate and crypto.Signer\n    certDER, keyDER, err := certs.TNewDER(t)  // returns DER-encoded\n    certPEM, keyPEM, err := certs.TNewPEM(t)  // returns PEM-encoded\n}\n```\n\n### Save to file\n\nIf you need to save to file, pass a `Config` argument and provide either (or both) of `CertPath` and\n`KeyPath`:\n\n```go\ncert, key, err := certs.New(certs.Config{CertPath: \"/tmp/cert.cert\", KeyPath: \"/tmp/key.pem\"})\n```\n\n### Override defaults\n\nPass a `Config` argument to override the default settings. You only need to specify the\nelements you wish to override. Below is an example that overrides every supported setting:\n\n```go\ncfg := certs.Config{\n    CACert: otherCert,\n    CAKey:  otherKey,\n    DN: \u0026pkix.Name{\n        Country:            []string{\"GB\"},\n        Organization:       []string{\"org\"},\n        OrganizationalUnit: []string{\"ou\"},\n        CommonName:         \"foo\",\n    },\n    Expiry:       time.Now().AddDate(0, 2, 5),\n    SerialNumber: big.NewInt(42),\n    KeyType:      certs.ECDSA,\n    RSAKeySize:   0,\n    Curve:        elliptic.P384(),\n    IsCA:         true,\n    Algorithm:    x509.ECDSAWithSHA384,\n}\n\ncert, key, err := certs.New(cfg)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmjones%2Fcerts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmjones%2Fcerts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmjones%2Fcerts/lists"}