not a valid PEM formatted Machine SSL certificate"./var/log/vmware/vsphere-ui/logs/vsphere_client_virgo.log[YYYY-MM-DDTHH:MM:SS.###Z] [ERROR] tp-nio-127.0.0.1-5090-exec-6 com.vmware.vise.mvc.exception.GlobalExceptionHandler Exception handled while processing request for /ui/certificate-ui/ctrl/certificates/tls: com.vmware.vapi.std.errors.Error: Error (com.vmware.vapi.std.errors.error) => { messages = [LocalizableMessage (com.vmware.vapi.std.localizable_message) => { id = com.vmware.certificatemanagement.error, defaultMessage = Exception found (Invalid input, not a valid PEM formatted Machine SSL certificate), args = [Invalid input, not a valid PEM formatted Machine SSL certificate], params = <null>, localized = <null>/var/log/vmware/certificatemanagement/certificatemanagement-svcs.logYYYY-MM-DDTHH:MM:SS.###Z [tomcat-exec-10 [] INFO com.vmware.certificatemanagement.impl.tls.TlsReplace opId=] Entering replace method to replace the TLS/SSL certificate ..YYYY-MM-DDTHH:MM:SS.###Z [tomcat-exec-10 [] ERROR com.vmware.certificatemanagement.impl.tls.TlsReplace opId=] Invalid PEM string for MACHINE_SSL certificate malformed PEM data encounteredYYYY-MM-DDTHH:MM:SS.###Z [tomcat-exec-10 [] ERROR com.vmware.certificatemanagement.impl.tls.TlsReplace opId=] TLS Certificate replacement failed : Invalid input, not a valid PEM formatted Machine SSL certificateYYYY-MM-DDTHH:MM:SS.###Z [tomcat-exec-10 [] ERROR com.vmware.certificatemanagement.vapi.impl.TlsProviderImpl opId=] Exception was thrown while executing set:com.vmware.certificatemanagement.impl.exceptions.InvalidArgumentException: Invalid input, not a valid PEM formatted Machine SSL certificate at com.vmware.certificatemanagement.impl.tls.TlsReplace.replaceMachineCert(TlsReplace.java:97) ~[service-0.0.1-SNAPSHOT.jar:?]VMware vCenter Server
This issue occurs when the Machine SSL Certificate file used in the certificate replacement wizard is corrupted, encoded in binary (DER) format, or contains hidden formatting characters (often from being edited in rich-text editors). vCenter requires Base-64 encoded X.509 (PEM) format.
To resolve this issue, you must ensure the certificate is correctly exported and sequenced.
1. Export the Certificate as Base-64
2. Verify the Certificate Chain Order Open your .pem or .cer file in a plain text editor (e.g., Notepad++ or VS Code). Ensure the certificates are stacked in the following top-down order with no empty lines:
Example Structure:
-----BEGIN CERTIFICATE----- <Machine SSL Certificate> -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- <Intermediate CA Certificate> -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- <Root Certificate> -----END CERTIFICATE-----
3. Use the exported Base-64 formatted file during Certificate Replacement Wizard.
4. Refer to Add Custom Certificates Using the vSphere Client. for the steps to import and replace the certificate in vSphere UI
-----BEGIN CERTIFICATE-----<alphanumeric certificate characters> <-----Machine SSL Certificate-----END CERTIFICATE----------BEGIN CERTIFICATE-----<alphanumeric certificate characters> <-----Intermediate 1 Certificate-----END CERTIFICATE----------BEGIN CERTIFICATE----- <alphanumeric certificate characters> <-----Intermediate 2 Certificate-----END CERTIFICATE----------BEGIN CERTIFICATE----- <alphanumeric certificate characters> <-----Root Certificate-----END CERTIFICATE----------BEGIN CERTIFICATE-----<alphanumeric certificate characters> <-----Intermediate 1 Certificate-----END CERTIFICATE----------BEGIN CERTIFICATE----- <alphanumeric certificate characters> <-----Intermediate 2 Certificate-----END CERTIFICATE----------BEGIN CERTIFICATE----- <alphanumeric certificate characters> <-----Root Certificate-----END CERTIFICATE-----