The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Vista Sidebar Gadget - Code Signing - HowTo

0 replies.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a flat view of this topic  Flat View
Previous Topic   Next Topic
Threaded View: This topic has 0 replies on 1 page
Sascha Corti

Posts: 797
Nickname: sascha
Registered: Aug, 2003

Sascha Corti is a developer evangelist for Microsoft in Switzerland.
Vista Sidebar Gadget - Code Signing - HowTo Posted: Sep 21, 2007 9:42 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Sascha Corti.
Original Post: Vista Sidebar Gadget - Code Signing - HowTo
Feed Title: Console.WriteLine("Hello World");
Feed URL: http://www.corti.com/WebLogSascha/blogxbrowsing.asmx/GetRss?
Feed Description: A technology blog with a focus on the .NET framework, the Visual Studio .NET tools and the Windows server platform with of course the normal weblog-noise on what's happening in the industry and reviews of the latest geeky gadgets.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Sascha Corti
Latest Posts From Console.WriteLine("Hello World");

Based on a recent inquiry, I have compiled the following, simple How-To on digitally signing Vista Sidebar gadgets. Much of the information can be found on the two, following URLs:

Thanks a lot to the orignal authors!

Running an unsigned “.gadget” file will result in the following warning:

gadget_signing_1.jpg

Installing a Sidebar Gadget that is digitally signed results in a similar dialog, that shows the publisher and the certificate to the user:

gadget_signing_2.jpg

Clicking the “Name” hyperlink shows the website of the publisher (part of the digital signature) and clicking “Publisher” hyperlink shows the certificate itself:

gadget_signing_3.jpg

Gadgets must be created using CAB compression if you want to code-sign them.  Zip files renamed to .gadget cannot be code-signed - therefore gadgets created in this way for distribution will always show up as "untrusted publisher" if a user clicks on them.

  • To make a redistributable gadget that is code-signed, you must compress the file as a Windows CAB file using the “cabarc” utility (if you've opened a VS2005 Command Prompt it should be in the path or you'll probably find it in %ProgramFiles%\Microsoft Visual Studio 8\Common7\Tools\Bin).  Example command line: (from within gadget folder):

    cabarc -r -p n DemoGadget.gadget "*.*"

Now, if you have no valid certificate to sign code at hand, you may want to create your own PFX file with your personal information. You can do this by completing these two steps:

  • Create your public & private Keys (You will be prompt to define the private key’s password):

    makecert.exe -sv TestKey.pvk -n "CN=Your Name Here" TestKey.cer
  • Create your PFX file from the public and private key:

    pvk2pfx.exe -pvk TestKey.pvk -spc TestKey.cer -pfx TestPFX.pfx -po secure_password
  • Signtool.exe (found in the same folder) can then be used to code sign the .gadget file.  I tend to have a .pfx (packaged certificate and private key) so that the build process is portable across machines.  Example command line (assuming you are signing with a public certificate):

    signtool.exe "sign" /f "TestPFX.pfx" /p "secure_password" /d "Test’s Demo Gadget" /du "http://www.test.com" /t "http://www.mycertprovider/timestampurl" "DemoGadget.gadget"

One perhaps useful bit of information about this - unlike webserver SSL certificates where the certificate expires and you get warnings in a web browser, if you code-sign with a public certificate and timestamp as in the example above (most public certificate providers provide this URL) - you'll find that Windows will trust the file forever, even when the certificate has expired.

The resulting installation looks as follows:

gadget_signing_4.jpg

gadget_signing_5.jpg

Read: Vista Sidebar Gadget - Code Signing - HowTo


Topic: Windows Mobile 6 Emulator ohne Visual Studio Previous Topic   Next Topic Topic: Efficient Compound Index Usage

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use