• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved certificate.exe command line issue with Private key

WindowsSysadmin

New Pleskian
Hi Team,

I'm having a spot of trouble using the command line option to import a certificate into plesk:

PS C:\Program Files (x86)\Plesk\bin> .\certificate.exe --create "star.mycertificate.co.nz_2018" -admin -default -key-file $keyfile -cert-file $certfile -cacert-file $intermediaryfile
Unable to create certificate "star.mycertificate.co.nz_2018": Unable to set the private key: Probably, the private key format is invalid.

PS C:\Program Files (x86)\Plesk\bin> $keyfile
c:\pleskinstaller\star.mycertificate.co.nz.key

My Private Key looks like this:

-----BEGIN RSA PRIVATE KEY-----
myprivatekeydata
-----END RSA PRIVATE KEY-----

Now, I've deleted and re-created the file using various notepad editors and copied the Private key carefully. So to test - I opened up the Plesk Panel, opened my star.mycertificate.co.nz.key file - Ctrl-A, Ctrl-C, and pasted that directly into the Plesk Panel (along with the Cert and CA cert) - hit upload and hey presto! the Certificate is imported successfully. Seeing as the same data is parsed successfully by the Panel and imported without error, this leads me to believe there is a bug in the certificate.exe CLI option.

OS is Windows Server 2016 - the commands above are being invoked from within a Powershell Session, however I have been using a Powershell Session to leverage the other Plesk CLI utilities for Windows without issue.

Can you please advise?
 
Bump - Anyone?

I should also note that the Certificate is a wildcard cert so *.domainname.co.nz

If there is a log that you can point me to, where a more detailed error message is, that would also be helpful
 
So this is partially solved - it seems that the default encoding format for Powershell out-file is unicode. Plesk seems to throw it's toys out the cot unless the format is ASCII

In which case, it would be nice if the parser checked the encoding format and outputted an error that was a little bit more helpful
 
Back
Top