none
Error signing output with public key from container: Keyset does not exist

    Question

  • Error signing output with public key from container 'VS_KEY_73DFF599EB3CF018' -- Keyset does not exist (Exception from HRESULT: 0x80090016

    What this error actually telling me? What is start point to read about "How to sign my software in Visual Studio 2015". Basic level. 

    Steps to reproduce.

    1. Create Simple C# Console application

    2. Enable Sign the assembly on Signing Tab for project

    3. Create new Key with name TestStrongKeyCreatedByVisualStudion256RSAPwd12345 and set password 123456

    4. Build solution. => Error will be thrown.

    Microsoft Visual Studio Enterprise 2015
    Version 14.0.25421.03 Update 3
    Microsoft .NET Framework
    Version 4.6.01055

    Installed Version: Enterprise
    Visual C# 2015   
    Microsoft Visual C# 2015


    RUV

    Wednesday, January 18, 2017 10:25 AM

Answers

  • Hi Roman Uvarov,

    Please refer to the following steps:

    1). Open Developer Command Prompt for VS2015;

    2). Type cd the folder of key.pfx

    3). Type the following command:

    sn -i key.pfx VS_KEY_9FA1FC3ABAEF83D1

    refer to the following screenshot:

    the other option:

    Do with the following screenshot to install certificate:

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Roman Uvarov Monday, January 23, 2017 10:01 AM
    Friday, January 20, 2017 8:59 AM
    Moderator
  • I tried again

    i created new key again, and open visual studio again as admin.

    I typed command sn -i key.pfx VS_KEY_9FA1FC3ABAEF83D1

    and get error again.

    I will close issue, as it clearly that IDE integration is off for me and errors text are very difficult to grasp.. ( not user friendly)

    I think code signing should be more user friendly, otherwise nobody will use it.

    I resolved my issue by manually signing EXE files without IDE. 


    RUV

    • Marked as answer by Roman Uvarov Monday, January 23, 2017 10:01 AM
    Monday, January 23, 2017 10:01 AM

All replies

  • Hi,

    I cannot reproduce your problem following your steps. Certainly it is expected to work, which means that there is something wrong on your machine, somehow the file with the keys cannot be read or there is a corruption. When this happen, you get "Keyset does not exist" (0x80090016). You can verify not signing the assembly in Visual Studio but using the command-line tool sn.exe of the .NET Framework:

    sn.exe -R <assembly> <keyfile>

    See approaches to solve it in other scenarios:

    "Keyset does not exist" error message when you try to change the identity of an application pool by using Internet Information Services Manager from a remote computer
    https://support.microsoft.com/en-us/kb/977754

    or 

    How to Fix “Keyset does not exist” for Scheduled Tasks in Windows
    http://technicallyeasy.net/how-to-fix-keyset-does-not-exist-for-scheduled-tasks-in-windows/


    My portal and blog about VSX: http://www.visualstudioextensibility.com
    Twitter: https://twitter.com/VSExtensibility
    MZ-Tools productivity extension for Visual Studio: https://www.mztools.com

    Wednesday, January 18, 2017 4:53 PM
  • Hi RUV,

    I could not repro your error, it run fine in my side, here is the screenshot:

    I followed your project and build my project, and no error message occurs. Please create a new stronger name and try again.

    Here is a MSDN document about signing in assembly:

    https://msdn.microsoft.com/en-us/library/ms247123%28v=vs.100%29.aspx?f=255&MSPPError=-2147217396

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 19, 2017 6:23 AM
    Moderator
  • I tried again and something is broken on my computer.

    Exact steps.

    1. Run Vs2015 as admin

    2. Create new Simple Console App in D:\Test\

    3. Go to signing and set password 123456

     

    4. Set Sign the assembly

    5. Error appear.

    Severity Code Description Project File Line Suppression State
    Error Importing key file "key.pfx" was canceled. WindowsFormsApplication5
    Severity Code Description Project File Line Suppression State
    Error Cannot import the following key file: key.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_9FA1FC3ABAEF83D1 WindowsFormsApplication5

    6. If you do sign without password. It works fine, so I assume build process have issues with providing password.

    1>------ Build started: Project: WindowsFormsApplication5, Configuration: Debug Any CPU ------
    1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2884,5): error MSB3325: Cannot import the following key file: key.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_9FA1FC3ABAEF83D1
    1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2884,5): error MSB3321: Importing key file "key.pfx" was canceled.
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


    RUV

    Thursday, January 19, 2017 10:51 AM
  • Hi Roman Uvarov,

    Please refer to the following steps:

    1). Open Developer Command Prompt for VS2015;

    2). Type cd the folder of key.pfx

    3). Type the following command:

    sn -i key.pfx VS_KEY_9FA1FC3ABAEF83D1

    refer to the following screenshot:

    the other option:

    Do with the following screenshot to install certificate:

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Roman Uvarov Monday, January 23, 2017 10:01 AM
    Friday, January 20, 2017 8:59 AM
    Moderator
  • Hi Roman Uvarov,

    I have found another similar thread about your issue, which may be helpful for you, please refer to it :)

    http://stackoverflow.com/questions/2815366/cannot-import-the-keyfile-blah-pfx-error-the-keyfile-may-be-password-protec

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 20, 2017 9:02 AM
    Moderator
  • Hi Roman Uvarov,

    With my above replies, has your issue been resolved? Please let me know your latest results.

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, January 23, 2017 7:38 AM
    Moderator
  • I tried again

    i created new key again, and open visual studio again as admin.

    I typed command sn -i key.pfx VS_KEY_9FA1FC3ABAEF83D1

    and get error again.

    I will close issue, as it clearly that IDE integration is off for me and errors text are very difficult to grasp.. ( not user friendly)

    I think code signing should be more user friendly, otherwise nobody will use it.

    I resolved my issue by manually signing EXE files without IDE. 


    RUV

    • Marked as answer by Roman Uvarov Monday, January 23, 2017 10:01 AM
    Monday, January 23, 2017 10:01 AM