Found the certs/keys under data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/<mydomain>
While digging deeper I found out that the keys are much shorter than I am used to and use elliptic curve cryptography, which I haven’t heard of before. How do they differ from the usual RSA keys and are they as secure?
And whilst the keys being shorter than usual, the certs seem to be not shortened - why is that the case?
RSA vs ECC is a big topic. In general, yes ECC keys are “more secure” but it’s all kinds of complicated math to explain why (it’s really more that it’s more efficient, not necessarily more secure; both are still quite secure). I recommend you do your own research on this topic, Google will explain better than I could on short notice Here’s a relevant answer:
Certificates themselves just store a bunch of metadata like what site it’s for, how long it’s valid, who the certificate authority that signed it is, and ultimately, the public key portion of your key-pair (the key file has the private key, and you can calculate the public part from the private key with ECC; I don’t remember if that property holds as well with RSA, I’ve studied ECC more recently). Essentially the CA takes your CSR (certificate signing request) which contains your public key and the site you want to issue a cert for, etc, then digitally signs (bunch of math) using their super-secret private key. Anyone who knows the CA’s public key (which can be found in the root CA cert) can verify that they, and only they, signed your certificate to prove that it’s good.
All that’s to say, the only bit that changes in your certificate is the public key portion which is just one small part of the certificate. I’m pretty sure that ECC public keys are shorter, but you won’t notice the length difference as much because it’s part of all kinds of other data.
Something you can do to learn more about what’s in the certificate, take your certificate and paste it in this site: ASN.1 JavaScript decoder (don’t worry, it’s entirely using client-side JS, it doesn’t send your cert to any servers - but that would be okay anyways because your cert is public information anyways). Essentially it decodes the binary structure of your certificate and displays it to you. You’ll be able to spot where the public key is in the binary structure as well as where your domain name is, etc. You can also paste in your private key to see the structure it has as well (but you’re allowed to be a bit more paranoid about that). ASN.1 is the binary packing format typically used for certificates/keys. It’s essentially a tree structure.
Probably my favourite cryptography videos in terms of explaining in simple terms are those from Computerphile:
I know, that’s what I thought as well. Unfortunately I am stuck using an old version of lighttpd for a certain application, which only supports this combined pem file.