I recently picked up a Cisco SG250-08HP
and it would not accept a certificate that I issued for it, using my own Root CA. Even after bootstrapping trust with the CA it still would not work, and the error message was unclear. After a few hours of research and many failed attempts I finally found a replicable way to achieve this. So I hope this might help someone else that runs into this in the future.
TL;DR: RSA key pair must be in pkcs1 format for the Cisco switch to accept it.
To give some additional context, I generated my certificates with Pfsense 2.6.0
at the time of this writing using SHA256 and 2048 bit keys.
OpenSSL version used in this guide: OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)
-
Log in to the Switch WebUI and Import your Root CA. This step is straight forward and I didn't have any issues, just paste the contents of the PEM formatted certificate under
Security -> Certificate Settings -> Import...
I didn't have to import my intermediates either, just the root. -
Create/generate a server certificate with key size 2048 (can't use 4096 for key size, it won't fit in the cisco webUI, lol).
I exported my cert and key file from pfsense. The cert file is good to go, just typical PEM format. I got
pkcs8
format for the key however, which was a problem. The Cisco Switch requirespkcs1
(older) format. Basically this means that we need two files in place of the single key file (public/private keys) where the PEM headers must contain the wordRSA
and the first 32 characters are removed (something like that lol...). Huge thanks to this blog post that really helped shoot my in the right direction. -
Now, if you follow the instructions in that blog, when formatting the private key, I noticed that the command did not work and my resulting private key file was the same. I found out that Openssl 3.0 has since changed this behaviour and now requires passing the
-traditional
flag. This took me hours to figure out haha. Anyways here is how to generate thepkcs1 formatted RSA private key
from apkcs8
key:openssl rsa -in your-key.pem -traditional
-
Here is the command to get the
pkcs1 formatted RSA public key
to go with it:openssl rsa -in your-key.pem -RSAPublicKey_out
-
Now we should have your certificate file along with pkcs1 formatted RSA public/private key pair for the Cisco Switch. Navigate to
Security -> SSL Server -> SSL Server Authentication Settings
and select theUser Defined
certificate entry, either 1 or 2. Click onImport ...
and paste just the certificate (again, no intermediates needed/allowed, so just the end-entity, no chains) along with the public/private keys we just formatted