“The credentials supplied to the package were not recognized” error when authenticating as server with certificate generated using BouncyCastle

前端 未结 8 2140
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 02:00

I\'m trying to create a certificate using the BouncyCastle.Crypto dll, which is then used to authenticate a SslStream as the server in a Windows Service process, which runs

8条回答
  •  没有蜡笔的小新
    2020-12-05 02:35

    Previously, every time I have run into this issue, I have had to delete the cert out of my local machine cert store and re-import it. Then it all seems happy. I can't see how it could be a global permissions issue or invalid cert if simply re-importing it fixes the issue.

    How I finally fixed it was using the winhttpcertcfg tool from the Windows Resource Kit to grant permission to the specific user that was using the cert.

    The syntax would be:

    "C:\Program Files (x86)\Windows Resource Kits\Tools\winhttpcertcfg" -i cert.p12 -c LOCAL_MACHINE\My -a UserWhoUsesTheCert -p passwordforp12
    

提交回复
热议问题