Craton HSM

Security Policy

Security Policy

This page states the formal security policy enforced by Craton HSM. It is the reference operators should consult when asking "who is allowed to do what, and under what conditions." The policy is enforced by code; this page describes the enforcement rather than defining aspirational rules.

Longer-form material — design rationale, CSP inventory, lifecycle mechanics — lives in the security-policy.md document inside the core repository. This page is the product-facing subset.

Roles

RolePKCS#11 typePurpose
Security Officer (SO)CKU_SOToken initialisation, user PIN management, reinitialisation
UserCKU_USERAll cryptographic operations; object creation and management
Unauthenticated(no login)Read public objects, compute digests, request random bytes

Role membership is scoped to the session. Logging out (C_Logout) or closing the session discards the authenticated state.

Allowed Operations Per Role

Operations marked "R/W" require a read-write session (CKF_RW_SESSION at C_OpenSession time).

Token and PIN management

OperationSOUserUnauthenticated
C_InitTokenYes (R/W)NoNo
C_InitPIN (set user PIN)Yes (R/W)NoNo
C_SetPIN (change own PIN)YesYesNo
C_LoginYesYesNo
C_LogoutYesYesNo

Key management

OperationSOUserUnauthenticated
C_GenerateKey (symmetric)NoYesNo
C_GenerateKeyPairNoYesNo
C_CreateObjectR/W (public only)R/WNo
C_CopyObjectR/WR/WNo
C_DestroyObjectR/WR/W (own objects)No
C_WrapKeyNoYesNo
C_UnwrapKeyNoYesNo
C_DeriveKeyNoYesNo
C_SetAttributeValueR/WR/WNo

Cryptographic operations

OperationSOUserUnauthenticated
C_Sign / C_SignUpdate / C_SignFinalNoYesNo
C_Verify / C_VerifyUpdate / C_VerifyFinalNoYesNo
C_Encrypt / C_EncryptUpdate / C_EncryptFinalNoYesNo
C_Decrypt / C_DecryptUpdate / C_DecryptFinalNoYesNo
C_Digest and multi-part digestYesYesYes
C_GenerateRandomYesYesYes

Object visibility

OperationSOUserUnauthenticated
C_GetAttributeValue — public objectsYesYesYes
C_GetAttributeValue — private objects (CKA_PRIVATE=true)NoYesNo
C_FindObjects — public objectsYesYesYes
C_FindObjects — private objectsNoYesNo
C_GetAttributeValue(CKA_VALUE) on sensitive keyReturns CKR_ATTRIBUTE_SENSITIVEReturns CKR_ATTRIBUTE_SENSITIVE unless CKA_SENSITIVE=false and CKA_EXTRACTABLE=trueNo

Key Attribute Enforcement

Generated keys default to maximum protection:

AttributeDefaultEffect when true
CKA_PRIVATEtrueObject is invisible to unauthenticated sessions
CKA_SENSITIVEtrueCKA_VALUE cannot be read back
CKA_EXTRACTABLEfalseKey material cannot be exported or wrapped out
CKA_TOKENfalseSession object by default; true requires a read-write session
CKA_MODIFIABLEtrue for most, but attribute changes that weaken protection are rejected

CKA_SENSITIVE is monotonic — it can transition from false to true but not back. CKA_EXTRACTABLE is monotonic in the other direction — it can transition from true to false but not back. Attempts to weaken protection via C_SetAttributeValue return CKR_ATTRIBUTE_READ_ONLY.

Lifecycle Attributes

Keys may carry CKA_START_DATE and CKA_END_DATE. The effective state is computed on every operation:

StateConditionPermitted operations
Pre-activationCurrent date < CKA_START_DATENone
ActiveNo dates set, or within the rangeAll operations permitted by key usage attributes
DeactivatedCurrent date > CKA_END_DATEVerify, decrypt, unwrap only
CompromisedManually setNone
DestroyedAfter C_DestroyObjectHandle is invalid

Usage flags (CKA_SIGN, CKA_VERIFY, CKA_ENCRYPT, CKA_DECRYPT, CKA_WRAP, CKA_UNWRAP, CKA_DERIVE) further restrict what an active key can do. A signing request against a key without CKA_SIGN=true returns CKR_KEY_FUNCTION_NOT_PERMITTED.

PIN Policy

Length and Character Set

SettingDefaultNotes
security.pin_min_length4 bytesFIPS deployments should set this to at least 8
security.pin_max_length64 bytesUpper bound on PIN input
Character setAny bytesThe module does not enforce a character class; application guidance should recommend printable ASCII with mixed case, digits, and symbols

Hashing and Comparison

  • PBKDF2-HMAC-SHA256 with 600,000 iterations (configurable only upward).
  • 32-byte per-PIN random salt from the OS CSPRNG.
  • Constant-time comparison via subtle::ConstantTimeEq.
  • The plaintext PIN is wiped from memory after verification.

Default PINs

C_InitToken establishes an initial SO PIN. Deployments must change it during initial provisioning; the default "12345678" is a bootstrap value only and is not suitable for production use.

Lockout

ScopeDefaultBehaviour
SO PIN failures10On threshold, C_Login returns CKR_PIN_LOCKED. Recovery requires token reinitialisation.
User PIN failures10On threshold, C_Login returns CKR_PIN_LOCKED. SO may reset the user PIN via C_InitPIN.

Failed-attempt counters persist across process restarts. A successful login resets the counter.

Mechanism Policy

The module has two mechanism policies, selected by algorithms.fips_approved_only:

ModeBehaviour
Non-FIPS (default)All 41 mechanisms available. The fips_approved flag in the audit log indicates which operations used approved algorithms.
FIPS approved-onlyOnly approved mechanisms are available; non-approved mechanisms return CKR_MECHANISM_INVALID at *Init or generation time, and C_GetMechanismList returns only the approved subset.

Always-enforced restrictions (independent of FIPS mode):

RuleEffect
allow_weak_rsa = false (default)RSA key generation and import below 2048 bits is rejected
allow_sha1_signing = false (default)SHA-1 combined signing mechanisms are rejected; SHA-1 digest-only remains available
AES-CBC / AES-CTR with all-zero IVRejected at C_EncryptInit
AES-GCM nonce reuse per keyTracked via a per-key counter; approaching the 2^31 soft limit emits warnings; attempted reuse fails

Session Policy

  • A session cannot outlive the process that opened it. There is no session persistence across C_Finalize or process exit.
  • C_CloseAllSessions on a slot terminates every session and discards all in-flight operations.
  • A forked child receives CKR_CRYPTOKI_NOT_INITIALIZED for every call until it calls C_Initialize itself. See fork-safety.
  • Only one process may hold the persistent database open at a time; concurrent access must go through the gRPC daemon.

Audit Policy

Every operation in the following set produces an audit entry, written synchronously before the PKCS#11 call returns:

Initialize, Finalize, Login, Logout, InitToken, InitPIN, SetPIN, GenerateKey, GenerateKeyPair, Sign, Verify, Encrypt, Decrypt, WrapKey, UnwrapKey, DeriveKey, Digest (when over non-public data), CreateObject, DestroyObject, GenerateRandom.

The log is append-only with chained SHA-256 hashes. See audit-scope.

Further Reading