brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: openssl req -verify checks a CSR before you hand it to a CA

Openssl
~/tips/tip-openssl-req-verify-csr

openssl req -in site.csr -noout -text -verify

Inspect a certificate signing request and check its signature, so a typo does not cost a reissue.

A CSR is a small signed file, and it is easy to send one with a wrong name or key. Before you paste one anywhere, I’d read it back.

This prints the content and checks the signature in one go:

openssl req -in site.csr -noout -text -verify

At the top you see Certificate request self-signature verify OK, which means the request is intact and was signed with the private key that belongs to the public key inside it. Below that come the subject, the key type and size, and any requested extensions, such as the Subject Alternative Names.

Things I’d check: the Subject: line, the list under Requested Extensions, and the key, for example Public-Key: (256 bit) for P-256 or (2048 bit) for RSA. If you made several requests in a row, the key check from the certificate tip works for CSRs as well, via -pubkey.

A request someone else gave you deserves the same look before you sign it with your own CA. That signature check only proves the requester holds the matching key, not that they own the names inside. A failing check shows an error instead of the OK line, often because the file was damaged when copied from an email or web page. Make sure the BEGIN and END lines are complete.

Further reading: OpenSSL: openssl-req

More Openssl tips openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null | openssl x509 -noout -subject openssl x509 -in cert.pem -days 365 -signkey key.pem -out cert-new.pem printf %s hello | openssl dgst -sha256 -hmac secret openssl pkcs12 -legacy -in old.pfx -nokeys echo 'aGVsbG8gd29ybGQ=' | openssl base64 -d All Openssl tips (34) All topics

Link