C H A P T E R  4

Financial Services


Note - The financial services features described in this chapter are supported for the Oracle Solaris OS on both SPARC and x86 platforms. These features are not currently supported for the Linux OS.


The Sun Crypto Accelerator 6000 Board supports PIN and credit card related functionality, ensuring the security of sensitive customer data by performing the entire operation within the secure cryptographic boundary of the board. Specialized key management capabilities and a new user library (libfinsvcs.so) and associated application interfaces are provided to support this feature. Data types referenced in this chapter are defined in the /opt/SUNWsca/include/finsvcs.h header file, which is included in Appendix F.

This chapter describes the application programming interface (API) to enable developers to use this new functionality. Basic familiarity with PIN and credit card processing and the associated standards is assumed. Sections include:


Financial Service Components Overview

The new financial service library uses the underlying PKCS#11 infrastructure to tunnel complex commands to the board resident firmware. Financial applications are not required to interpret the PKCS#11 interface, however, because this interprettation is handled by the financial services library. A high level overview of the financial services components is depicted in FIGURE 4-1:

FIGURE 4-1 Financial Services High Level Architecture


There are three core components that comprise the board financial services functionality:

These core components are described in the following sections.


Enabling the Financial Services Feature

The financial services functionality is currently disabled by default due to an issue in the Oracle Solaris Cryptographic Framework. Enabling financial services in a redundant hardware configuration might cause errors under heavy loads due to this issue. In a single card configuration, these errors do not occur.


procedure icon  Enable Financial Services

single-step bullet  Make the following change in the /kernel/drv/mca.conf file:


enable-finsvcs=1;


Financial Services Library Initialization

This section describes the functions used to initialize the financial services library.

Library Open Function fs_lib_open()

Financial services applications must issue the fs_lib_open() function to initialize the financial services library. This function locates the desired PKCS#11 provider and verifies that it supports the financial services mechanism. The fs_lib_open() function returns a handle that must be used in subsequent financial services library calls.

The syntax for the fs_lib_open() function is as follows:


fsLibHandle_t fs_lib_open(char *tokenName, fsReturn_t *err)

TABLE 4-1 lists the parameters for the fs_lib_open() function.


TABLE 4-1 fs_lib_open() Function Parameters

Parameter

Description

tokenName

Name of the desired token

err

Error value


TABLE 4-2 lists the return values for the fs_lib_open() function.


TABLE 4-2 fs_lib_open() Function Return Values

Return Value

Description

fsOK

Successfully initialized, desired token found, and support for financial services verified

fsNotFound

Token not found

NULL

Error occured

Non-NULL

Valid library handle returned when successfully initialized

err

err is set as follows:

  • fsOK - Successfully initialized, the desired token found, and support for financial services verified
  • fsNotFound - Token not found
  • fsError - Unable to initialize libary

Library Shutdown Function fs_lib_close()

Applications can close the financial services library services when the services are no longer required.

The syntax for the fs_lib_close() function is as follows:


fsReturn_t fs_lib_close(fsLibHandle_t handle)

TABLE 4-3 lists the parameters for the fs_lib_close() function.


TABLE 4-3 fs_lib_close() Function Parameters

Parameter

Description

handle

Financial services library handle returned from the fs_lib_open function


TABLE 4-4 lists the return values for the fs_lib_close() function.


TABLE 4-4 fs_lib_close() Function Return Values

Return Value

Description

fsOK

Successfully closed the financial services library

fsInvalidHandle

Library handle invalid


Session Establishment Function fs_session_open()

Users can establish multiple financial services sessions, thus allowing multithreaded access to the financial services capabilities. Sessions can be created only after you have initialized the financial services library with the fs_lib_open() function. A unique session handle is returned and must then be used for all financial service requests for that specific session.

The syntax for the fs_session_open() function is as follows:


fsSessHandle_t fs_session_open(fsLibHandle_t handle)

TABLE 4-5 lists the parameters for the fs_session_open() function.


TABLE 4-5 fs_session_open() Function Parameters

Parameter

Description

handle

Library handle obtained from the fs_lib_open() function


TABLE 4-6 lists the return values for the fs_session_open() function.


TABLE 4-6 fs_session_open() Function Return Values

Return Value

