2. Token and keyconfiguration

OpenCA has a concept which abstracts every key. Every key is a token and be putted into a slot. This mean that the software can ask the cryptolayer for a token ca and the cryptolayer checks it's configuration for a token called ca.

Figure 4.3. Tokenconcept

Here you can see a schemtaic overview about the concept
                        of the tokens.
Now we will explain the token configuration because this is the most interesting thing for an administrator. The basic schema is the following one:
<openca>
    <token_config>
        <default_token>CA</default_token>
        <token>...</token>
        ...
    </token_config>
</openca>
        
Every token configuration includes some common parts which will be described here. The names of the options are tag names!
name

which will be used by the software for the token. There are four names today - CA, BP (batch processors), KEYBACKUP and LOG.

type

This defines the type of the token. Today there are three types (OpenSSL, Empty and LunaCA3) but we can add modules for every token you need if the token is supported by OpenSSL. We add a module per token to be able to handle the different details and proprietary tools to manage the tokens.

mode

The mode describes how the token should be used. OpenCA knows three modes standby, session and daemon. standby means that you must login to the token for every action, session activates the token for the whole user session and daemon runs the token in a daemon mode which means that the token must be stopped explicitly. Please read the docs about the different token types because not every token supports every mode.

login_sheet

If the token login requires a password which the user have to enter at the webpage then you should specify a sheet where the user can do it. Usually there are prepared sheets already installed at OPENCADIR/lib/servers/server_name/sheets/token_login.html. So you have only to specify the default sheet.

We will describe now the configuration of different token types.

2.1. OpenSSL

OpenSSL only support the operational mode standby. Additionaly it support several other dynamic options which are required to work properly.
SHELL

This is the path to binary of OpenSSL. It is called SHELL because it is the cryptoshell which we use. Simply run the binary without any options and you know what we mean.

KEY

filename of the file with the private key

PASSWD_PARTS

the number of the components of the passphrase. If you have two groups of administrators and every group has only one part of the passphrase then you can enter 2 and OpenCA will display two seperate input fields for the different parts.

PEM_CERT

path to the PEM formatted certificate

DER_CERT

path to the DER formatted certificate

TXT_CERT

path to the TXT formatted certificate - this is only important for the CA token.

CHAIN

directory which includes the certification path - this is not only important for the CA because the chain is sometimes included into signatures.

2.2. Empty

This token is only a dummy if the key is not a really seperate key. Often the administrators simply use symlinks to the CA keys and certs for the keybackup etc.. An empty token is redirect to the default token which is usually the CA token.

2.3. LunaCA3

