InfoPath forms with custom code and those that have their Security Level set to Full Trust must be signed so that they can be run by the client. That’s fine but who wants to pay for a code signing certificate for internally developed applications? If we string together a couple of facts we can quickly realize that we shouldn’t have to pay for code signing certificate if we are developing code that will only ever be used by internal users.
First, certificates work because there are a set of trusted root certificate authorities. Their responsibility is to issue certificates. The organizations running the trusted root certificate authorities are responsible for only issuing certificates where the certificate matches the organization requesting the certificate. They make no judgment about whether the person is good or bad – only that they are who they say they are. The service that you pay for when you purchase a certificate from a trusted root certificate authority is that they have verified your identity.
Microsoft Windows has a list of trusted root certificate authorities – but when a computer is in a domain, it automatically trusts the Enterprise Certificate Authority for the domain. The Enterprise certificate authority is an instance of certificate services which comes with Windows Server operating systems. It allows an administrator to issue certificates. There are several templates for the kinds of certificates to be issued. The most common one is for a web server – an SSL certificate – but there are others as well.
Certificate Services has a template for code signing certificates. If you put everything together you realize that when all of your computers are a member of a domain you can request and get granted a code signing certificate that’s valid for anyone using the certificate in the domain.
Here’s how to do it…
Install Certificate Services
If you don’t have an Enterprise Certificate Authority in your domain, go to a server and …
1) Click Start- Control Panel-Add/Remove Programs
2) Click Windows Components
3) Click the checkmark to the left of Certificate Services
4) Click Next
5) Follow the wizard to create an Enterprise Certificate Authority.
Note: There are special precautions for protecting enterprise certificate authorities including creating sub-authorities, and taking the certificate authority offline. If your organization is large, you should review the risks and guidelines for creating certificate authorities and manage security appropriately. In smaller organizations it’s generally acceptable to create an enterprise CA and issue certificates from it.
Create a Copy of the Code Signing Template
The default out of box code signing certificate doesn’t allow the certificate’s private key to be exported. This means that only the user to which the certificate is issued can use it. Generally you don’t want to have developers to have enough permission to request the certificate themselves. If you want to be able to move the certificate from user to another you’ll need to make a copy of the Code Signing certificate and change it so it can have exportable keys. We’re going to show you how to do this. If you follow these steps choose your duplicated code signing certificate in the following steps.
1) Click Start-Run and enter certtmpl.msc.
2) Right click the Code Signing template and select Duplicate.
3) Enter a name for the new Template. For instance, add your organization name in front.
4) Click the Request Handling tab.
5) Click the Allow private key to be exported.
6) Click OK.
You now have your own code signing template that can be exported.
Enable the Code Signing Template
By default the code signing certificate template isn’t available to be issued from your certificate authority. To do that you need to enable the template which you can do by following these steps…
1) Click Start-Administrative Tools-Certification Authority
2) Expand the server that you installed certificate services on
3) Click the Certificate Templates folder.
4) Right click the Certificate Templates folder, select New, Certificate Template to Issue.
5) Click Code Signing and click the OK button.
Now you can issue Code Signing Certificates
Issue the Certificate
Now that everything is in place you can issue the certificate. Follow these steps to do that…
1) Open a web browser and navigate to http://server/certsrv where server is the name of the server which you installed certificate services.
2) Click the Request a certificate link
3) Click the advanced certificate request link
4) Click the Create and submit a request to this CA link
5) In the certificate template drop down box select Code Signing.
6) Enter a friendly name for the certificate in the friendly name textbox at the end of the page.
7) Click Submit. You may be prompted that the web site is requesting a certificate, click Yes.
8) Click the Install Certificate link. Again you may be warned that you’re getting a certificate, click Yes.
You now have a certificate in your certificates store. If you’ve not been doing this as the developer (and you probably haven’t), you’ll need to export the certificate and import it into the developer’s account. You’ll only be able to do this if you created your own code signing template.
Exporting the Certificate
Here’s what you need to do to export the certificate:
1) Click Start-Run enter certmgr.msc
2) Expand the Personal Folder
3) Expand the Certificates folder
4) Locate the certificate that indicates that its intended purposes is Code Signing.
5) Right click on that item and select All Tasks-Export
6) Click Next
7) Click Yes, export the private key.
8) Click Next.
9) Click Next
10) Enter a password and confirm password.
11) Click Next
12) Enter a file name for the exported file
13) Click Next
14) Click Finish
You’ve exported the certificate.
Importing the Certificate
If you’ve exported the certificate you can move that over to the user or machine that will be signing the code and follow these steps to import the certificate.
1) Double click the file to start the Certificate Import Wizard.
2) Click Next
3) Click Next
4) Enter the password you entered when you exported the file.
5) Click Mark the key as exportable.
6) Click Next
7) Click Next
8) Click Finish
9) Click OK.
You’ve now imported the certificate file.
Configure InfoPath to Use the Certificate
The final step in this journey is to tell InfoPath to use the certificate. Do that by following these steps…
1) Open an InfoPath form in design view.
2) Click Tools-Form Options
3) In the category pane, click Security and Trust
4) Click Sign this form template
5) Click the Select Certificate button
6) Select the certificate that you just issued.
7) Click OK.
8) Click OK.
OK, you’re done. That’s all you need to do in order to get a code signing certificate that will sign InfoPath forms that the users of the organization will recognize.
Wednesday, April 28, 2010
Subscribe to:
Posts (Atom)