Description

Non-NULL

Session handle upon success

NULL

On error


Session Shutdown Function fs_session_close()

Once a user has completed financial operations, they can dissolve the session by issuing the fs_session_close() function. The session handle obtained from the fs_session_open() function must be used with this function.

The syntax for the fs_session_close() function is as follows:


fsReturn_t fs_session_close(fsSessHandle_t handle)

TABLE 4-7 lists the parameters for the fs_session_close() function.


TABLE 4-7 fs_session_close() Function Parameters

Parameter

Description

handle

Session handle from previous fs_session_open() function


TABLE 4-8 lists the return values for the fs_session_close() function.


TABLE 4-8 fs_session_close() Function Return Values

Return Value

Description

fsOK

Session closed successfully

fsInvalidHandle

Session handle invalid



Financial Services Data Types

The financial services API requires the use of new data types defined in the finsvcs.h header file. Appendix F provides the finsvcs.h header file.


Key Management Overview

To meet the strict key management requirements of financial institutions, the board adheres to the following essential financial key management principles.

Key Separation and Compartmentalization of Risk

Keys must be used for specifically defined functions only. This requirement limits potential damage from a key compromise. To meet this requirement, functional key type information is associated with each financial key. The board allows generating and importing the types of keys defined in the following list and enforces that they are used for specific operations only.

The following types of financial keys are supported:

The board is a dedicated hardware security module (HSM). The MFK never leaves the secure HSM and encrypts other operational keys when they leave the HSM. An MFK can be used only on the encrypting HSM. MFKs are entered into the board in component form with the direct input device.

Encrypts other keys for key exchange operations. The KEKs are entered into the board in component form with the direct input device.

Encrypts PINs. There are two types of supported PEKs:

Verifies PIN operations.

Verifies card operations.

Allowed Key Forms

The following key form requirements are enforced by the board.

Direct Key Loading

For security, the MFK and KEKs are entered directly into the board with the direct input device connected to the board’s serial port. These keys are entered in component form by unique security officers. This extra security step is required to meet the following key management requirements:

Loading the MFK

The MFK is loaded with the direct input device. The MFK is entered as a series of key components that are combined to create the MFK. Each component is entered by a different security officer, preventing any single user from knowing the MFK. The MFK is the only financial services key maintained in the board. This key never leaves the board.

The command syntax for loading the MFK is as follows:


sca6000, so}> load mfk

Enabling the MFK

Once the MFK components are loaded, the MFK must be enabled with the direct input device by a valid security officer.

The command syntax for enabling the MFK is as follows:


sca6000, so}> enable mfk

Loading the KEKs

The KEKs are also entered with the the direct input device. However, unlike the MFK, these keys are extracted from the board by financial applications. The extracted keys are encrypted with the MFK. The KEKs are never in the clear. Similar to the MFK, KEKs are entered in component form preventing any single individual from knowing the actual KEK. A label must also be entered with the direct input device and is used programmatically by an application to retrieve the desired KEK.

The command syntax for loading the KEKs is as follows:


sca6000, so}> load kek

Change the MFK

Financial applications require their keys be encrypted using the MFK, thus changing the MFK is a complex process. After entering the new MFK, the applications must request that all of their keys be reencrypted using the new MFK with the fs_translate_key() function. The board must maintain the old MFK until this process is complete. Once this process is complete, a security officer can use the new MFK by typing the enable mfk command.


Key Management Functions

Financial applications require key management related functionality from the HSM. The following basic capabilities are required:

Generate Key Function fs_generate_key()

Applications generate different types of financial keys. DES keys are primarily used for these functions. Along with the key type, key usage information is required to limit when the key can be used. The following types of key uses are supported:

Once generated these keys are encrypted by the MFK and returned in the user provided buffer upon success.

The syntax for the fs_generate_key() function is as follows:


fsReturn_t fs_generate_key(fsSessHandle_t handle, fsKeyType_t type, fsKeyUsage_t usage, fsKey_t *key)

TABLE 4-9 lists the parameters for the fs_generate_key() function.


TABLE 4-9 fs_generate_key() Function Parameters

Parameters

Description

handle

Session handle returned by fs_session_open()

type

Key algorithm type: DES, DES2, DES3

