Home > Articles > Security > Network Security

ClickOnce Security

This chapter is from the book

Understanding and Managing Publisher Certificates

The publisher certificates used to sign ClickOnce manifests are Authenticode Class 3 Code Signing certificates. This is just one form of an Authenticode certificate.2 There are many different kinds for various forms of authentication and authorization security scenarios.

Publisher certificates are generated with a public-private key pair and additional metadata about the publisher. The organization that creates a certificate is called the certificate authority or certificate issuer. The organization the certificate represents is the publisher. The Windows operating system has a built-in infrastructure for storing and authenticating certificates. There are a number of built-in certificate stores in the operating system, and you can create additional custom stores as needed.

Certificates are based on the concept of a trust chain. If you are presented with a certificate, you can determine from the certificate who the publisher organization is that the certificate represents, as well as who issued that publisher the certificate. From the issuer's certificate, you can determine the issuer's identity, as well as who issued the issuer their certificate. You can follow this chain of issuers back to what is called a Trusted Root Certification Authority. This chain of issuers provides a path of discovery that ensures that if you can verify the identity of all of the issuers in the chain, you have a way to track down and contact the publisher.

This way, if you deploy an application to your machine that is signed with a publisher certificate, and that application does harmful things to your machine, you can track down the publisher through the information in the certificate, or through the information that is retained by the issuer when issuing the certificate. Some certificate issuers include liability insurance as part of their certificate issuance services; this guarantees that if you cannot contact a publisher that was issued a certificate by that authority (to pursue a liability claim), the certificate issuer will assume the liability up to some limited degree.

To support this concept, a number of companies are in the business of verifying the identity of other organizations for the purposes of issuing certificates to them. VeriSign and thawte are two well-known companies who perform these services. The issued certificate (whether a code signing or publisher certificate, or one of the many other forms of certificates) becomes a digital representation of the organization's identity. Certificates from well-known and trusted certificate authorities are installed with the operating system or can be added later, which identifies them as a trusted issuer of other certificates. As a result, if you obtain a publisher certificate from an application vendor, and that certificate has been issued by an organization like VeriSign, you can be relatively certain that the company is who they say they are (they are a legal business entity), and that the organizational information contained in the certificate has been verified by the issuer (which includes the location of the organization or where its business license information can be verified).

The verification chain may be deeper than one level, however. A Trusted Root Certification Authority can issue certificates to themselves or other certification authorities to issue specific kinds of certificates. For example, see Figure 6.8 for the trust chain for a code-signing certificate for my company, Software Insight. You will see that the root VeriSign Class 3 Public Primary CA (certificate authority) certificate was used to issue a VeriSign Class 3 Code Signing CA certificate, which was then used to issue my Software Insight Class 3 Code Signing publisher certificate. To issue that certificate, VeriSign had to verify my existence as a legal business entity. They can do this through articles of incorporation or by verifying that a legal business license has been issued by your state or city, for example.

Figure 6.8

Figure 6.8 Certification Path

You do not have to purchase a certificate from a third-party certificate issuer to use ClickOnce. In an enterprise environment, your domain administrators can generate a certificate for themselves and configure that certificate as a Trusted Root Certification Authority (CA) on all the machines in the enterprise, allowing them to issue publisher certificates to your development organization with a single-level trust chain back to a known CA. Or if you are not concerned with providing any kind of assurances of identity with your ClickOnce publication, you can generate your own publisher certificate with either Visual Studio 2005 or with command line tools.

To make matters even more complicated, there are a number of different file formats that are used for delivering certificates. Third-party certificate issuers usually issue a certificate in the form of a .cer or .spc file. These certificate files usually only contain the public key portion of the certificate, so you can freely distribute them to client machines and install them in those machine's certificate stores. When you purchase a certificate, you also usually receive a separate .pvk file that contains the private key corresponding to that public key. You will need both the public and private key portions of a certificate, in a single .pfx file format, to use it for ClickOnce publishing. You can combine .cer or .spc file portions with the .pvk portion by using the pvkimprt.exe tool that is available from Microsoft downloads.3

