SSL Certificate add failed, Error: 1312

Glenn Maxwell 12,456 Reputation points
2023-02-14T18:44:48.7666667+00:00

Hi All i am getting the below error when i execute the below syntax on windows server 2019. i dont see any issue with the certificate.

C:\Windows\system32>netsh http add sslcert ipport=0.0.0.0:443 certhash=3045c0dab3764dd641a3742253c9b22e07acf645 appid={11223344-4455-6677-8899-AABBCCDDEEFF}

SSL Certificate add failed, Error: 1312

A specified logon session does not exist. It may already have been terminated.

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,970 questions
Windows Server 2016
Windows Server 2016
A Microsoft server operating system that supports enterprise-level management updated to data storage.
2,599 questions
0 comments No comments
{count} votes

Accepted answer
  1. Limitless Technology 44,666 Reputation points
    2023-02-16T10:08:04.5833333+00:00

    Hello there,

    If you are getting Error Code 1312, the certificate you are attempting to bind likely does not contain the private key. If you are getting Error Code 1312, you can determine if the certificate you imported contains the private key by looking at its icon in MMC

    Make sure you've installed the certificate in the service account (MMC -> add snap-in -> certificates -> computer account) and NOT in your personal account.

    The below thread discusses the same issue and you can try out some troubleshooting steps from this and see if that helps you to sort the Issue.https://social.technet.microsoft.com/Forums/windowsserver/en-US/68452008-a89b-40ba-9927-472efcfafc99/ssl-certificate-add-failed-error-1312

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Amit Singh 5,221 Reputation points
    2023-02-16T05:52:23.9233333+00:00

    I had the same error. The first time it occurred, I had to move the certificate under the Certificates(Local Computer) -->Personal -->Certificate folder. I had the same error when I imported the same certificate on another machine. The reason was that I was using certmgr.msc to import the certificate. The window opened thus shows “Certificates – Current User”. Certificates imported using this window cause netsh to fail with the 1312 error. Make sure to use certificate snap-in in MMC to import certificates. The certificate snap-in from MMC shows “Certificates (Local Computer)”. 

    1 person found this answer helpful.
    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.