usage

Intended financial key usage

key

Buffer for the generated key, encrypted with the MFK or a derivative


TABLE 4-10 lists the return values for the fs_generate_key() function.


TABLE 4-10 fs_generate_key() Function Return Values

Return Value

Description

fsOK

Key generated

fsInvalidKeyType

Invalid key type specified

fsBufferTooSmall

Provided buffer is too small for the key

fsInvalidState

Device not in proper state to handle command


Import Key Function fs_import_key()

To interoperate with peer nodes, the board must be able to import keys from these peers. Applications can import existing keys from peer nodes with the import function.

The syntax for the fs_import_key() function is as follows:


fsReturn_t fs_import_key(fsSessHandle _t handle, fsKeyUsage_t usage,  fsKey_t *KEK, fsKey917_t *iKey, fsKey_t *oKey, BOOLEAN useVariants)

TABLE 4-11 lists the parameters for the fs_import_key() function.


TABLE 4-11 fs_import_key() Function Parameters

Parameters

Description

handle

Session handle returned by the fs_session_open() function

usage

Type of intended key usage: TPK, ZWK, PEK, CVK, and so on

kek

KEK key shared with the peer node with which the im ported key was encrypted

ikey

Imported key - this is an ANSI X9.17 formatted key

oKey

Key returned and translated by the MFK

usevariants

True if the imported key is an Atalla variant


TABLE 4-12 lists the return values for the fs_import_key() function.


TABLE 4-12 fs_import_key() Function Return Values

Return Value

Description

fsOK

The oKey is filled in for this case if the key is successfully imported

fsInvalidKeyType

Invalid import key type

fsInvalidKeyUsage

Unsupported key usage type

fsInvalidKEK

Invalid KEK

fsInvalidKey

Import key is invalid

fsInvalidState

Device is not in proper state to handle command

fsError

Processing error


Export Key Function fs_export_key()

The board must allow users to move keys from one device to another. Additionally, the peer device might not be a board. The export key function enables this feature and allows users to export keys from the board. How the exported keys are transported to the peer is determined by the application developer.

The syntax for the fs_export_key() function is as follows:


fsReturn_t fs_export_key(fsSessHandle_t handle, fsKeyUsage_t usage, fsKey_t *KEK, fsKey_t *iKey, fsKey917_t *oKey, boolean_t useVariants);

TABLE 4-13 lists the parameters for the fs_export_key() function.


TABLE 4-13 fs_export_key() Function Parameters

Parameter

Description

handle

Session handle returned by the fs_session_open() function

usage

Type of intended key usage: TPK, ZWK, PEK, CVK, and so on

KEK

Key shared with the peer node with which the exported key is encrypted

iKey

Input key encrypted with the MFK

oKey

Exported key in ANSI 9.17 format

useVariants

True if the exported key is an Atalla variant


TABLE 4-14 lists the return values for the fs_export_key() function.


TABLE 4-14 fs_export_key() Function Return Values

Return Value

Description

fsOK

The oKey is filled in for this case if key successfully exported

fsInvalidKeyType

Export key type invalid

fsInvalidKeyUsage

Key usage type invalid

fsInvalidKey

Key for export invalid

fsInvalidKEK

Encryption key invalid

fsInvalidState

Device is not in proper state to handle command

fsError

Processing error


Translate Key Function fs_translate_key()

When the MFK is updated, users must convert all of their keys using the new MFK.

The syntax for the fs_translate_key() function is as follows:


fs_return_t fs_translate_key(fsSessHandle_t handle, fsKey_t *iKey, fsKey_t *oKey)

TABLE 4-15 lists the parameters for the fs_translate_key() function.


TABLE 4-15 fs_translate_key() Function Parameters

Parameter

Description

handle

Session handle returned by the fs_session_open() function

iKey

Input key encrypted with the old MFK

oKey

Output key encrypted with the new MFK


TABLE 4-16 lists the return values for the fs_translate_key() function.


TABLE 4-16 fs_translate_key() Function Return Values

Return Value

Description

fsOK

Key converted with the new MFK

fsInvalidKey

Input key invalid

fsInvalidState

Device is not in proper state to handle command


Retrieve Object Function fs_retrieve_object()

