Unable to set the private key: Probably, the private key format is invalid

Created:

2016-11-16 13:02:15 UTC

Modified:

2017-08-08 13:25:37 UTC

1

Was this article helpful?


Have more questions?

Submit a request

Unable to set the private key: Probably, the private key format is invalid

Applicable to:

  • Plesk for Windows

Symptoms

  1. Certificate uploading to Plesk fails with error:

    Unable to set the private key: Probably, the private key format is invalid
  2. Following error occurs in %plesk_dir%\\admin\\logs\\php_error.log :

    [2015-07-25 10:37:44] ERR [panel] Unable to set the certificate: Incompatible private key/certificate pair..
  3. Domain reconfiguration fails with error (from %plesk_dir%\\admin\\logs\\php_error.log ):

    stdout:
    A specified logon session does not exist. It may already have been terminated. (Exception from HRESULT: 0x80070520)
    In Microsoft.Web.Administration module
    Exception type: System.Runtime.InteropServices.COMException
    at Microsoft.Web.Administration.Interop.IAppHostMethodInstance.Execute()

    at Microsoft.Web.Administration.BindingManager.Save()

    at Microsoft.Web.Administration.ServerManager.CommitChanges()

    at ServerManagerFactory.commit()

    at IISServerManager.commit(IISServerManager* )

Cause

Certificate Private Key part is encrypted.

Resolution

  1. Make sure that Private Key starts from -----BEGIN RSA PRIVATE KEY-----

  2. If it starts from string -----BEGIN PRIVATE KEY----- save Private Key part in text file, for example `C:\ emp \key.key and decrypt it using openssl` utility:

    cd c:\  emp
    "%plesk_bin%"\\openssl.exe rsa -in key.key -out newkey.key
  3. Upload decrypted Private Key from newkey.key file, Certificate and CA parts in Plesk.

Have more questions? Submit a request
Please sign in to leave a comment.