We're using a script based on acme.sh to generate our SSL certificates. acme.sh also supports elliptic curves. I wonder, how to check the keylength for both, RSA and elliptic curve certificates. I need to know the keylength (e.g. 256 for ec or 2048 for RSA) to determine if a certificate needs to be replaced.
openssl rsa -in privatekey.pem -text -noout | grep "Private-Key"
works for RSA but not for elliptic curves.
openssl ec -in privatekey.pem -text -noout | grep "Private-Key"
Works for elliptic curves, but I then need to distinguish between rsa and ec. There should be an easier way to get the bit length?
Simply read the certificate with:
Which returns:
Public-Key: (2048 bit)
orPublic-Key: (256 bit)