Applications can retrieve select objects from the board. For security reasons, there are two types of objects that are input with the direct input device that can be retrieved by applications:

When the object is entered, a unique label is also entered. This label is used to locate the object.

The syntax for the fs_retrieve_object() function is as follows:


fsReturn_t fs_retrieve_object(fsSessHandle_t handle, fsObjectType_t type, char *label, fsObjectData_t *obj)

TABLE 4-17 lists the parameters for the fs_retrieve_object() function.


TABLE 4-17 fs_retrieve_object() Function Parameters

Parameter

Description

handle

Session handle returned by the fs_session_open() function

label

Byte string identifier for the object

obj

Output buffer where the object is returned

type

Type of object to retrieve: KEK or decimalization table


TABLE 4-18 lists the return values for the fs_retrieve_object() function.


TABLE 4-18 fs_retrieve_object() Function Return Values

Return Value

Description

fsOK

Object located and retrieved

fsNotFound

Object not located

fsBufferTooSmall

Output buffer too small to hold object

fsInvalidState

Device is not in proper state to handle command


Status Function fs_status()

An application can query the board for its current status. The following board status values are supported:

The syntax for the fs_status() function is as follows:


fsReturn_t fs_status(fsStatusBuff_t *status)

The parameter for the fs_status() function is as follows:


PIN Processing Functions

The Sun Crypto Accelerator 6000 Board supports PIN verification and translation functionality. The interface ensures that sensitive customer data is exposed only within the secure HSM. This section describes the capabilities and interfaces supported.

PIN Block Formats

The board supports ANSI/ISO Format 0 and ISO Format 1 PIN-blocks described in this section.

ANSI/ISO Format 0

The ANSI/ISO Format 0 is an 8-byte block constructed with the combining of two 64-bit components: The clear text PIN, and the cleartext account number field.

The cleartext PIN, represented in hexadecimal characters, appears as follows:


C N P P P P P/F P/F P/F P/F P/F P/F P/F P/F F F 

The cleartext PIN hexadecimal characters are defined in TABLE 4-19.


TABLE 4-19 ANSI/ISO Format 0 Cleartext PIN Hexadecimal Characters

Field

Name

Value

C

Control field

4-bit field with binary value of 0000

N

PIN length

4-bit field with binary value between 0x4 and 0xc

P

PIN digit

4-bit field with binary value of 0000 to 1001

P/F

PIN/filler

4-bit field with binary value determined by PIN length

F

Filler

4-bit field with binary value of 1111


The cleartext account number field, represented in hexadecimal characters, appears as follows:


C C C C A A A A A A A A A A A A

The cleartext account number field hexadecimal characters are defined in TABLE 4-20.


TABLE 4-20 ANSI/ISO Format 0 Cleartext Account Number Field Hexadecimal Characters

Field

Name

Value

C

Control field

4-bit field with binary value of 0000

A

Primary account number (PAN)

12 right most digits of the PAN represented as 4-bit binary numbers with values of 000 to 1001 (0 to 9)


ISO Format 1

ISO Format 1 is the supported ISO-1 PIN block. This format supports a PIN length between 4 and 12 digits. PINs longer than 12 digits are truncated.

The ISO-1 PIN-block format, represented in hexadecimal characters, appears as follows:


1 L P P P P P/R P/R P/R P/R P/R P/R P/R P/R R R 

The ISO-1 PIN-block format hexadecimal characters are defined in TABLE 4-21.


TABLE 4-21 ISO Format 1 Hexadecimal Characters

Field

Name

Value

1

Fixed data

4-bit binary value of 0x1

L

PIN length

4-bit binary value between 0x4 and 0xc

P

PIN digit

4-bit binary value between 0x0 and 0x9

R

Random Digit

4-bit binary value between 0x0 and 0xf

P/R

PIN digit or random digit

4-bit binary value determined by the PIN length - P or R


PIN Calculation Methods

The Sun Crypto Accelerator 6000 Board supports the Visa PIN Validation Value (PVV) and the IBM-3624 methods for calculating PINs.

Visa PVV

PVV is a calculation and verification method specified by Visa. The credit card issuer or a designated agent provides a PIN Verification Service (PVS). This service compares the cardholder's PIN to a cryptographic transformation of the PIN.

