SSL Certificate add failed, Error: 1312

25 Mar

You are trying to bind SSL certificate ot a port number using the the following command:
netsh http add sslcert ipport=0.0.0.0:8000 certhash=0000000000003ed9cd0c315bbb6dc1c08da5e6 appid={00112233-4455-6677-8899-AABBCCDDEEFF}

The command failes with error:
SSL Certificate add failed, Error: 1312
A specified logon session does not exist. It may already have been terminated.

The most likely problemis that the certificate that you are using does not have the private key. To make sure the certificate has a private key open the certificate with the thumbprint that was defined in command line and look if private key is present:

If the private key is not present then you have to go to CA export the certificate and include private key. Then you need to re import it to the host and run command again.
If the certificate already has private key and you are running Windows 2008 R2 or Windows 7 then you might take a look at KB981506

Tags: , ,

3 Responses

  1. Hassan Gulzar says:

    I had a recent run-in with this issue. I solved my problem as follow: http://stackoverflow.com/a/19766650/481656

  2. sebastian says:

    Thanks so much.
    i dont know how many hours i already lost,
    but thanks to you now it wokrs!
    THANKS

  3. bogdan says:

    If this issue occurs on newer OS, like Win10, it might be a permission issue on the private keys.
    Just had this issue and fixed it by looking in “C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys”. I found the right container to update by running the following powershell command
    certutil -v -store my $certThumbprint | select-string “Unique container name”
    From here I looked on the Security tab and granted the right permissions on the key.
    Hope it helps !

Leave a Reply to bogdan

IT Blog

Just another blog on Kozeniauskas.com Network