I have a requirement to generate a public-private key pair in PKCS#8 format and I need to upload a public key to the server without "BEGIN" and "END" lines.
Here are the steps I used to do that (taken from here):
openssl genrsa -out keypair.pem 2048
openssl rsa -in keypair.pem -pubout -out publickey.crt
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in keypair.pem -out pkcs8.key
Everything worked fine, but, when I try to upload my public key (publickey.crt
), I get an error message from the server saying that public key's maximum length is 300 characters. The key I generated is 398 characters long (without "BEGIN" and "END" lines).
What am I doing wrong here?
Edit #1: The reason why I think I may be doing something wrong is because I was told that other people were able to successfully upload their keys.