Wednesday, October 9, 2019

PGP Signing with SignServer


This blog post covers PGP signing support implemented in recent versions of SignServer

In a previous blog post, we addressed Code Signing of Windows binaries (Authenticode) and gave some background on why Code Signing is important for secure software distribution.

We are now pleased to introduce code signing with PGP, commonly used for Open Source software projects and packaging of software for Linux environments in general.

OpenPGP Signing was first implemented in SignServer Enterprise 5.1 and will be available in SignServer Community 5.2, already available for download as a beta release.

SignServer Installation

To test the PGP support, download and install SignServer Enterprise 5.1 or SignServer Community 5.2.0.Beta1 or later.

For installation instructions, refer to SignServer Installation.

Setting up an OpenPGP Signer

When SignServer is up and running, access the SignServer Administration Web to start setting up the workers.

The Administration Web is available in SignServer Community as if 5.2.0.Beta1.

Step 1: Set up Crypto Worker

If you don’t already have a crypto worker configured, then set one up using, for example, the sample keystore:
  1. Select the AdminWeb Workers tab, and click Add.
  2. Click From Template, select keystore-crypto.properties in the list, and click Next.
  3. In the configuration text view, change the value for WORKERGENID1.KEYSTOREPATH so that the path corresponds to your SignServer installation, for example: WORKERGENID1.KEYSTOREPATH=/home/username/signserver/res/test/dss10/dss10_keystore.p12. 
  4. Click Apply.
Remember the name of the crypto worker (for example, CryptoTokenP12) as you will need it in the next step when setting up the OpenPGP Signer.

Step 2: Set up OpenPGP Signer

To set up the new OpenPGP signer, do the following:
  1.  Select the SignServer AdminWeb Workers tab, and click Add to add a new worker.
  2. Choose the method From Template.
  3. Select openpgpsigner.properties in the Load from Template list and click Next.
  4. Change the sample configuration properties as needed, for example:
    • Update the CRYPTOTOKEN property with the name of your crypto worker (for example, CryptoTokenP12).
    • Update DEFAULTKEY to an existing key (or do this in a later step).
  1. Click Apply to load the configuration and list the worker in the All Workers list.
  2. Select the added worker in the list to open the Worker page.
  3. Check if the Worker status is Offline and if there are any errors listed. The "No key available for purpose" message means that the DEFAULTKEY property does not point to an existing key in the crypto token. In that case, either update the DEFAULTKEY property to point to an existing key or do the following to generate a new key to use with this signer:
    • Click Renew key and specify the following:
      • Set a Key Algorithm, for example "RSA".
      • Set a Key Specification, for example the key length "2048" (for RSA).
      • Update the New Key Alias to the name of DEFAULTKEY property (typically change to the same value as the Old Key Alias).
    • Click Generate.
    • Select the worker in the list and confirm that the Worker status is Active and without errors listed. If not, confirm that the DEFAULTKEY property is correct and check in the Crypto Token tab of the crypto worker that a key with the specified name exists.

Step 3: Add User ID to Public Key

Follow the steps below to add User ID / Certification for the OpenPGP public key using the Generate CSR option.
  1. Select the AdminWeb Workers tab.
  2. Select the OpenPGP worker and click Generate CSR.
  3. Specify a Signature Algorithm, for example "SHA256withRSA"
  4. Specify DN as the wanted User Id, for example "Markus (Code Signing) <markus@primekey.se>".
  5. Click Generate, and then click Download.
  6. Open the downloaded file using any text editor and copy its content.
  7. Select the worker and click the Configuration tab.
  8. For the PGPPUBLICKEY property, click Edit.
  9. Paste the public key content in the Value field, and click Submit.
  10. Click Status Summary and confirm that fields like PGP Key ID and PGP Public key are listed. Also, note that the User ID is listed. 

Step 4: Sign

The following example shows how to sign using the SignServer Public Web. You can test signing using any of the SignServer client interfaces.
  1. Click Client Web.
  2. Under File Upload, specify the Worker name used, for example, OpenPGPSigner.
  3. Select the file to create a detached signature for, for example, release.zip.
  4. Click Submit and store the resulting signature file, for example, release.zip.asc.

Step 5: Verify Signature

The following example shows how to verify the signature using the OpenPGP tool GnuPG. It should be possible to use any OpenPGP tool to verify the signature.

Run the following to verify the signature using GnuPG:
$ gpg --verify release.zip.asc release.zip

If needed, first import the public key to GnuPG before verifying the signature in the third step:
  1. Store the public key (i.e. from PGPPUBLICKEY property) as signer001-pub.asc.
  2. Import the key to GnuPG:
    $ gpg --import signer001-pub.asc

More Information

See also the OpenPGP Signer documentation and if you have any questions or comments don't hesitate to use our discussion forums.

Cheers,
the PrimeKey SignServer Team


No comments: