BreakFix LabsCloud security trainingPricingBlog

nShield key protection: module, softcard or OCS

Use an Operator Card Set (OCS) when custodians must be present to load a key. A service that starts on its own can use a softcard if it has a secure way to fetch the passphrase. With module protection, applications on the host can load the key without either credential.

Make the choice before you run generatekey. Entrust’s recovery utility can replace a lost or damaged card set, but it cannot turn a softcard-protected key into a card-set key.

What each protection method requires

Key files on the host contain encrypted blobs that a Hardware Security Module (HSM) in the same Security World can load. The protection method determines whether it also needs a passphrase or cards.

Module Softcard Operator Card Set
What opens the key Any in-world HSM, nothing else A passphrase for a named file-based token K of N physical smartcards, each with an optional passphrase
Split control None None (a single passphrase) Yes, through the K/N quorum
Created with nothing extra ppmk --new createocs -Q K/N
generatekey option protect=module protect=softcard softcard=<name> protect=token cardset=<name>
Stays loaded Whenever an in-world HSM is up Until its KeyID is destroyed Non-persistent: while the last card is in the reader; persistent: while the loading application stays connected
Typical fit Unattended servers in a secured environment Unattended services with a managed secret Root and issuing CA keys, release signing, anything a human should approve

Entrust’s Security Manual, v13.3 says any application on the host can load a module-protected key. Account and process isolation on that host therefore matter. A softcard adds one credential. An OCS can require more than one custodian.

F5’s BIG-IP 15.0 integration guide distinguishes the options by how they authorise use of the key. For a release-signing workflow, ask who can load the key if the build host or its secrets store is compromised.

The commands for each option

The HashiCorp Vault integration guides on nshielddocs show all three paths end to end. Creating the two token types, from the HSM install page:

createocs -m1 -s2 -N testOCS -Q 1/1
ppmk -n testSC
nfkminfo -c
nfkminfo -s

nfkminfo -c lists card sets with their K/N, time-out and flags (P or N for persistent or not, R or L for remoteable or local-only). In the guide's sample output, a 1-of-5 set shows none-NL: no time-out, not persistent, local only. Check those columns after every createocs, because persistence cannot be changed once the set exists.

Generating a key under each protection, from the Vault key creation page:

generatekey --generate --batch -m 1 pkcs11 type=AES size=256 protect=module plainname=vault_encript_key_m
generatekey --generate --batch -m 1 pkcs11 type=HMACSHA256 size=256 protect=softcard softcard=testSC plainname=vault_hmac_key_sc
generatekey --generate --batch -m 1 pkcs11 type=AES size=256 protect=token cardset=testOCS plainname=vault_encript_key_ocs

Entrust’s Vault example uses -Q 1/1 because that integration requires a quorum of one. Check the loading constraints of your own application before you choose a quorum.

For a production OCS, the full option set from the v13.4.5 card set guide is:

createocs -m <MODULE> -Q <K>/<N> -N <NAME> [-M] [-p|-P] [-R|--pp-recovery] [-q] [-T <TIME>] [-e]

-p makes the set persistent (-P explicitly not), -R is --no-pp-recovery, -T sets a time-out with s, m, h or d suffixes (0 means never), and -q makes the cards remotely readable. For a softcard, decide recoverability at creation: ppmk --new --recoverable <NAME> or ppmk --new --non-recoverable <NAME>.

Sizing an OCS quorum

The Security Manual recommends K relatively large and N less than 2K, giving 3-of-5 and 5-of-9 as examples. N < 2K means no two disjoint groups of custodians can each reach quorum, so a single faction cannot act behind the other's back.

For a root Certificate Authority (CA), 3-of-5 requires three custodians and leaves room for two to be unavailable. If the requirement is two-person control, 2-of-3 can work with a smaller roster. If the service has to restart without custodians, check whether its policy permits a softcard and whether the secrets manager can audit access to the passphrase.

The manual recommends one OCS per application so a compromised card set exposes fewer keys. Give nShield Connect front-panel login a separate card set.

Persistent, non-persistent and time-outs

A non-persistent OCS is the default. Remove the last required card and the keys are unloaded from HSM memory. For a root CA signing session, plan for a custodian to keep that card in the reader until signing is complete.

A persistent OCS (-p) keeps keys loaded for as long as the loading application stays connected, unless a usage limit or time-out applies. The manual advises persistent mode only after a threat analysis shows it is safe, and pairs "persistent with no time-out" with a web server, noting that security then depends on the application. A time-out works independently of persistence; on expiry the keys are forcibly unloaded and the set cannot be loaded again until a card is removed and reinserted.

The Vault install guide also describes the preload utility, which loads a card set so it stays available after the card is removed. The preload utility page documents preload -c <IDENT> for card sets and preload -s <IDENT> for softcards, with pause, exit or a subprocess command. Preloaded object IDs are written to a preload file whose default location is /tmp on Linux. Move it with -f to a directory only the service account can read; the page does not flag the default as a risk, but the file tells any local process which loaded objects to use.

What happens after an unattended restart

Restart behaviour usually settles the choice. The clearest primary source is a table in Entrust's Oracle TDE (WSOP) integration appendix. Summarised:

Security World Module Softcard OCS
FIPS 140 Level 2 Recovers automatically Recovers automatically Needs a 1/N set with the same passphrase on every card and a card left in the slot
FIPS 140 Level 3 Needs an OCS card left in the slot for FIPS authorisation Same as module Card left in the slot, used for both credential and FIPS authorisation