This token accepts all the options like OpenSSL tokens except of PASSWD_PARTS because Chrysalis-ITS Luna CA3 uses hardware (PIN pad) for login to prevent electronic reconnaisance actions. Luna CA3 supports all operational modes (standby, session and daemon. This module requires some additional options:
UTILITY

Luna CA3 comes with a utility to manage things like login and keygeneration. You have to enter the complete path here.

SLOT

This is an ID for the slot of the token.

APPID

This is the application ID to avoid conflicts with other application. Please remeber that the APPID must be lesser than the SLOT.

LOCK_FILE

OpenCA uses this file to detect that the token is already activated if the token runs in daemon mode. There is no way to find out this fact directly via a tool from Chrysalis-ITS.

2.4. nCipher

2.4.1. Introduction

This module provides very rudimentary support for nCipher HSM tokens and was tested with an nCipher nShield F2 PCI module (nC1002P/nC3022P).

The current status should be seen as experimental.

Current limitations:
  • There is currently no way to determine if the private key is usable (online). If a private key operation is requested with the key offline, the application will receive an error (i. e. resulting in an ugly error message in OpenCA).

  • Key generation is not supported

  • PIN entry is not supported

TODO:
  • add check if the key is online (No stock CLI tool available for this, will require custom programming. idea/hack: perform a dummy operation with the private key and check if it is possible to use the key, but this really sucks)

2.4.2. Implementation

The module was derived from OpenCA::Token::OpenSSL and other existing token implementations. The genKey() is disabled and returns the error code 7154001.

2.4.3. Usage

The module requires a properly set up nCipher "Security World" including a private key to operate. Key generation is not supported by the module (as it really does not make much sense for a HSM based CA).

See Section 2.4.5, “Example for the setup” for an example.

In order to use the HSM protected key, log in into the CA computer and run /opt/nfast/bin/with-nfast pause in a shell.

You will be prompted to insert as many Operator Cards and input their corresponding PINs as required by the Operator Card Set Quorum.

As long as 'with-nfast' is not interrupted and the last Operator Card is not removed, any application with the proper Unix permissions may use the keys protected by the Operator Card Set.

To log out from the module it is recommended to terminate the with-nfast program (pulling the SmartCard works, too, but is not recommended, because it leaves the program waiting).

2.4.4. OpenCA Configuration

The key name should be the same as reported by /opt/nfast/bin/nfkminfo -k.

2.4.5. Example for the setup

Example for creation of a Security World, Operator Cards and CA key.

Assumptions:
  • example uses a 2 of 3 quorum ("2/3") for Adminstrator Cards and Operator Cards

  • the Operator Card set protecting the CA key will be named "RootCA"

  • the CA key will be named "rootkey" in this process

Sample Root Key ceremony:
  1. initialize security world
    • switch HSM to 'initialize' mode

    • reset the module: /opt/nfast/bin/nopclearfail -c -m 1

    • /opt/nfast/bin/newworld --initialize --acs-quorum 2/3

    • switch HSM to 'operational' mode

    • reset the module: /opt/nfast/bin/nopclearfail -c -m 1

  2. verify that the security world has been created
    • /opt/nfast/bin/nfkminfo

  3. optionally: erase cards
    • /opt/nfast/bin/bulkerase -m 1 -s 0

  4. initialize Root CA operator card set
    • /opt/nfast/bin/createocs --name=RootCA --ocs-quorum=2/3 -m 1 -s 0

  5. verify that the operator card set has been created
    • /opt/nfast/bin/nfkminfo -c

  6. create Root CA key
    • /opt/nfast/bin/generatekey2 --cardset=RootCA hwcrhk (example values: token, 0, RootCA, yes, RSA, 2048, 0, "", rootkey, no)

  7. verify that the root key has been created
    • /opt/nfast/bin/nfkminfo -k

2.5. OpenSC

This token accepts all the options like OpenSSL tokens but soem options has another meaning. The token only operates in mode standby. Other modes are not supported by OpenSC today. The available options have the following meanings (please notice that we only report OpenSSL options if there meaning differ from the original OpenSSL module):
KEY

The KEY is a combination of the slot and the ID of the key on the card. This can differ for other PKCS#11 modules than OpenSC. If you use this class with another PKCS#11 than the one from OpenSC then please read the docs of the vendor. The syntax is slot_[0-9]+-id_[0-9]+. A typical example is slot_0-id_45.

ENGINE

The value should be always dynamic here. This defines that the OpenSSL dynamic engine should be used. The module is only tested with this module.

PRE_ENGINE

These options are used to configure the PKCS#11 engine which is loaded to OpenSSL. SO_PATH is the path of the used OpenSSL engine. ID is the used OpenSSL engine ID. MODULE_PATH is the path to the used PKCS#11 driver. Please notice that we put the complete and partially internal configuration into this parameter. The reason is that we don't want to reduce the flexibility because we don't know the future direction of the OpenSSL engine interface and the OpenSC PKCS#11 engine for OpenSSL.

CARDDRIVER

This is the name of the OpenSC carddriver. This option is only necessary if you want to create the key with OpenCA.

CARDREADER

This is the number of the OpenSC carddriver. This option is only necessary if you want to create the key with OpenCA. (It is identical with the slotnumber.)

PKCS15_INIT

The path to the command pkcs15-init.

PKCS15_TOOL

The path to the command pkcs15-tool.

OPENSC_TOOL

The path to the command opensc-tool.