> 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/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/sec_8h.md).

# sec.h

[Macros](#define-members) | [Functions](#func-members)

`#include "csdcontainer.h"` `#include "`[sec/libsec.h](/adk-5.0-programmers-guide/libsec_8h_source.md)`"`

Include dependency graph for sec.h:

![](/files/ZqoiZVp8B3zB4wJS7Cml)

This graph shows which files directly or indirectly include this file:

![](/files/ijsCmamN4fpU25rIh1ns)

[Go to the source code of this file.](/adk-5.0-programmers-guide/sec_8h_source.md)

|         |                                                                                                    |
| ------- | -------------------------------------------------------------------------------------------------- |
| Macros  |                                                                                                    |
| #define | [CLA\_SEC](#a72e3f69af3894a5cceb704998c518665)   0x70                                              |
|         | <p>Class for SEC commands. <a href="#a72e3f69af3894a5cceb704998c518665">More...</a><br></p>        |
| #define | [INS\_SEC\_OPEN](#ac74bc220be6eeeefbb63b996260afc24)   0x00                                        |
|         | <p>Open SecADK crypto interface. <a href="#ac74bc220be6eeeefbb63b996260afc24">More...</a><br></p>  |
| #define | [INS\_SEC\_CLOSE](#a5af03568952420504b69869b655b6665)   0x01                                       |
|         | <p>Close SecADK crypto interface. <a href="#a5af03568952420504b69869b655b6665">More...</a><br></p> |
| #define | [INS\_SEC\_ENCRYPT](#a2c15ab1edb92fe335f8c2362f3ceddf6)   0x02                                     |
|         | <p>SecADK Encrypt. <a href="#a2c15ab1edb92fe335f8c2362f3ceddf6">More...</a><br></p>                |
| #define | [INS\_SEC\_DECRYPT](#ae68f53f2d6dd3058d7a4c74a1f37e5c6)   0x03                                     |
|         | <p>SecADK Decrypt. <a href="#ae68f53f2d6dd3058d7a4c74a1f37e5c6">More...</a><br></p>                |
| #define | [INS\_SEC\_SIGN](#a6b65f189b9f518902cfc6d38b5972c0e)   0x04                                        |
|         | <p>SecADK Singing. <a href="#a6b65f189b9f518902cfc6d38b5972c0e">More...</a><br></p>                |
| #define | [INS\_SEC\_VERIFY](#afb9a2cc81a942bfd3f0ed9d6745c4878)   0x05                                      |
|         | <p>SecADK Verify. <a href="#afb9a2cc81a942bfd3f0ed9d6745c4878">More...</a><br></p>                 |
| #define | [INS\_SEC\_UPDATE\_KEY](#a7be370ee4477eaa72f63f283a99a8e1b)   0x06                                 |
|         | <p>SecADK Update Key. <a href="#a7be370ee4477eaa72f63f283a99a8e1b">More...</a><br></p>             |
| #define | [INS\_SEC\_SET\_KEY\_SET](#a796f0cb0783a46f24c3dedc304c31eb8)   0x07                               |
|         | <p>SecADK Set Key Set. <a href="#a796f0cb0783a46f24c3dedc304c31eb8">More...</a><br></p>            |
| #define | [INS\_SEC\_GET\_ENCRYPTED\_PIN](#a79fa2cfe6114399ad96f41977bcb7fe1)   0x08                         |
|         | <p>SecADK Get encrypted Pin. <a href="#a79fa2cfe6114399ad96f41977bcb7fe1">More...</a><br></p>      |
| #define | [INS\_SEC\_GET\_KEY\_INVENTORY](#a645ac958fd2392b18f23cba23eaf19b4)   0x09                         |
|         | <p>SecADK Get Key Inventory. <a href="#a645ac958fd2392b18f23cba23eaf19b4">More...</a><br></p>      |
| #define | [INS\_SEC\_GET\_KEY\_DATA](#ada44cc11d4f02b072bc4a36831914b12)   0x0A                              |
|         | <p>SecADK Get Key Data. <a href="#ada44cc11d4f02b072bc4a36831914b12">More...</a><br></p>           |
| #define | [INS\_SEC\_GET\_STATUS](#aa9fe8114148d7219b3467243e20a6d69)   0x0B                                 |
|         | <p>SecADK Get Status. <a href="#aa9fe8114148d7219b3467243e20a6d69">More...</a><br></p>             |
| #define | [INS\_SEC\_GET\_VERSION](#a72d95895724387f428c8b04913fa9e2d)   0x0C                                |
|         | <p>SecADK Get Version. <a href="#a72d95895724387f428c8b04913fa9e2d">More...</a><br></p>            |

|           |                                                                                                                                                                                                                                                                                                                                                                                                                |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Functions |                                                                                                                                                                                                                                                                                                                                                                                                                |
| bool      | [isAdeEnabled](#acfedfb1b909acd490a61944fb6d79def) (void)                                                                                                                                                                                                                                                                                                                                                      |
| void      | [handleSec](#ac8c59ad55811826c6d394f6ae3dfcc04) (unsigned short msgBufSize, unsigned char \*msg, unsigned short msgSize, unsigned short rspBufSize, unsigned char \*rsp, unsigned short \*rspSize)                                                                                                                                                                                                             |
| int       | [findCryptoHandle](#a1152b5b6ef4eeeb34352d2707f6ab872) (struct [BTLVNode](/adk-5.0-programmers-guide/readme/annotated/struct_b_t_l_v_node.md) \*xBtlv, struct [BTLVNode](/adk-5.0-programmers-guide/readme/annotated/struct_b_t_l_v_node.md) \*\*node, [com\_adksec\_cmd::secHandle\_t](/adk-5.0-programmers-guide/readme/namespaces/namespacecom__adksec__cmd.md#acc01edab4b0f73c92142d9d43dc7a7f7) \*handle) |
| int       | [SEC\_getEncryptedPin](#a74d8a4aae80136676662f5c370352591) (struct [BTLVNode](/adk-5.0-programmers-guide/readme/annotated/struct_b_t_l_v_node.md) \*xBtlv, [com\_adksec\_cmd::secError](/adk-5.0-programmers-guide/readme/namespaces/namespacecom__adksec__cmd.md#af511ddd4237541a758df48299546d49a) \&errorCode)                                                                                              |
| bool      | [getSecHandle](#ad7f13c5a06cf61a03f3d0a6f993a2cc4) (void \*sdihandle, [com\_adksec\_cmd::secHandle\_t](/adk-5.0-programmers-guide/readme/namespaces/namespacecom__adksec__cmd.md#acc01edab4b0f73c92142d9d43dc7a7f7) \&h, unsigned idx)                                                                                                                                                                         |
| void      | [cleanUpSecHandles](#a8ab35d4f50f1f1a915b30797fa283c03) (void \*sdihandle)                                                                                                                                                                                                                                                                                                                                     |

### MacroDefinition Documentation <a href="#macro-definition-documentation" id="macro-definition-documentation"></a>

### CLA\_SEC <a href="#a72e3f69af3894a5cceb704998c518665" id="a72e3f69af3894a5cceb704998c518665"></a>

\#define CLA\_SEC   0x70

Class for SEC commands.

### INS\_SEC\_CLOSE <a href="#a5af03568952420504b69869b655b6665" id="a5af03568952420504b69869b655b6665"></a>

\#define INS\_SEC\_CLOSE   0x01

Close SecADK crypto interface.

### INS\_SEC\_DECRYPT <a href="#ae68f53f2d6dd3058d7a4c74a1f37e5c6" id="ae68f53f2d6dd3058d7a4c74a1f37e5c6"></a>

\#define INS\_SEC\_DECRYPT   0x03

SecADK Decrypt.

### INS\_SEC\_ENCRYPT <a href="#a2c15ab1edb92fe335f8c2362f3ceddf6" id="a2c15ab1edb92fe335f8c2362f3ceddf6"></a>

\#define INS\_SEC\_ENCRYPT   0x02

SecADK Encrypt.

### INS\_SEC\_GET\_ENCRYPTED\_PIN <a href="#a79fa2cfe6114399ad96f41977bcb7fe1" id="a79fa2cfe6114399ad96f41977bcb7fe1"></a>

\#define INS\_SEC\_GET\_ENCRYPTED\_PIN   0x08

SecADK Get encrypted Pin.

### INS\_SEC\_GET\_KEY\_DATA <a href="#ada44cc11d4f02b072bc4a36831914b12" id="ada44cc11d4f02b072bc4a36831914b12"></a>

\#define INS\_SEC\_GET\_KEY\_DATA   0x0A

SecADK Get Key Data.

### INS\_SEC\_GET\_KEY\_INVENTORY <a href="#a645ac958fd2392b18f23cba23eaf19b4" id="a645ac958fd2392b18f23cba23eaf19b4"></a>

\#define INS\_SEC\_GET\_KEY\_INVENTORY   0x09

SecADK Get Key Inventory.

### INS\_SEC\_GET\_STATUS <a href="#aa9fe8114148d7219b3467243e20a6d69" id="aa9fe8114148d7219b3467243e20a6d69"></a>

\#define INS\_SEC\_GET\_STATUS   0x0B

SecADK Get Status.

### INS\_SEC\_GET\_VERSION <a href="#a72d95895724387f428c8b04913fa9e2d" id="a72d95895724387f428c8b04913fa9e2d"></a>

\#define INS\_SEC\_GET\_VERSION   0x0C

SecADK Get Version.

### INS\_SEC\_OPEN <a href="#ac74bc220be6eeeefbb63b996260afc24" id="ac74bc220be6eeeefbb63b996260afc24"></a>

\#define INS\_SEC\_OPEN   0x00

Open SecADK crypto interface.

### INS\_SEC\_SET\_KEY\_SET <a href="#a796f0cb0783a46f24c3dedc304c31eb8" id="a796f0cb0783a46f24c3dedc304c31eb8"></a>

\#define INS\_SEC\_SET\_KEY\_SET   0x07

SecADK Set Key Set.

### INS\_SEC\_SIGN <a href="#a6b65f189b9f518902cfc6d38b5972c0e" id="a6b65f189b9f518902cfc6d38b5972c0e"></a>

\#define INS\_SEC\_SIGN   0x04

SecADK Singing.

### INS\_SEC\_UPDATE\_KEY <a href="#a7be370ee4477eaa72f63f283a99a8e1b" id="a7be370ee4477eaa72f63f283a99a8e1b"></a>

\#define INS\_SEC\_UPDATE\_KEY   0x06

SecADK Update Key.

### INS\_SEC\_VERIFY <a href="#afb9a2cc81a942bfd3f0ed9d6745c4878" id="afb9a2cc81a942bfd3f0ed9d6745c4878"></a>

\#define INS\_SEC\_VERIFY   0x05

SecADK Verify.

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

### cleanUpSecHandles() <a href="#a8ab35d4f50f1f1a915b30797fa283c03" id="a8ab35d4f50f1f1a915b30797fa283c03"></a>

void cleanUpSecHandles

### findCryptoHandle() <a href="#a1152b5b6ef4eeeb34352d2707f6ab872" id="a1152b5b6ef4eeeb34352d2707f6ab872"></a>

int findCryptoHandle

### getSecHandle() <a href="#ad7f13c5a06cf61a03f3d0a6f993a2cc4" id="ad7f13c5a06cf61a03f3d0a6f993a2cc4"></a>

bool getSecHandle

### handleSec() <a href="#ac8c59ad55811826c6d394f6ae3dfcc04" id="ac8c59ad55811826c6d394f6ae3dfcc04"></a>

void handleSec

Dispatch function to handle different crypto interface commands

**Parameters**

\[in] **msgBufSize** size of the input message buffer \[in] **msg** pointer to the input message buffer \[in] **msgSize** size of the input message \[in] **rspBufSize** maximum size of the response buffer \[in,out] **rsp** pointer to the response buffer \[in,out] **rspSize** pointer to the response message size

{% hint style="info" %}
[handleSec()](#ac8c59ad55811826c6d394f6ae3dfcc04) is always executed, even if invoked by a side command. Therefore, this function has no return value, see also [process\_side\_command()](/adk-5.0-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/main_8cpp.md#a4892e1b795462119ef4d6fa87c860b90).
{% endhint %}

### isAdeEnabled() <a href="#acfedfb1b909acd490a61944fb6d79def" id="acfedfb1b909acd490a61944fb6d79def"></a>

bool isAdeEnabled

### SEC\_getEncryptedPin() <a href="#a74d8a4aae80136676662f5c370352591" id="a74d8a4aae80136676662f5c370352591"></a>

int SEC\_getEncryptedPin


---

# 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/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/sec_8h.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.
