ESXi host certificate replacement with Custom certificate fails with error "The private key format is invalid".
book
Article ID: 428283
calendar_today
Updated On:
Products
VMware vCenter ServerVMware vSphere ESXi
Issue/Introduction
Importing custom SSL certificate for an ESXI host from vSphere Client fails with the error "The private key format is invalid".
This error is observed after clicking Finish button in the Certificate upload workflow - select Host -> Configure -> Certificate -> Manage with external CA -> Import and Replace -> Upload the certificate -> Next -> Finish.
Environment
vCenter Server 8.x
vCenter 9.x
ESXi 8.x
ESX 9.x
Cause
This issue is caused when the Private Key is in PKCS#1 format which starts with the header "-----BEGIN RSA PRIVATE KEY-----".
For ESXi certificate replacement, the private key header should start with "-----BEGIN PRIVATE KEY-----".
Resolution
Convert the private key to the correct format which starts with the header "-----BEGIN PRIVATE KEY-----" by following below steps:
Login to vCenter Server via SSH.
Change shell to bash.
Connected to service
* List APIs: "help api list" * List Plugins: "help pi list" * Launch BASH: "shell"
Command> shell
Copy the Private Key to vCenter Server (can use 'vi' editor and copy & paste the private key contents from local desktop).
Convert the Private Key format using the command below: