I have created a self-signed SSL certificate via C# (bouncycastle). It shows up in the local computer / personal store and looks exactly like the already existing localhost certificate from Microsoft. If I show the properties, it says:
SSL Certificate add failed, Error: 1312 A specified logon session does not exist. It may already have been terminated.
However, if I want to register this certificate via netsh, I get an error:
netsh.exe http add sslcert ipport=0.0.0.0:{0} certhash={1} appid={2}
app-id being the GUID specified in the assemblyinfo.cs. certhash is the hash from the properties-page of the certificate.
I found several reasons why this can happen in numerous blog posts:
- Use elevated privileges (I am doing this)
- Make sure your certificate is registered in "local computer", not in "current user" - I have this.
- Make sure the certificate has a private key (it has, as it is shown in the properties dialoge box).
None of them led to a success...