The PVV method is a two step process:

1. When a PIN related credit card is issued, the issuer derives a 4-digit PVV. The PVV and the PIN Verification Key Index (PVKI) are either encoded on the credit card or registered in an online database. The stored PVV is called the reference PVV.

2. When a cardholder enters their PIN at the point of service, a transaction PVV is generated. The transaction PVV is compared to the reference PVV by the issuer or their agent. If the two PVVs match, the cardholder is authenticated.

For PVV, the following input is required:

IBM-3624

The following input is required for the IBM-3624 PIN calculation method:

Personal Account Number (PAN)

The right most 11 digits of the PAN, excluding the mod-10 check digit that must be used to generate the PVV - for example:

 


PAN
PAN Digits Selected
4839 1234 5678 9019
1234 5678 901

PIN

The PIN associated with the PAN must be used to generate the PVV. Regardless of the length of the PIN (4 to 12 digits), only the left most four digits are used.

PVKI

The PVKI is a one digit value that identifies which PIN verification key (PVK) to use for the PVV calculation. The PVKI is a single digit value from 0 to 6. A PVKI of 0 indicates that the PIN cannot be verified through PVS.

PIN Verify Function fs_pin_verify()

The PIN verify operation is executed by the credit card issuer or their agent to authenticate a cardholder's transaction. The Sun Crypto Accelerator 6000 board supports two types of PIN verification, Visa PVV and IBM-3624. Additionally, the board supports two types of PIN block formats, ANSI/ISO Format 0 and ISO Format 1.

The syntax for the fs_pin_verify() function is as follows:


fsReturn_t fs_pin_verify(fsSessHandle_t handle, fsPinAlg_t alg, fsKey_t *PEK, fsKey_t *PVK,  fsPAN_t *PAN, fsPIN_t *iPIN, fsPinData_t *data)

TABLE 4-22 lists the parameters for the fs_pin_verify() function.


TABLE 4-22 fs_pin_verify() Function Parameters

Parameter

Description

handle

Session handle returned by fs_session_open() function

alg

PIN algorithm: Visa PVV or IBM-3624

PEK

PIN encryption key encrypted with the HSM's MFK - the PIN has been encrypted with this key

PVK

Key encrypted with the MFK and used in the PIN verification computation

PAN

Personal account number

iPIN

Encrypted input PIN

data

PIN algorithm specific data

For Visa PVV data consists of:

  • PVKI
  • Reference PVV

For IBM-3624 data consists of:

  • Decimalization table
  • Validation data
  • Check length
  • Offset data

TABLE 4-23 lists the return values for the fs_pin_verify() function.


TABLE 4-23 fs_pin_verify() Function Return Values

Return Value

Description

fsOK

PIN was verified

fsOK

PIN failed verification

fsInvalidPEK

PEK invalid

fsInvalidPinType

PIN block format invalid

fsInvalidPVK

PVK invalid

fsInvalidPVKI

PVKI invalid (0 < PVKI || PVKI > 6)

fsInvalidState

Device not in correct state to process command

fsInvalidDectbl

Invalid decimalization table

fsError

Processing error


PIN Translate Function fs_pin_translate()

This function translates a PIN from one encryption key to another. This function is typically done at banking transactions. An example is when a cardholder uses their ATM card at a different bank than the one that issued the card. At the transaction, the PIN comes in encrypted using a PIN encryption key (PEK) specified by the point of service bank. To route the transaction to the credit card issuing bank, the transaction decrypts the PIN using the transaction originator’s PEK and then reencrypts it using the credit card issuing bank's PEK. The PIN block format can be requested to be translated (from ISO Format 0 to ISO Format 1 for example).

The syntax for the fs_pin_translate() function is as follows:


fsReturn_t fs_pin_translate(fsSessHandle_t handle, fsKey_t *iPEK, fsKey_t *oPEK, fsPIN_t *iPIN, fPIN_t *oPIN, fsPAN_t *PAN)

TABLE 4-24 lists the parameters for the fs_pin_verify() function.


TABLE 4-24 fs_pin_verify() Function Parameters

Parameter

Description

handle

Session handle returned by the fs_session_open() function

iPEK

Input PEK used to encrypt the PIN - this key is encrypted with the MFK

