The Naked PC Newsletter

Your good neighbor
who's also a computer
consultant!

Friday, 04-Jul-2008 21:36:17 EDT

TNPCers Say:
I enjoy your newsletter so very much and have learned so much from it, many thanks. -- Sharon I.
117,977+ current readers

Type your email address and click Subscribe!
Subscribe to Our Newsletter
Name: 
E-mail:

Swiss-Tech Key Ring Products

You'll find a jillion uses for these super-cool portable tool kits that fit right on your key chain. Whether it's fixing your eyeglasses, pulling splinters, tightening up the loose screws you run into everyday... Open computer cases with ease, snip wires, all the jobs a small set of pliers would make easy work of, you've got to check out Swiss-Tech tools!


Get Jim and Lee's Book!
T.J. Lee and Lee Hudspeth's Absolute Beginner's Guide to PC Upgrades
Now available at Amazon!



Contact TNPC



Home What is TNPC?
Meet the crew... The TNPC Store TNPC Articles
Send comments Members Only Prior Issues

From TNPC issue #3.23...Lee Hudspeth

Developer's Corner: Digitally Signing Office VBA Projects

by Lee Hudspeth
November 9, 2000

In this article, the digital signatures I describe are used for "signing" source code, they are not the digital signatures you would use to sign email. The focus of this article is on digital certificates. The two main reasons you as a developer would use a digital certificate are to:

1. protect your software from tampering after you've published it, and

2. guarantee to your customer that your software did in fact come from your company, not a firm masquerading as you.

What files can you sign with a code-signing digital certificate? A wide variety: Microsoft Office documents, ActiveX controls, Java applets, DLLs, CAB files, among others.

If you distribute Microsoft Office macros to people outside your office, whether as Word documents with code in them, Excel workbooks with code in them, or any type of Office add-in, you need to sign these files with a code-signing digital certificate issued by a Certificate Authority. Why?

Because the technology is readily available, affordable, and it gives your customers a high level of confidence in the authenticity of your code. Signed code assures your customers that your stuff is indeed your stuff, not code manufactured by some yahoo who stole your moniker. Signed code also guarantees that your code hasn't been tampered with and that it hasn't been corrupted in transit. Given the ease with which Office documents can propagate viruses, using a digital certificate is a smart business decision. The benefit to the customer manifests itself like so. (Note: throughout this article the term "customer" can also be read as "user" since people inside your organization-- users--and outside your organization--customers--can be the beneficiaries of your Office VBA projects.)

When the customer opens, loads, or uses an Office file that contains VBA code, and that file has been signed by a digital certificate, all of that file's functionality will be available regardless of the macro security level setting active on the customer's PC right then. Furthermore, that functionality is available without the customer having to answer a macro warning dialog each time she uses the tool. The first time the tool is used on the system, if the customer has never before "trusted" the digital certificate's source company on this PC, that's when the customer gets to decide what level of trust to give to your digital certificate.

A Certificate Authority is a company that is mutually trusted by code developers and code consumers. A list of Certificate Authorities is available here:
http://www.TheNakedPC.com/t/323/tr.cgi?cert1

A code-signing digital certificate from market leader VeriSign (the VeriSign Class 3 Developer ID) costs $400 up front and a $400 annual renewal fee. At PRIME Consulting Group, Inc. we use a Thawte Developer Certificate. Thawte's Developer Certificate costs $200 up front with a $100 annual renewal fee. (Thawte was bought out last year by VeriSign but continues to maintain its Thawte brand.)

(The following two links were unintentionally omitted in the original email version of the article. -- Ed.)

http://www.thawte.com
http://www.verisign.com

What if you're part of a larger organization and only need to distribute certified code inside the company? Microsoft's "trust me, it's me" SelfCert.exe tool won't cut it. You need to set up a Microsoft Certificate Server that allows your company to act as the Certificate Authority for all its employees. For more information see:
http://www.TheNakedPC.com/t/323/tr.cgi?cert2

Here are the steps to follow to get your digital certificate, and how to use it to sign an Office document that contains code. Due to space constraints, you'll find each step's details in this article's supplemental Web page:
http://www.TheNakedPC.com/t/323/tr.cgi?cert3

1. Put one person in charge of code signing.

2. Choose a Certificate Authority.

3. Establish one PC as the "code signing" PC.

4. Apply online for a digital certificate, while on your code signing PC.

5. Pick up your digital certificate using your code signing PC.

6. Turn on timestamping on your code signing PC.

Be sure to timestamp your digital signatures. The precise technique for doing so varies from one Certificate Authority to the next. By timestamping, the software behind digital certificates can verify that a particular signature was applied while the certificate was still valid, meaning, before its one- year expiration date.

