Skip to content

Commit 89a2177

Browse files
committed
feat(docs): document process for updating certificates
* Refactor existing documentation, splitting it into seperate sections for clarity. * Explain how to create a CSR and what to do with purchased certificates. I think the code signing documentation is still pretty crappy, but I don't want to invest more time in it.
1 parent ccd8814 commit 89a2177

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

docs/CODE_SIGNING.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
# Code-signing quick-lint-js
22

3-
In order to sign quick-lint-js, you need a code signing certificate. You can
4-
create a self-signed certificate for local testing (but not distribution):
3+
In order to sign quick-lint-js, you need a code signing certificate.
4+
5+
## Creating a certificate
6+
7+
You can create a self-signed certificate for local testing (but not
8+
distribution):
59

610
1. [Create a self-signed CA for code signing][macos-create-ca].
711
2. [Create a certificate for code signing][macos-create-cert].
812

13+
You will also need a GnuPG key.
14+
15+
## Creating signing files
16+
17+
After creating a code signing certificate, you need to create files for signing.
18+
919
In the Keychain Access app, export your code signing certificate (not CA)'s
1020
public key as a .cer file. Call it `dist/certificates/quick-lint-js.cer`.
1121

22+
Then, convert the `.cer` DER (binary) file into a `.crt` PEM (text) file by
23+
running the following command:
24+
25+
$ openssl x509 -in dist/certificates/quick-lint-js.cer -inform der -out dist/certificates/quick-lint-js.crt
26+
27+
After creating the `.crt` file, [update the macOS code signing requirements
28+
file][apple-csreq].
29+
1230
In the Keychain Access app, export your code signing certificate (not CA) and
1331
private key as a .p12 file. Call it
1432
`dist/certificates/quick-lint-js-PRIVATE.p12`. **Do not commit this file.**
@@ -18,14 +36,33 @@ following command (**do not commit the `.key` file**):
1836

1937
$ openssl pkcs12 -in dist/certificates/quick-lint-js-PRIVATE.p12 -nocerts -out /dev/stdout -passout pass:temporarypass | openssl rsa -in /dev/stdin -out dist/certificates/quick-lint-js-PRIVATE.key -passin pass:temporarypass
2038

21-
You will also need a GnuPG key. Create the key, then run the following commands
22-
(**do not commit the `quick-lint-js-PRIVATE.gpg.key` file**):
39+
To export the GnuPG key, run the following commands (**do not commit the
40+
`quick-lint-js-PRIVATE.gpg.key` file**):
2341

2442
$ gpg --output dist/certificates/quick-lint-js.gpg.key --armor --export $YOUR_KEY_FINGERPRINT
2543
$ gpg --output dist/certificates/quick-lint-js-PRIVATE.gpg.key --export-secret-key $YOUR_KEY_FINGERPRINT
2644

45+
## Signing
46+
2747
When you run the `dist/sign-release.go` program, specify
2848
`-RelicConfig dist/certificates/relic-config.yaml`.
2949

50+
## Updating production certificates
51+
52+
After sacrificing a goat to the PKI gods by purchasing a signing certificate
53+
from a certificate authority (e.g. [SSL.com][]):
54+
55+
1. Open Keychain Access.
56+
2. Right-click the private key.
57+
3. Choose "Request a Certificate From a Certificate Authority".
58+
4. Fill in the Common Name (CN) based on the CN provided by your certificate
59+
authority.
60+
5. Give the CSR to your certificate authority.
61+
6. Download the certificate chain .crt file, saving it to
62+
`dist/certificates/quick-lint-js.crt`.
63+
7. [Update the macOS code signing requirements file.][apple-csreq]
64+
65+
[SSL.com]: https://www.ssl.com/
3066
[macos-create-ca]: https://www.simplified.guide/macos/keychain-ca-code-signing-create
3167
[macos-create-cert]: https://www.simplified.guide/macos/keychain-cert-code-signing-create
68+
[apple-csreq]: apple/README.md

0 commit comments

Comments
 (0)