oPEK

Output PEK encrypted with the MFK

iPIN

Encrypted input PIN

oPIN

Buffer for encrypted output PIN

PAN

Personal account number


TABLE 4-25 lists the return values for the fs_pin_verify() function.


TABLE 4-25 fs_pin_verify() Function Return Values

Return Value

Description

fsOK

Operation successful

fsInvalidKey

Source or destination PEK invalid

fsInvalidKeyUsage

Key usage type invalid

fsInvalidPinType

Source or destination PIN block format invalid

fsInvalidPin

PIN invalid or corrupt - PIN must be decimal digits

fsInvalidPan

PAN invalid or corrupt

fsInvalidState

Device not in proper state to handle command



Credit Card Processing Overview

The Sun Crypto Accelerator 6000 Board board supports credit card verification processing for the major types of credit cards, Visa, MasterCard, and American Express. The interface ensures that sensitive customer data is only exposed within the HSM. This section describes the capabilities and interfaces supported.

Credit Card Processing Functions

The card verification (CV) is a cryptographic checksum of the data stored on a magnetic card. The Sun Crypto Accelerator 6000 board supports CV operations for Visa, MasterCard, and American Express credit cards.

Credit Card Verification Methods

Credit card verification is performed during normal ATM and POS transactions to verify the magnetic card data. The following algorithms are supported:


Administering Financial Services

This section describes the financial services administrative features and commands.

Financial Services Security Officers (FSSO)

FSSOs have specific financial services permissions. Each FSSO requires a unique security officer account created with the scamgr utility, described in Chapter 3. Only security officers can create and delete FSSO accounts. FSSO authentication is required to input keys and certain commands with the direct input device. These accounts can be configured to require single or multiple FSSO authentication for certain commands. To require multiple FSSOs per board to authenticate commands, a security officer must enable Multi-Admin mode, which is described in Multi-Admin Authentication.

Direct Input Device

A direct input device is required to load critical security parameters into the board. Only FSSOs can use the direct input device. See Direct Input Devices.

The direct input device is required to import the MFK and the KEKs. An FSSO must log in to the board with the direct input device and then initiate the key input command to import these keys.

Setting Financial Services Mode (fsmode)

To enable financial services features, an FSSO must place the board in one of two modes:

Administrative Commands

TABLE 4-26 describes the financial services administrative commands.



Note - Only FSSOs can initiate the commands listed in TABLE 4-26, and each command must be entered with a direct input device.



TABLE 4-26 Financial Services Administrative Commands

Command

Description

key input

Enters the MFK or the KEKs - the direct input device must be used to enter this command.

load mfk

Initiates the MFK key installation. After issuing this command, you can enter the respective key component and log out. Subsequent FSSOs can then log in and enter this command and enter their key component. Once the minimum number of components (default 2) have been entered, the key is considered pending and the device is disabled for everything other than key translation requests.

Unique FSSOs must enter each component, otherwise an error is reported.

enable mfk

Activates a new MFK and deletes the old one. Use this command after all applications have translated their keys under the new MFK.

cancel mfk

Cancels the MFK. Must be initiated before entering all of the MFK components.

delete mfk

Deletes the MFK. Must be done before enabling a pending MFK. If there is a previously enabled MFK, the board reverts to it.

load kek

Installs a KEK. You are prompted for a key label to associate with the key. The KEK is installed in component form similar to the MFK, so after entering the first component, you can log off. Additional security officers can then log in and enter their respective components, then log off.

Unique FSSOs must enter each component otherwise an error is returned.

cancel kek

Cancels a KEK. Must be done while entering a KEK and before all components are entered.

Note that KEKs are only temporarily stored on the board. Once an application retrieves the object, it is deleted. Additionally, KEKs are not preserved during a board reset.

delete kek

Deletes a KEK. Only authorized security officers can delete a previously entered KEK. The label used when the KEK was entered must be specified to locate the KEK.

load decimalization table

Loads a decimalization table, which is required for IBM-3624 PIN verification. You are prompted for a label to associate with the decimalization table. The entered decimalization table is encrypted with the MFK and can be retrieved by an application with the fs_retrieve_object() function.

delete decimalization table

Deletes a decimalization table.