There are several certificate stores on your Windows machines that you will use with ClickOnce deployment. Any certificate you use for ClickOnce publishing will be added to the Personal certificate store for the logged-in user when you publish the application. Additionally, if you want to avoid user prompting on the client machine, you will want to install your publisher certificate into the Trusted Publishers store on the client machine as discussed in the section Trusted Publishers' Permission Elevation later in this chapter. If you are installing a publisher certificate into the Trusted Publishers store, you will want to make sure the certificate's issuer is in the Trusted Root Certification Authorities store or the Intermediate Certification Authorities store, and that the root issuer of the trust chain is in the Trusted Root Certification Authorities store (see Figure 6.8).

Generating or Configuring a Publisher Certificate with Visual Studio 2005

If you publish a Windows Application project with Visual Studio without configuring a publisher certificate ahead of time, Visual Studio will generate a self-signed publisher certificate for you. In this kind of certificate, the identity of the issuer and the publisher are set to the logged-in Windows identity of the user.

The public and private key portions of the certificate are placed in a file with a .pfx file extension and the file is added to your project. The certificate is then configured as the signing certificate for ClickOnce publication, and is also added to your Personal certificate store on the development machine. When your application is published, the deployment and application manifest files are signed with this certificate. The .pfx file that is generated is a password-protected file, but when Visual Studio automatically generates the file for you the first time you publish, the password of the generated file is set to an empty password.

You can generate your own certificates through Visual Studio (with the option to password-protect the file), or you can select an existing certificate to use for signing as well. You do this through the Signing tab of your project properties editor (see Figure 6.9).

Figure 6.9

Figure 6.9 ClickOnce Signing Settings

After checking the box that is labeled Sign the ClickOnce manifests, you can either select a certificate from the logged-in user's Personal certificate store on the development machine, from a .pfx file, or generate a new certificate. If you click the Select from Store button, you will see the dialog shown in Figure 6.10 to select a certificate.

Figure 6.10

Figure 6.10 Select a Certificate Dialog

You can see that there are several small challenges to using the Select from Store option. The first is that if you test publishing an application with ClickOnce without first configuring the Signing tab to use an existing certificate, a new certificate is generated each time. Each of those certificates have a different public-private key pair and are distinct certificates, but they all have the same common name, known as CN for short, which will be your logged-in Windows account name (e.g., DOME-M200\Brian Noyes on my current machine). As a result, it is almost impossible to tell which one is which. The other challenge is that this dialog will not let you resize it, and you can see that there are a lot of columns, each with long content, so the usability of the dialog is extremely low.

An alternative to selecting a certificate from the Personal certificate store is to just point to an existing .pfx file for a publisher certificate. This will extract the information in the certificate and use it for signing, as well as install it in the Personal certificate store if it is not already there. You can see an example of this in Figure 6.10 as well—the entry that starts with XPS600 is from a certificate generated on a different machine of mine (named XPS600), and was automatically imported into my Personal certificate store on the current machine when I selected that .pfx file for my certificate. Clicking the Select from File button on the Signing tab gives you a standard file dialog to navigate to the location of your certificate file.

If you click the Create Test Certificate button on the Signing tab, you will be prompted for a password as shown in Figure 6.11. The dialog does not enforce strong passwords; you can leave it blank if desired.

Figure 6.11

Figure 6.11 Create Test Certificate Dialog

After you click OK in the Create Test Certificate dialog, the process is similar to what Visual Studio does if you do not configure a certificate and publish the application.

  • A test certificate is generated with the issuer and publisher (labeled Issued By: and Issued To:, respectively, in most places in the UI) set to your logged-in Windows identity.
  • The certificate is placed in a .pfx file with the name <appname>_TemporaryKey.pfx with the password you provided set on the file.
  • The .pfx file is added to the Visual Studio project files.
  • The certificate is imported into your Personal certificate store.

