This article may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. To maintain the flow of the article, we've left these URLs in the text, but disabled the links.
|
|
Nick Dallett |
Authenticode: When Versions Collide |
In this column, I'll look at the differences between the method used to sign code with a digital ID under Internet Explorer 3.02 and that used to sign code under Internet Explorer 4.0 and greater, and how to troubleshoot the errors that can occur…when versions collide. Background Authenticode technology has been available since Internet Explorer 3.0. When Internet Explorer 4.0 was released, it included an upgrade to the Microsoft CryptoAPI, the code that performs the basic functions needed to create, manipulate, and authenticate X.509 digital certificates. There was a corresponding upgrade to the tools used to sign code using this API. However, because Internet Explorer was distributed primarily through user and not developer channels, many developers were not aware that they had to update their toolkit. Trouble(shooting) in Version City Of all the calls to developer support regarding Authenticode, about 19 out of 20 can be solved by checking the version of signcode.exe in the binaries directory of the Internet Client SDK or ActiveX® SDK install directory (typically C:\InetSDK\bin or C:\AxSDK\bin). Chances are, if you are using Internet Explorer 4.0 or greater and code-signing tools that were installed with the ActiveX SDK, you can take for granted that you have the wrong or mismatched versions of Signcode and its dependent DLLs. This is because changes to the Microsoft CryptoAPI for Internet Explorer 4.0 required changes to tools such as Signcode that manipulate certificates using CryptoAPI.
Verify the Fix Once you've completed the installation, verify that you can successfully sign code. Create a new folder and place the following files into it:
Next, create a batch or command file containing the following text: |
|
Replace Mycontrol.cab with the name of the file you are signing, and MySPC and myPrivateKey with your .spc and .pvk file names, respectively. (You must be connected to the Internet in order to use Verisign's timestamp server. If you cannot connect to the Internet from your machine, omit the "-t http://timestamp.verisign.com/scripts/timstamp.dll" parameter. For a full reference to the parameters used with Signcode, read "Signing Code with Microsoft Authenticode Technology" at http://msdn.microsoft.com/downloads/tools/authcodeie4/authcodeie4.asp.)
Save the file as Sign.bat (or Sign.cmd on Windows NT®) in the same directory to which you copied the previous files. You should now have four files in this directory: your .spc and .pvk files, your cabinet or executable file, and Sign.bat. For the final step, run the batch file by typing "Sign" at the command prompt. If you are using a certificate with a password, you will be prompted to enter that password. If all went well, you will receive the message "Succeeded." Still Using Internet Explorer 3.02? Microsoft strongly advises upgrading from Internet Explorer 3.x to Internet Explorer 4.0 or greater. The older versions of the Authenticode tools should still work for those who have Internet Explorer 3.02 with the Authenticode update, and who have never installed any version of Internet Explorer 4.x or the Internet Client SDK. Note that the command line parameters are different for 3.02. To perform the previous signcode step using the Internet Explorer 3.02 version of signcode, you would type the following: |
|
Further Troubleshooting
If you are still receiving errors after performing these steps, there are three more things that could be causing errors: RSABase.dll could be incorrectly registered, your certificate file could be corrupt, or your Verisign root could be
out of date.
|
|
If you are still getting error messages after registering RSABase.dll, and you are using a certificate issued by a Certification Authority, you may have a corrupted certificate file, or a mismatch between your .spc and .pvk files.
You may want to test your installation by creating a test certificate using the MakeCert utility in the Internet Client SDK. If the test certificate succeeds, then recopy your .pvk and .spc files from your backup diskette or smart card. If signing fails again, contact your Certification Authorityif your certificate files are invalid or corrupted, you may need to have them revoked and reissued. If you downloaded and installed a Verisign certificate on a machine with either Windows NT 4.0 Service Pack 4 or Internet Explorer 5.0 installed and you are trying to use those certificate files on anther machine that does not have one of those two installations, then you may need to update the Verisign root authority on that machine. Installing either of the two updates will update this root authority. If you install you certificate using a machine that does not already have the updated certificates, they should be downloaded from Verisign automatically when you connect to their server to download the certificate files. As a general rule, plan to upgrade you code-signing toolkit with every major release of Internet Explorer. The code-signing tools for Internet Explorer 5.0 were released along with the Internet Explorer and Internet Tools beta release, and can be found at http://msdn.microsoft.com/downloads/tools/authcodeie4/authcodeie4.asp. Further Information There are a number of useful sites which can help your Authenticode work. A complete reference to the Authenticode tools can be found on the Site Builder Network Workshop site at http://msdn.microsoft.com/downloads/tools/authenticode/authcode.asp.
|
Frequently Asked Questions About Authenticode at http://msdn.microsoft.com/workshop/security/authcode/signfaq.asp |
From the February 1999 issue of Microsoft Internet Developer.