Annoyingly, there is only one way to be certain that a file was successfully timestamped when you sign it. You must watch your modem lights (or firewall activity indicator) for a brief flurry of communication between your PC and the timestamping server at the moment that the digital certificate is applied (see next step). There is no user interface or properties sheet for a file to indicate that its digital signature has been timestamped.

New Tool: PRIME TimeStamper

Shameless plug coming! Our firm PRIME Consulting Group, Inc. has developed a tool called PRIME TimeStamper that completely relieves the Office developer of the time-consuming hassle involved in turning timestamping on and off. Ideally, you want to turn timestamping on only once when you do the final compile for a project. Even on a high-speed Internet connection, every time you save an Office VBA project with timestamping turned on, the save operation can take longer than you'd like to wait. (That's the nature of getting the timestamp from the authority's server.) PRIME TimeStamper works in both Office 2000 and the latest beta of Office 10 (also known as Office 2002). For more information about PRIME TimeStamper, or to purchase your copy now (covered by our lifetime money-back guarantee), go here:
http://www.TheNakedPC.com/t/323/tr.cgi?cert4

7. Run the PVK Digital Certificate Files Importer on your code signing PC.

For more information see:
http://www.TheNakedPC.com/t/323/tr.cgi?cert5

8. Sign the Office files that store your code using your code signing PC.

Make sure you're connected to the Internet. Assuming the file is a Word template, open the template, start Word's Visual Basic Editor, and select the template's VBA project in the Project Explorer. Now select Tools, Digital Signature, click the Choose button, select your company's digital certificate from the list, OK, OK. Save the Word template. Once saved, it has been digitally signed and timestamped.

9. Test the signed file on any PC.

You can test on any PC, not just your code signing PC. Set Word's macro security level to High, close Word, restart Word, and open the signed template. If this is the first time this PC has ever opened a file digitally signed by your company's digital certificate, you'll see a Security Warning prompt. After setting this trust level, whenever you open that template on this PC--even with a High macro security level setting--there will be no macro warning dialog and the code behind the template will be silently enabled, as it *should* be for an add-in from a trusted source.

If you don't timestamp a project, once your system clock encounters a time beyond one year from the date of your digital certificate's issuance, a Security Warning dialog will state, "A certificate (signing or issuer) has expired." A timestamp avoids all this inconvenience.

Lee Hudspeth can be reached at:
mailto:code@PRIMEConsulting.com

Why not subscribe to TNPC Newsletter Now?
You'll be glad you did.
Your Name: 
Your E-mail Address:
Copyright © 2000, PRIME Consulting Group, Inc. and Dan Butler.
All Rights Reserved.
The Naked PC is a trademark of PRIME Consulting Group, Inc.
ISSN: 1522-4422

You may reprint an article from TNPC as long as you show the
entire article and include the authors byline, excerpt and
subscription information as shown:

article_title
by author_name
(This article originally appeared in The Naked PC
newsletter; subscribe at http://www.TheNakedPC.com)

Return to Top


Advertise in TNPC Disclosure JOIN the Horde!
Letters to Editor Privacy policy Search TNPC
TNPC Library
TNPC Forum
Subscriber Services

Why not subscribe to TNPC Newsletter Now?
You'll be glad you did.
Your Name: 
Your E-mail Address:

TNPC Hot Tips:
  • Email out of control? Spam filling your inbox? People trying to steal your identity? Same here - until I applied these tips. You can too in a new multimedia e-book. Tame Your Email.

  • DO YOU MAKE THESE MONEY MISTAKES? Do you know that trying to pay off your high interest rate debts first and/or paying extra on more than one debt is the SLOWEST way to get out of debt? Don't make these same mistakes. Learn more at by clicking here...

Google

In The Current Issue

Read #3.23 here!

Veritas Revisited
Developer's Corner:
   Signing VBA Projects

Putting Together an
   E-Commerce Store


The Cathedral and the Bazaar
Eric S. Raymond
At its core the Open Source movement is the contrast between Centralized (the Cathedral) and de-centralized (the Bazaar) development. Thought-provoking and useable ideas on project management and the real meaning of free software.

FrontX installs into a vacant 5 ¼ inch bay and brings those pesky, hard to find ports right to the front of your computer.

RGB Decimal to Hexadecimal Converter
Tom's Web Reference contains a simple tool for converting RGB decimal values (255 255 255) and RGB hexadecimal values (FF FF FF) from one notation to the other. Super handy if you build Web pages.

Read TNPC Backissues