In the Level 3 configuration described by Entrust, leave an authorisation card in each HSM reader that must recover automatically. When a card set is used only for FIPS authorisation, the quorum defaults to 1/N and the passphrase is ignored. The appendix also says persistent authorisation is lost after a temporary failure and advises against using Remote Administration channels for automatic recovery.

In the Level 2 softcard case, test whether the service can fetch its passphrase after a cold start. If the secrets manager depends on the same service starting first, work out which component can come up independently.

Recovery and replacement are fixed at creation

Whether a lost OCS or softcard can be replaced depends on choices made when the Security World was created. The Security Manual is explicit: if key recovery is disabled at world creation, lost or damaged card sets cannot be replaced and their keys become inaccessible, and recovery cannot be switched on later without reinitialising the world and discarding existing keys.

When recovery is enabled, the rocs utility re-protects keys under a new token, authorised by the Administrator Card Set (ACS). The replacement procedure gives the command line:

rocs -m <MODULE> -t <TARGET-CARDSET> -k <KEYS> [-c <CARDSET>] [-i]

The same page states that OCS-protected keys can be recovered only to another OCS and softcard-protected keys only to another softcard. The target's K/N does not have to match, so you can raise a 1-of-2 set to 3-of-5 later. You cannot turn a softcard key into a card-set key. If a key's risk changes, plan for a new key and the re-issuance that goes with it.

Failure modes to check for

Illustrative scenario: a team protects a code-signing key with a softcard, then stores the passphrase in the build pipeline's plain-text variables so the release job can call preload -s. Anyone who can read the job definition and reach an in-world HSM can now sign as the company, even though the softcard itself worked as designed.

  1. A softcard stays valid for loading its keys until the associated KeyID is destroyed. Destroy KeyIDs when the job is finished instead of leaving them for the life of the host.
  2. Several softcards with the same name or passphrase widen the attack surface, per the Security Manual. ppmk --force exists to create a duplicate name; avoid it.
  3. Softcards are not supported with the nCipherKM JCA/JCE provider in FIPS 140 Level 3 worlds. Check this before you design a Java service around one.
  4. PKCS#11 applications need CKNFAST_LOADSHARING set to a nonzero value to use softcards; preloaded softcards set it to 1 unless you explicitly set 0.
  5. Passphrases for createocs, cardpp and ppmk are limited to 254 characters, and the user guide recommends 7-bit ASCII only. Generated passphrases from a secrets manager should be constrained to match.
  6. OCS cards cannot be duplicated once written, so create spares at the ceremony.
  7. If any ACS card is lost, the manual says to replace the whole ACS as soon as possible, because losing the ACS quorum leaves the world unmanageable.

Practising the three options

The Distributed HSM Operations course simulates an Entrust nShield Security World. Its "Card sets & protected keys" chapter has you create a 2-of-3 OCS, bind an RSA key to it, load the quorum and sign; the next chapter, "Softcard-protected keys for automation", has you create a softcard with ppmk -n, generate a softcard-protected key, present the passphrase and sign. The signatures use real browser cryptography (WebCrypto), but the console is a training simulator, not nShield software, so confirm command syntax against the Entrust documentation for your release.

BreakFix Labs is independent and is not affiliated with, endorsed by, or sponsored by Entrust, HashiCorp, Oracle or F5. Entrust and nShield are trademarks of Entrust Corporation and/or its affiliates. HashiCorp and Vault are trademarks of HashiCorp, Inc. Oracle is a trademark of Oracle and/or its affiliates. F5 and BIG-IP are trademarks of F5, Inc.

Questions and answers

What is the difference between an nShield softcard and an Operator Card Set?

An Operator Card Set (OCS) is a set of physical smartcards with a K-of-N quorum, so several custodians can be required to load a key. A softcard is a file-based logical token unlocked by a single passphrase. Entrust describes it as functioning as a persistent 1/1 token, so it suits automation but gives no split control.

Which nShield protection method lets a key come back after an unattended restart?

Module-protected and softcard-protected keys recover automatically in a FIPS 140 Level 2 Security World, per Entrust's Oracle TDE integration guide. An OCS-protected key needs a card left in the reader with a 1/N quorum, and a FIPS 140 Level 3 world needs an OCS card in the slot for FIPS authorisation whichever protection the key uses.

Can I move a key from softcard protection to an Operator Card Set later?

Not with rocs. Entrust's replacement procedure recovers OCS-protected keys only to another OCS and softcard-protected keys only to another softcard, so the protection type is effectively fixed when the key is generated.

Sources

  1. Entrust nShield Security Manual v13.3: access control
  2. Entrust nShield 5s User Guide v13.4.5: managing card sets and softcards
  3. Entrust nShield 5s User Guide v13.4.5: preload utility
  4. Entrust nShield Security World administration: replace OCS and softcards
  5. Entrust nShield and Oracle TDE (WSOP) integration guide: appendix
  6. Entrust nShield and HashiCorp Vault Enterprise: install and configure the HSM
  7. Entrust nShield and HashiCorp Vault Enterprise: create the Vault encryption and HMAC keys
  8. F5 BIG-IP 15.0 and nShield HSM implementation: managing external HSM keys for LTM

Related courses

  • Distributed HSM Operations: Operate an Entrust nShield Security World in a simulator: ACS and OCS quorums, softcards, protected keys and recovery. About 2.5 hours, in your browser.