locked
Adding .cer file in msi installer RRS feed

  • Question

  • Hi,

    I am building a msi installer using VS 2008,. In my msi installer i have to add a certificate file(.cer). I can use custom action's vbscript to call CertMgr.exe but i don't want to ship my product installer with CertMgr.exe as its Microsoft's executable and i am not sure i can ship it with my installer. I want to know is there any mechanism in VS 2008 by which i can add .cer file or will i have to write some script to do it?

    I tried writing an executable in c# to add .cer and call it in my vbscript but the problem is that i have to install this msi in a fresh windows 2008 machine, so it throws .net 3.1 required error and aborts installation.

    So, how do i add a .cer in msi installer created by VS 2008?

    Is it possible to do this directly from vbscript?

     

    Thanks in advance.

     

    Sunday, September 5, 2010 10:01 AM

Answers

  • Are you trying to populate the MsiDigitalCertificate table in the MSI file itself?

    You don't do that through a custom action at runtime.  You would do this after the VS2008 generates the MSI itself at build time.  In this case you can use a script to insert the CER or even generate a MST using orca and apply that through a script or even a cmd file using msitran.exe.

    Is this what you are trying to do?

    Sincerely,
    Adrian Accinelli

    • Proposed as answer by Jing0 Thursday, September 9, 2010 7:50 AM
    • Marked as answer by Jing0 Friday, September 10, 2010 2:46 AM
    Tuesday, September 7, 2010 8:25 PM
  • @Adrain I was trying to add a .cer to System Store like we do it with "CertMgr.exe /add /s" command.

    Yah, i finally got it solved by calling a PowerShell script form my Custom action VBscript. This PowerShell script uses System.Security.Cryptography.X509Certificates.X509Store and System.Security.Cryptography.X509Certificates.X509Certificate2 classes to add the certificate.

    • Marked as answer by atrockz Thursday, September 9, 2010 6:38 PM
    Thursday, September 9, 2010 5:45 PM

All replies

  • Are you trying to populate the MsiDigitalCertificate table in the MSI file itself?

    You don't do that through a custom action at runtime.  You would do this after the VS2008 generates the MSI itself at build time.  In this case you can use a script to insert the CER or even generate a MST using orca and apply that through a script or even a cmd file using msitran.exe.

    Is this what you are trying to do?

    Sincerely,
    Adrian Accinelli

    • Proposed as answer by Jing0 Thursday, September 9, 2010 7:50 AM
    • Marked as answer by Jing0 Friday, September 10, 2010 2:46 AM
    Tuesday, September 7, 2010 8:25 PM
  • Hi,

     

    How is this problem now? Has it been solved?

     

    Best regards,

    Ling Wang


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Thursday, September 9, 2010 8:28 AM
  • @Adrain I was trying to add a .cer to System Store like we do it with "CertMgr.exe /add /s" command.

    Yah, i finally got it solved by calling a PowerShell script form my Custom action VBscript. This PowerShell script uses System.Security.Cryptography.X509Certificates.X509Store and System.Security.Cryptography.X509Certificates.X509Certificate2 classes to add the certificate.

    • Marked as answer by atrockz Thursday, September 9, 2010 6:38 PM
    Thursday, September 9, 2010 5:45 PM