8 Commits
Author SHA1 Message Date
Nik Unger 68183f4853 Add and enforce copyright headers via linter
This commit normalizes copyright headers across the codebase.
2025-07-28 13:05:13 -04:00
Nik Unger 10bbc8cdc1 Fix current linter findings
This commit adds an explicit `golangci-lint` configuration that
simply matches the default linters previously in use, and then
fixes all current linter findings.

Aside from tweaking error message strings, this commit introduces
one externally visible behavior change: PEM data generated from
PKCS#12 files now correctly identifies private key blocks as
`RSA PRIVATE KEY` or `EC PRIVATE KEY`, whereas previously it
generated invalid `PRIVATE KEY` blocks with non-PKCS#8 data.

This commit lays the groundwork for more aggressive linting in the
future, and identifies some additional issues via TODOs.
2025-07-24 12:59:48 -04:00
John Wood 79f1ecf29f Unconditionally add forward slash in OCSP GET requests (#282) 2022-07-01 13:41:01 -07:00
John Wood 4c8f1c5862 Fix OCSP checking (#274)
Fixes #272. The root of the problem is that we're asking the wrong OCSP servers. The current code does something like:

leaf, issuers := chain[0], chain[1:]
for _, issuer := range issuers {
  // check for revocation of leaf via issuer.OCSPServer
}

The main problem is that OCSPServer is the URI of the OCSP server for that certificate, and by asking issuer.OCSPServer about leaf, we're requesting OCSP responses from the wrong server. We should be checking leaf.OCSPServer in this example instead of issuer.OCSPServer.

The second problem is that the loop makes no sense. One would not expect any OCSP server in a given chain to be authoritative for a given leaf.

If you do certigo connect google.com, you'll see

Certificate has OCSP extension, but was unable to check status:
	ocsp: error from server: unauthorized

The "unauthorized" means the OCSP server we asked doesn't know anything about the cert we asked about.
2022-06-28 14:51:03 -07:00
John Wood 8f0d49f5b3 Don't check OCSP if there are no OCSP servers in the chain (#255) 2022-02-09 10:07:55 -08:00
Cedric Staub 4dba9b2f4e Improve reliability of OCSP checks 2018-04-06 13:06:05 -07:00
Cedric Staub 594b04e874 Print revocation reason & staple status 2018-04-05 16:01:17 -07:00
Matthew McPherrin c58011aee0 Move ocsp.go and verify.go into lib
This reduces a bunch of copy-paste code.
2018-04-04 21:21:46 -07:00