Cannot import the following key file error when importing pfx

后端 未结 8 1668
名媛妹妹
名媛妹妹 2021-02-01 17:03

I researched this question thoroughly on stackoverflow and I have seen numerous answers but none of them have worked for us yet. We recently bought a code signing certificate fr

相关标签:
8条回答
  • 2021-02-01 17:37

    I had the same issue. I am building the application from a thumb drive on numerous computers and believe this is the cause.

    I found success with the "sn -i [comodo].pfx VS_KEY_xxxxxxxxxxxxx" method. I did the following steps:

    1. Run "Developer Command Prompt" as administrator (found in Start->All Programs->Visual Studio->Tools)
    2. Navigate to your key directory (for me this was the root of my project directory, not the solution directory)
    3. Execute "sn -i mykey.pfx VS_KEY_xxxxxxxxxxxxx" (mykey.pfx and VS_KEY_xxxxxxxxxxxxx are both found in the build error message)
    4. Enter the password if required

    When I tried this without running "Developer Command Prompt" as an administrator, I get the help display text when running "sn -i mykey.pfx VS_KEY_xxxxxxxxxxxxx" and it does not work. The trick was to make sure I ran the develop prompt as an administrator.

    For context, I am using VS Community 2013.5, Window 7 x64 Professional, and NET Framework 4.7

    0 讨论(0)
  • 2021-02-01 17:39

    I have learned that Visual Studio doesn't seem to handle subordinate certificates very well.
    I tried several certs on multiple machines (different OS/VS combinations) with the same results.
    I finally found this as a workaround:

    • Sign the assembly with

      signtool sign /f "[path to pfx]" /p [password] /v "[path to assembly]"

    • Build your installer with mageUI (see "Manually Deploying a ClickOnce Application")

    The issue with Visual Studio seems to be that it does not like certificate chaining. This you can solve by importing/exporting the certificate without the chaining. The next issue is addressed by using the certutil and export with the AT_SIGNATURE. I was able to import it into VS and build, however it doesn't seem to sign the assembly.

    0 讨论(0)
  • 2021-02-01 17:42

    For me following worked, First Install certificate by double clicking on it. then,

    Project Properties -> Signing -> If 'Sign the ClickOnce manifests' is checked -> click on 'Select from file' and select .pfx file and it should show all the certificate valid details like Issued to, Issued By, Intended Purpose etc.

    0 讨论(0)
  • 2021-02-01 17:43

    Another 'worked for me' ...

    Right-clicked on the PFX in Windows Explorer, chose 'Install PFX' and in the wizard supplied the password. Then in the project properties in VS, under 'Signing' chose 'Change Password' and re-entered the password. Prior to this only running VS as administrator would work.

    0 讨论(0)
  • 2021-02-01 17:44

    I got similar error. Solved it by choosing Install PFX from a context menu in Windows Explorer.

    0 讨论(0)
  • 2021-02-01 17:44
    1. Navigate to Project Properties --> Signing
    2. Please select corresponding *.pfx file from drop down.
    3. Enter the previous password used for code signing. (password: ask the person who has signed the assembly and created the self signed certificates and code signed)
    4. (optional) It automatically adds your certificate as trusted. It can be seen using Management console window ( run MMC command and add certificate add-snaps to see the certificate)

    0 讨论(0)
提交回复
热议问题