Once you have configured a certificate through the Signing tab, that certificate will be used for any subsequent publications of your application to sign the ClickOnce manifests.

Installing a Certificate in a Store with Visual Studio 2005

Visual Studio lets you install a certificate into any certificate stores on your machine if desired. As described earlier, any certificate that you configure to sign your ClickOnce manifests by generating the file or selecting a file will be installed into your Personal certificate store on your development machine. Additionally, if the certificate is password protected, then you can use Visual Studio to manually install that certificate into other stores on your machine.

Do the following if you want to install a signing certificate into a different store on your machine.

  1. Click on the More Details button on the Signing tab (see Figure 6.9). This will display the certificate information dialog shown in Figure 6.12.
    Figure 6.12

    Figure 6.12 Certificate Information Dialog

  2. At the bottom of the dialog, click the Install Certificate button.
  3. This will bring up the Certificate Import wizard shown in Figure 6.13. (This same wizard can be accessed by running certmgr.exe and clicking the Import button in that tool). Click Next to start the process.
    Figure 6.13

    Figure 6.13 Certificate Import Wizard

  4. The second step in the wizard (see Figure 6.14) lets you select which store the certificate will be placed into. Select the radio button labeled Place all certificates in the following store and click the Browse button.
    Figure 6.14

    Figure 6.14 Certificate Import Wizard – Store Selection

  5. The Select Certificate Store dialog shown in Figure 6.15 will display, and you can pick from the available stores on the machine. Select the store you want to place the certificate into, such as the Trusted Publishers store, and click the OK button.
    Figure 6.15

    Figure 6.15 Select Certificate Store Dialog

  6. You will return to the wizard and the selected store will be displayed in the Certificate store field in the middle of the form (see Figure 6.16). Click the Next button to continue.
    Figure 6.16

    Figure 6.16 Completed Store Selection Step

  7. The final step of the wizard (see Figure 6.17) will display, summarizing the import that is about to happen. Click the Finish button to complete the installation of the certificate into the selected store.
    Figure 6.17

    Figure 6.17 Certificate Import Wizard Completion

Command Line Certificate Tools

There are several command line tools that come with the .NET Framework SDK or that you can download to assist you in generating, configuring, and managing publisher certificates. To generate a test certificate from the command line, you can use the makecert.exe command line tool. This tool offers more fine-grained options for generating publisher certificates. Run makecert.exe from a command line with the -? switch for a brief summary of options or with the -! command line switch for more detailed options. The makecert.exe tool uses the CryptoAPI under the covers and is available in the .NET Framework SDK binaries (\Bin) folder underneath your Visual Studio 2005 installation (C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin path with a default installation).

To configure certificates with respect to the machine certificate stores, you can use the certmgr.exe tool. If you run certmgr.exe without any arguments, it launches a UI version of the tool as shown in Figure 6.18.

This tool provides a graphical management console for importing, exporting, and removing certificates from the named stores on your development machine. Clicking the Import button shown in Figure 6.18 launches the same wizard discussed in the previous section for installing certificates in stores.

Figure 6.18

Figure 6.18 Certificate Manager Tool

You can also incorporate certmgr.exe in a Windows Installer installation package and use it to configure certificates on a client machine as well using command line options. For example, the following command line will install a certificate in the Trusted Publishers store on a target machine if the certmgr.exe tool is available in the command prompt PATH environment variable.

certmgr.exe -add MyCompany.cer -s TrustedPublisher

Another command line tool to be aware of that was mentioned earlier is the pvkimprt.exe tool. This tool is available for download from Microsoft (www.microsoft.com/downloads) or through the Platform SDK. Pvkimprt.exe lets you take a .cer or .spc file that just contains the public key portion of a publisher certificate, combine it with a .pvk file that contains the private key portion of the certificate, and generate a .pfx password-protected certificate file that contains the entire certificate. To do this, you run the tool with a –pfx switch, also passing the .spc or .cer file path and the .pvk file path. This will bring up a wizard that will step you through the process of providing a password and then exporting the keys to a .pfx file.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020