PEM to CRT Script

I need to convert a @letsencrypt cert to a CRT from the base PEM tonight so I quickly wrote this.

Hope it might help someone else.

1 Like

Doesn’t make sense to me. All CRT files I deal with are PEM Base64 encoded already. So what is “PEM to CRT” even? Had to look at your script and realize this is a Base64 —> DER conversion. Why would I need a DER-encoded certificate if I can’t even easily copy-paste it?

Also, your script uses “sudo” 5 times. This would fail on all my servers except the one where I had run “apt-get install sudo” a long time ago. Needed this to provide root access to a restricted user. Waste of time, regret doing this. SSH via root just works, and it is secure.