> For the complete documentation index, see [llms.txt](https://sandbox-docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sandbox-docs.verifone.com/adk-5.0-programmers-guide/readme/modules/group__sdisec.md).

# Crypto interface

[Functions](#func-members)

|           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Functions |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| int       | [secOpen](#ga26d5ebd1bb44ed4eb1c544138554a502) (unsigned \&handle, const std::string \&hostname)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| int       | [secClose](#ga3107d7a75dcdb6e0afefd34f8899e069) (unsigned handle)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| int       | [secEncrypt](#gaf3470782c87005ccde96353d1d35aea1) (unsigned handle, const [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&in, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&out, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*iv=0, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*ksn=0)                                                                 |
| int       | [secDecrypt](#ga01037817b5b7c32ebbe6e457afc9bab5) (unsigned handle, const [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&in, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&out, const [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*iv=0, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*ksn=0)                                                           |
| int       | [secSign](#gae05e831512fd20882f1511af5fc239f1) (unsigned handle, const [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&in, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&out, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*iv=0, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*ksn=0)                                                                    |
| int       | [secVerify](#ga0a78a2ddef5285d52fddab789f413997) (unsigned handle, const [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&in, const [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&sig, const [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*iv=0, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*ksn=0)                                                      |
| int       | [secUpdateKey](#ga8102b0dcd4ce6016fe741537838372d6) (unsigned handle, unsigned char keyType, const [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&key, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*prop=0, const unsigned char \*as2805=0, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*key\_kcv=0)                                                                                                                                                                |
| int       | [secUpdateKey](#ga0b01d1a2365155b46cee88c6311dbbd2) (unsigned handle, unsigned char keyType, const [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&key, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*prop, const unsigned char \*as2805, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*key\_kcv, const [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \*iv) |
| int       | [secSetKeySetID](#gacdf3389163b8110d856ab917e1e7f371) (unsigned handle, unsigned id, unsigned master\_id=0)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| int       | [secGetEncryptedPIN](#ga5ad9f7f5cdcf0be2a96ce65fa86e3cde) (unsigned handle, unsigned char fmt, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&pinblock, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&ksn, bool zero\_pin=false)                                                                                                                                                                                                                                                                                                                                                   |
| int       | [secGetKeyInventory](#ga62092608242068d13529fe03a3798b51) (unsigned handle, std::string \&json)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| int       | [secGetKeyData](#ga727a0f15ca598fd9301e5bcc57bb032d) (unsigned handle, unsigned char keyType, [bytevector](https://github.com/verifoneone/verifone-git-book-adk/tree/ADK5.0_staging/classvfisdi_1_1_s_d_i_client.md#a64b5be62be31dcda165d2c6c3c262fb5) \&out, bool kek\_flag=false)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| int       | [secGetStatus](#ga7d1710a7cfdfe6d76a8325a8d04024f8) (unsigned handle, std::string \&json)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| int       | [secGetStatus](#gafa4b86bd1d87b20b687f392f4461d7d2) (const std::string \&hostname, std::string \&json)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| int       | [secGetStatus](#ga755cac8deb17e98f7b8ae18e0e1dad23) (std::string \&json)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| int       | [secGetVersions](#ga49e04000a7b02afe6658905ff24529e3) (std::string \&version)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

### DetailedDescription <a href="#detailed-description" id="detailed-description"></a>

### FunctionDocumentation <a href="#function-documentation" id="function-documentation"></a>

### secClose() <a href="#ga3107d7a75dcdb6e0afefd34f8899e069" id="ga3107d7a75dcdb6e0afefd34f8899e069"></a>

int secClose

Close the crypto device (70-01)

**Parameters**

\[in] **handle** crypto handle

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secDecrypt() <a href="#ga01037817b5b7c32ebbe6e457afc9bab5" id="ga01037817b5b7c32ebbe6e457afc9bab5"></a>

int secDecrypt

Decrypt data (70-03)

**Parameters**

\[in] **handle** crypto handle \[in] **in** plain text data \[out] **out** encrypted data \[in] **iv** optional initialization vector (IV), may be NULL \[out] **ksn** optional DUKPT key serial number, may be NULL

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secEncrypt() <a href="#gaf3470782c87005ccde96353d1d35aea1" id="gaf3470782c87005ccde96353d1d35aea1"></a>

int secEncrypt

Encrypt data (70-02)

**Parameters**

\[in] **handle** crypto handle \[in] **in** plain text data (DFA402) \[out] **out** encrypted data \[in,out] **iv** optional initialization vector (IV), may be NULL \[out] **ksn** optional DUKPT key serial number, may be NULL

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secGetEncryptedPIN() <a href="#ga5ad9f7f5cdcf0be2a96ce65fa86e3cde" id="ga5ad9f7f5cdcf0be2a96ce65fa86e3cde"></a>

int secGetEncryptedPIN

Retrieve encrypted PIN block (70-08)

**Parameters**

\[in] **handle** crypto handle \[in] **fmt** ISO PIN block format (0..3) \[out] **pinblock** encrypted PIN block \[out] **ksn** DUKPT key serial number \[in] **zero\_pin** if true request zero PIN block

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secGetKeyData() <a href="#ga727a0f15ca598fd9301e5bcc57bb032d" id="ga727a0f15ca598fd9301e5bcc57bb032d"></a>

int secGetKeyData

Get key data (70-0A)

**Parameters**

\[in] **handle** crypto handle \[in] **keyType** key type \[out] **out** JSON formatted information about keys \[in] **kek\_flag** optional KEK flag

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secGetKeyInventory() <a href="#ga62092608242068d13529fe03a3798b51" id="ga62092608242068d13529fe03a3798b51"></a>

int secGetKeyInventory

Get key inventory (70-09)

**Parameters**

\[in] **handle** crypto handle \[out] **json** JSON formatted information about keys

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secGetStatus()\[1/3] <a href="#gafa4b86bd1d87b20b687f392f4461d7d2" id="gafa4b86bd1d87b20b687f392f4461d7d2"></a>

int secGetStatus

Get crypto status of host (70-0B)

**Parameters**

\[in] **hostname** host name, if empty the status of all hosts is returned \[out] **json** status information

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secGetStatus()\[2/3] <a href="#ga755cac8deb17e98f7b8ae18e0e1dad23" id="ga755cac8deb17e98f7b8ae18e0e1dad23"></a>

int secGetStatus

inline

Get crypto status of all hosts (70-0B)

**Parameters**

\[out] **json** status information

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secGetStatus()\[3/3] <a href="#ga7d1710a7cfdfe6d76a8325a8d04024f8" id="ga7d1710a7cfdfe6d76a8325a8d04024f8"></a>

int secGetStatus

Get crypto status (70-0B)

**Parameters**

\[in] **handle** crypto handle \[out] **json** status information

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secGetVersions() <a href="#ga49e04000a7b02afe6658905ff24529e3" id="ga49e04000a7b02afe6658905ff24529e3"></a>

int secGetVersions

Get crypto version information (70-0C)

**Parameters**

\[out] **version** version information

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secOpen() <a href="#ga26d5ebd1bb44ed4eb1c544138554a502" id="ga26d5ebd1bb44ed4eb1c544138554a502"></a>

int secOpen

Open the crypto device (70-00)

**Parameters**

\[out] **handle** crypto handle \[in] **hostname** host name

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secSetKeySetID() <a href="#gacdf3389163b8110d856ab917e1e7f371" id="gacdf3389163b8110d856ab917e1e7f371"></a>

int secSetKeySetID

Set key set ID (70-07)

**Parameters**

\[in] **handle** crypto handle \[in] **id** key set ID, it must be always > 0 \[in] **master\_id** master key set ID, optional parameter, relevant for MKSK Session Key injection and for Trinity only

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secSign() <a href="#gae05e831512fd20882f1511af5fc239f1" id="gae05e831512fd20882f1511af5fc239f1"></a>

int secSign

Sign data (70-04)

**Parameters**

\[in] **handle** crypto handle \[in] **in** plain text data \[out] **out** MAC or signature \[in,out] **iv** optional initialization vector (IV), may be NULL \[out] **ksn** optional DUKPT key serial number, may be NULL

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secUpdateKey()\[1/2] <a href="#ga0b01d1a2365155b46cee88c6311dbbd2" id="ga0b01d1a2365155b46cee88c6311dbbd2"></a>

int secUpdateKey

Update key (70-06)

**Parameters**

\[in] **handle** crypto handle \[in] **keyType** key type (SECKeyType) (DFA40C) \[in] **key** key data, binary data (e.g. 8Byte for 1DES, 16Byte for 3DES and 2TDEA-ADE-DUKPT key, 120Byte for GISKE) TLV if keyType is a Bendigo-type 'KSN incrementation' with keyType=KEY\_TYPE\_DUKPT effects KSN incrementation (DFA40D) \[in,out] **prop** if not NULL proprietary datain: in case of DUKPT (modules VSS, IPP DUKPT part, ADE): KSN binary data (maybe padded with 0xFF, 0xFF))out: in case of VSS-MSK and VSS-DUKPT (module VSS): received data from an assigned Update Finalize macro \[in] **as2805** if not NULL optional AS2805 tag data (1 byte). \[in,out] **key\_kcv** Key Check Value, relevant for MKSK/CustomRKL Key injection and for Trinity/Neo onlyin: kcv of injecting key to verify, it is optional. No verification if emptyout: kcv of injected key \[in] **iv** if not NULL optional initial vector, relevant for Trinity/Neo only.

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secUpdateKey()\[2/2] <a href="#ga8102b0dcd4ce6016fe741537838372d6" id="ga8102b0dcd4ce6016fe741537838372d6"></a>

int secUpdateKey

Update key (70-06)

**Parameters**

\[in] **handle** crypto handle \[in] **keyType** key type (SECKeyType) (DFA40C) \[in] **key** key data, binary data (e.g. 8Byte for 1DES, 16Byte for 3DES and 2TDEA-ADE-DUKPT key, 120Byte for GISKE) TLV if keyType is a Bendigo-type 'KSN incrementation' with keyType=KEY\_TYPE\_DUKPT effects KSN incrementation (DFA40D) \[in,out] **prop** if not NULL proprietary datain: in case of DUKPT (modules VSS, IPP DUKPT part, ADE): KSN binary data (maybe padded with 0xFF, 0xFF))out: in case of VSS-MSK and VSS-DUKPT (module VSS): received data from an assigned Update Finalize macro \[in] **as2805** if not NULL optional AS2805 tag data (1 byte). \[in,out] **key\_kcv** Key Check Value, relevant for MKSK/CustomRKL Key injection and for Trinity/Neo onlyin: kcv of injecting key to verify, it is optional. No verification if emptyout: kcv of injected key

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))

### secVerify() <a href="#ga0a78a2ddef5285d52fddab789f413997" id="ga0a78a2ddef5285d52fddab789f413997"></a>

int secVerify

Verify signature (70-05)

**Parameters**

\[in] **handle** crypto handle \[in] **in** plain text data \[in] **sig** MAC or signature \[in] **iv** optional initialization vector (IV), may be NULL \[out] **ksn** optional DUKPT key serial number, may be NULL

#### Returns

SDI error code ([Result](/adk-5.0-programmers-guide/readme/namespaces/namespacevfisdi.md#a28287671eaf7406afd604bd055ba4066))


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sandbox-docs.verifone.com/adk-5.0-programmers-guide/readme/modules/group__sdisec.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
