Certificate Generation

The reference implementation source tree provides a simple tool for creating root certificate authorities (CAs), intermediate certificates authorities, and certificates. The tool is located under the /agent/tools directory in the source tree and is named certGen.sh for unix/linux based systems and certGen.bat for Windows.

Certificate Jargon

The direct project uses X509 certificates for SMIME operations and X509 certificate authorities for enforcing message trust. A certificate authority is actually just a certificate with certain fields, policies, extensions. Specifically a certificate authority is a certificate that can sign subordinate certificates using its private key and has its basic constraint policy set to true. Root certificates are certificate authorities whose issuer and subfields are the same.

Intermediate certificate authorities or intermediate signing certificates are certificate authorities that have been signed by a higher level certificate authority and whose issuer is the certificate that signed the intermediate certificate authority. As you can see, certificates can form hierarchies called chains, and in some PKI infrastructures can become very complex.

A leaf certificate is a certificate that is at the bottom of a certificate hierarchy. Using third party/commercial certificate authorities, leaf certificates are generally created using a certificate signing request (or CSR) that complies with the PKCS10 specification. CSRs are signed by the certificate authority to create the leaf certificates.

In the direct project, certificate authorities are used as anchors for trust validation and leaf certificates are used for SMIME operations.

Generation Steps

Numerous tools and commercial services are available for creating certificate chains, but they all follow the same general steps. Take for example a very simple certificate chain:

  1. Generate and self sign a root certificate authority.
  2. Generate a PKCS10 certificate signing request along with a public/private key pair for a leaf certificate.
  3. Sign the PKCS10 request using with the certificate authority. Open source tools such as openssl can be used to create your own certificate authorities and leaf certificates. Other commercial CAs such as DigiCert and IdenTrust can sign certificate requests for leaf certificate or intermediate signing certificates for a fee.

CertGen

The certificate generation processes can be cumbersome for inexperienced users or financially unfeasible for development purposes. Tools such as openssl have a vast number of options and commands for creating a PKI infrastructures, and the syntax and steps can be daunting. The CertGen application is a GUI based tool for creating a simple certificate chain for development purposes. NOTE Certificates generated by this tool technically could be used for production HISP, however they do not meet the requirements of a good certificate practice statement and don’t implement a PKI which includes attributes such as AIA extensions and links to CRLs. They may, however, be appropriate for pilot and laboratory purposes.

The following sections will walk you through creating certificate chains using the certGen tool.

To run the tool, run the following command in the /java/agent/tools directory or in the /tools directory if your are using the stock assembly package.

Windows:

certGen.bat

Unix/Linux/MAC

./certGen.sh
Creating A Chain From Scratch

The first step is creating a root certificate authority. The opening UI of the tool gives you an option of creating a new root CA or loading a CA from a pair of CA certificate and private key files.

NOTE: All files created by the tool are in DER format.

certGenOpen

To create a new root CA, select Create New CA and fill in the fields with the appropriate values.

The first six fields are used in the new CA’s distinguished name. The

Remaining fields:

After all fields are filled in, clicking the create button will generate the CA’s certificate and PKCS8 private key files. The files will either be created in the working directory or in the locations specified by the Certificate Authority File and Private Key File fields. If the CA is generated successfully, a message will be displayed indicated the successful creation.

At this point you now have the option of creating a leaf certificate by clicking the Crecte Leaf Cert button or signing a PEM encoded CSR by clicking the Sign CSR button.

createLeafOption

If you click the Sign CSR button, you are presented with a file selection dialog where you will navigate to and select a PEM encoded CSR file that you want to sign. Once selected, the tool will sign the CSR using the CA’s private key and will generate a DER encoded certificate file.

If you click the Crecte Leaf Cert button, you are presented with the dialog to create a leaf certificate. Many of the fields are pre-populated with values from the CA.

createLeafOpen

The fields in the leaf certificate are almost identical to those in the CA with a few semantic exceptions:

After filling out all fields, click the create button to generate the new leaf certificate. This will result in three new files that will be located in the tool’s working directory.

The names’ of the files are generated using the username of the email address of user level certificates or the domain name of org level certificates. For example, if a leaf certificate is generated for the email address greg@example.com, the following files are generate:

createLeafSuccess

Creating A Chain From An Existing CA

If you already have a previously created certificate authority file and its private key, you can generate leaf certificates from this CA.

To create certificates from an existing CA, select the Load CA from the tool’s opening dialog.

loadCAOpen

Next populate the Certificate Authority File and Private Key File fields with the location of the respective files. If the private key file is password protected, you must fill in the Password field with the correct password. After filling in all fields, click the Load button.

If the CA is loaded successfully, all of the fields will be populated with information from the CA. At this point you can now create leaf certificates by clicking the Crecte Leaf Cert button.