MakeCert, Cert2SPC, and Signcode are tools you can use to sign and test code. These tools are available in the \Program Files\IEAK\Reskit\Tools folder of this IEAK Resource Kit. You can find additional resources in the Microsoft Internet Client SDK.
Use the MakeCert test program to generate a test X.509 certificate. MakeCert performs the following tasks:
The syntax for MakeCert is as follows:
MakeCert [basic options | extended options] outputFile
MakeCert provides basic options and extended options. Basic options are the options most commonly used to create a certificate. Extended options provide more flexibility. The options for MakeCert are also divided into three functional groups:
Options in Groups 2 and 3 cannot be mixed, with the exception of the –ic option.
The following examples show how to create certificates with MakeCert using the Internet Explorer 4.0 options.
Example 1
Make a certificate issued by the default test root. Save the certificate to a file.
MakeCert myNew.cer
Example 2
Make a certificate issued by the default test root. Save it to a certificate store.
MakeCert -ss myNewStore
Example 3
Make a certificate issued by the default test root. Create a .pvk file and output the certificate to both a store and a file.
MakeCert -sv myNew.pvk -ss myNewStore myNew.cer
Example 4
Make a certificate issued by the default test root. Create a key container and output the certificate to both a store and a file.
MakeCert -sk myNewKey -ss myNewStore myNew.cer
Example 5
Make a certificate using the default test root. Save the certificate to a store. Then make another certificate using the newly created certificate. Save the second certificate to another store.
MakeCert -sk myNewKey -ss myNewStore MakeCert -is myNewStore -ss anotherStore
Example 6
Make a certificate using the default test root. Save the certificate to my store. Then make another certificate using the newly created certificate. Because there is more than one certificate in my store, identify the first certificate using its common name.
MakeCert -sk myNewKey -n "CN=XXZZYY" -ss my MakeCert -is my -in "XXZZYY" -ss anotherStore
Example 7
Make a certificate using the default test root. Save the certificate to my store and to a file. Then make another certificate using the newly created myNew certificate. Because there is more than one certificate in my store, uniquely identify the first certificate using the certificate filename.
MakeCert -sk myNewKey -n "CN=XXZZYY" -ss my myNew.cer MakeCert -is my -ic myNew.cer -ss anotherStore
Example 8
Create a self-signed certificate named myNewRoot using the default test root. Then use SignCode with the certificate to sign a file.
MakeCert -sk myNewRootKey -r -ss myNewRoot SignCode -s myNewRoot myControl.exe
Example 9
Create a self-signed certificate named myNewRoot using the default test root. Save myNewRoot into a system certificate store ca. Then make a certificate from myNewRoot and sign some code with the certificate.
When SignCode uses a certificate in a store for signing, it also builds a certificate chain from the signing certificate to a root. All of the certificates in the certificate chain must be in any of the my, ca, spc, or root certificate stores. In this case, myNewRoot is in the ca certificate store.
MakeCert -sk myNewRootKey -r -ss ca myNewRoot.cer MakeCert -is ca -ic myNewRoot.cer -ss myNewSign SignCode -s myNewSign myControl.exe
After you have generated a certificate, you can create an SPC (Software Publisher Certificate) by using the Cert2SPC program. This program wraps multiple X.509 certificates into a PKCS #7 signed-data object. Note that this program is for test purposes only. A valid SPC is obtained from a CA.
The syntax for Cert2SPC is as follows:
Cert2SPC cert1.cer cert2.cer. . .certN.cer output.spc
where:
Here is an example:
Cert2SPC MyCert.cer MyCert.spc
This wraps an X.509 certificate, MyCert.cer into a PKCS #7 SPC called MyCert.spc.
The final step is to actually sign a file by using the SignCode program. This program does the following:
The syntax for SignCode is as follows:
SignCode [options] [fileName]
where:
The options for SignCode are divided into three groups:
Options in groups 2 and 3 cannot be mixed in the same operation.
After the file has been signed (assuming you have a valid certificate) and provided with a timestamp, it can be distributed to your customers. Note that certificates generated with the test programs MakeCert and Cert2SPC are not valid for signing code that will be distributed to the public. Independent software vendors must obtain a certificate from GTE, VeriSign, Inc., or another CA for signing code that will be distributed to the public.