Botan 3.13.0
Crypto and TLS for C&
p11.h
Go to the documentation of this file.
1/*
2* PKCS #11
3* (C) 2016 Daniel Neus, Sirrix AG
4* (C) 2016 Philipp Weber, Sirrix AG
5* (C) 2025 Fabian Albert, Rohde & Schwarz Cybersecurity GmbH
6*
7* Botan is released under the Simplified BSD License (see license.txt)
8*/
9
10#ifndef BOTAN_P11_H_
11#define BOTAN_P11_H_
12
13#include <botan/exceptn.h>
14#include <botan/secmem.h>
15
16#include <limits>
17#include <map>
18#include <string>
19#include <vector>
20
21#if defined(_MSC_VER)
22 // PKCS #11 v3.2, section 2.1 - Structure packing
23 // Cryptoki structures are packed to occupy as little space as is possible.
24 // Cryptoki structures SHALL be packed with 1-byte alignment.
25 // (Also recommended in official pkcs11 header comments)
26 #pragma pack(push, cryptoki, 1)
27#endif
28
29#define PKCS11_DEPRECATED // also use deprecated PKCS #11 symbols
30#include <pkcs11.h>
31
32#if defined(_MSC_VER)
33 #pragma pack(pop, cryptoki)
34#endif
35
36static_assert(
38 "The Botan PKCS #11 module was implemented against PKCS #11 v3.2. Please use the correct PKCS #11 headers.");
39
40namespace Botan {
41
42class Dynamically_Loaded_Library;
43
44namespace PKCS11 {
45
47
48// NOLINTBEGIN(*-enum-size)
49
114 EcdsaParams = CKA_ECDSA_PARAMS,
117 SecondaryAuth = CKA_SECONDARY_AUTH,
118 AuthPinFlags = CKA_AUTH_PIN_FLAGS,
211};
212
219
220/// Indicates if a stored certificate is a user certificate for which the corresponding private key is available
221/// on the token ("token user"), a CA certificate ("authority"), or another end-entity certificate ("other entity").
228
239
246
252
259
267
272
301
302enum class Flag : CK_FLAGS {
303 None = 0,
355 EcNamedcurve = CKF_EC_NAMEDCURVE,
376};
377
378inline Flag operator|(Flag a, Flag b) {
379 // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
380 return static_cast<Flag>(static_cast<CK_FLAGS>(a) | static_cast<CK_FLAGS>(b));
381}
382
390
403
410
416
417enum class KeyType : CK_KEY_TYPE {
421 Ecdsa = CKK_ECDSA,
433 Cast5 = CKK_CAST5,
487};
488
644 Cast5KeyGen = CKM_CAST5_KEY_GEN,
646 Cast5Ecb = CKM_CAST5_ECB,
648 Cast5Cbc = CKM_CAST5_CBC,
650 Cast5Mac = CKM_CAST5_MAC,
652 Cast5MacGeneral = CKM_CAST5_MAC_GENERAL,
654 Cast5CbcPad = CKM_CAST5_CBC_PAD,
702 PbeMd5Cast5Cbc = CKM_PBE_MD5_CAST5_CBC,
704 PbeSha1Cast5Cbc = CKM_PBE_SHA1_CAST5_CBC,
783 EcdsaKeyPairGen = CKM_ECDSA_KEY_PAIR_GEN,
852 DsaProbablisticParameterGen = CKM_DSA_PROBABLISTIC_PARAMETER_GEN, // TODO(Botan4) remove this typo
964};
965
970
986
997
1008
1014
1029
1035
1043
1047
1055
1056enum class ReturnValue : CK_RV {
1162};
1163
1169
1175
1183
1184enum class PublicPointEncoding : uint32_t { Raw, Der };
1185
1186// NOLINTEND(*-enum-size)
1187
1221
1222// NOLINTNEXTLINE(*-avoid-non-const-global-variables) TODO can this be made const?
1224
1227
1228inline Ulong checked_ulong_cast(size_t v) {
1229 if(v > std::numeric_limits<Ulong>::max()) {
1230 throw Invalid_Argument("PKCS #11 value exceeds CK_ULONG range");
1231 }
1232 return static_cast<Ulong>(v);
1233}
1234
1236 return static_cast<Flags>(flags);
1237}
1238
1239class Slot;
1240
1241/**
1242* Initializes a token
1243* @param slot The slot with the attached token that should be initialized
1244* @param label The token label
1245* @param so_pin PIN of the security officer. Will be set if the token is uninitialized other this has to be the current SO_PIN
1246* @param pin The user PIN that will be set
1247*/
1248BOTAN_PUBLIC_API(2, 0)
1249void initialize_token(Slot& slot, std::string_view label, const secure_string& so_pin, const secure_string& pin);
1250
1251/**
1252* Change PIN with old PIN to new PIN
1253* @param slot The slot with the attached token
1254* @param old_pin The old user PIN
1255* @param new_pin The new user PIN
1256*/
1257
1258BOTAN_PUBLIC_API(2, 0) void change_pin(Slot& slot, const secure_string& old_pin, const secure_string& new_pin);
1259
1260/**
1261* Change SO_PIN with old SO_PIN to new SO_PIN
1262* @param slot The slot with the attached token
1263* @param old_so_pin The old SO_PIN
1264* @param new_so_pin The new SO_PIN
1265*/
1266BOTAN_PUBLIC_API(2, 0) void change_so_pin(Slot& slot, const secure_string& old_so_pin, const secure_string& new_so_pin);
1267
1268/**
1269* Sets user PIN with SO_PIN
1270* @param slot The slot with the attached token
1271* @param so_pin PIN of the security officer
1272* @param pin The user PIN that should be set
1273*/
1274BOTAN_PUBLIC_API(2, 0) void set_pin(Slot& slot, const secure_string& so_pin, const secure_string& pin);
1275
1276/**
1277 * @brief Wraps a PKCS #11 Interface object.
1278 *
1279 * This class provides an interface to access PKCS #11 functions of various versions.
1280 * For example func_3_0() returns the PKCS #11 v3.0 function list for a loaded interface.
1281 * Only the official "PKCS 11" named interfaces are supported.
1282 */
1284 private:
1285 Interface m_p11_interface;
1286
1287 public:
1288 /// Basic constructor using an interface.
1289 explicit InterfaceWrapper(Interface p11_interface);
1290
1296
1297 /// Access the underlying interface object
1298 const Interface& raw_interface() const { return m_p11_interface; }
1299
1300 /// Access the version of the interface
1301 Version version() const;
1302
1303 /// Access the name of the interface
1304 std::span<const Utf8Char> name() const;
1305
1306 /// Access a function list that contains all methods since PKCS #11 v.2.40
1307 const FunctionList& func_2_40() const;
1308
1309 /// Access a function list that contains all methods since PKCS #11 v.3.0
1310 const FunctionList30& func_3_0() const;
1311
1312 /// Access a function list that contains all methods since PKCS #11 v.3.2
1313 const FunctionList32& func_3_2() const;
1314
1315 /// Find the latest supported "PKCS 11" interface. Fork safe interfaces
1316 /// are preferred over non fork safe ones of the same version.
1317 static InterfaceWrapper latest_p11_interface(Dynamically_Loaded_Library& library);
1318
1319 /**
1320 * Returns an immortal pointer to the Utf8Char string "PKCS 11".
1321 * Used to define an interface object.
1322 *
1323 * @warning Unfortunately, the interface object requires a non constant
1324 * pointer. However, this string MUST NOT be modified!
1325 */
1326 static Utf8Char* p11_interface_name_ptr();
1327};
1328
1329/// Provides access to all PKCS #11 functions
1331 public:
1332 /// @param ptr the function list pointer to use. Can be retrieved via `LowLevel::C_GetFunctionList`
1333 BOTAN_DEPRECATED("Use LowLevel(InterfaceWrapper::latest_p11_interface(module.library()))")
1334 explicit LowLevel(FunctionList* ptr);
1335
1336 explicit LowLevel(InterfaceWrapper interface_wrapper);
1337
1338 /****************************** General purpose functions ******************************/
1339
1340 /**
1341 * C_Initialize initializes the Cryptoki library.
1342 * @param init_args if this is not nullptr, it gets cast to (`C_InitializeArgs`) and dereferenced
1343 * @param return_value default value (`ThrowException`): throw exception on error.
1344 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1345 * At least the following PKCS #11 return values may be returned:
1346 * \li ArgumentsBad \li CantLock \li CryptokiAlreadyInitialized
1347 * \li FunctionFailed \li GeneralError \li HostMemory
1348 * \li NeedToCreateThreads \li OK
1349 * @return true on success, false otherwise
1350 */
1351 bool C_Initialize(const void* init_args, ReturnValue* return_value = ThrowException) const;
1352
1353 /**
1354 * C_Finalize indicates that an application is done with the Cryptoki library.
1355 * @param reserved reserved. Should be nullptr
1356 * @param return_value default value (`ThrowException`): throw exception on error.
1357 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1358 * At least the following PKCS #11 return values may be returned:
1359 * \li ArgumentsBad \li CryptokiNotInitialized \li FunctionFailed
1360 * \li GeneralError \li HostMemory \li OK
1361 * @return true on success, false otherwise
1362 */
1363 bool C_Finalize(void* reserved, ReturnValue* return_value = ThrowException) const;
1364
1365 /**
1366 * C_GetInfo returns general information about Cryptoki.
1367 * @param info_ptr location that receives information
1368 * @param return_value default value (`ThrowException`): throw exception on error.
1369 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1370 * At least the following PKCS #11 return values may be returned:
1371 * \li ArgumentsBad \li CryptokiNotInitialized \li FunctionFailed
1372 * \li GeneralError \li HostMemory \li OK
1373 * @return true on success, false otherwise
1374 */
1375 bool C_GetInfo(Info* info_ptr, ReturnValue* return_value = ThrowException) const;
1376
1377 /**
1378 * C_GetFunctionList returns the function list.
1379 * @param pkcs11_module The PKCS #11 module
1380 * @param function_list_ptr_ptr receives pointer to function list
1381 * @param return_value default value (`ThrowException`): throw exception on error.
1382 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1383 * At least the following PKCS #11 return values may be returned:
1384 * \li ArgumentsBad \li FunctionFailed \li GeneralError
1385 * \li HostMemory \li OK
1386 * @return true on success, false otherwise
1387 */
1388 static bool C_GetFunctionList(const Dynamically_Loaded_Library& pkcs11_module,
1389 FunctionList** function_list_ptr_ptr,
1390 ReturnValue* return_value = ThrowException);
1391
1392 /**
1393 * C_GetInterfaceList is used to obtain a list of interfaces supported by
1394 * a Cryptoki library. count_ptr points to the location that receives the
1395 * number of interfaces. There are two ways for an application to call
1396 * C_GetInterfaceList:
1397 * 1. If interface_list_ptr is nullptr, then all that C_GetInterfaceList
1398 * does is return (in *count_ptr) the number of interfaces, without
1399 * actually returning a list of interfaces. The contents of *count_ptr
1400 * on entry to C_GetInterfaceList have no meaning in this case, and the
1401 * call returns the value CKR_OK.
1402 * 2. If pIntrerfaceList is not nullptr, then *count_ptr MUST contain the
1403 * size (in terms of CK_INTERFACE elements) of the buffer pointed to
1404 * by interface_list_ptr. If that buffer is large enough to hold the
1405 * list of interfaces, then the list is returned in it, and CKR_OK is
1406 * returned. If not, then the call to C_GetInterfaceList returns the
1407 * value CKR_BUFFER_TOO_SMALL. In either case, the value *count_ptr is
1408 * set to hold the number of interfaces.
1409 *
1410 * Because C_GetInterfaceList does not allocate any space of its own, an
1411 * application will often call C_GetInterfaceList twice. However, this
1412 * behavior is by no means required. C_GetInterfaceList obtains
1413 * (in *pFunctionList of each interface) a pointer to the Cryptoki
1414 * library’s list of function pointers. The pointer thus obtained may
1415 * point into memory which is owned by the Cryptoki library, and which
1416 * may or may not be writable. Whether or not this is the case, no attempt
1417 * should be made to write to this memory. The same caveat applies to
1418 * the interface names returned.
1419 *
1420 * @param pkcs11_module The PKCS #11 module
1421 * @param interface_list_ptr returned interfaces
1422 * @param count_ptr number of interfaces returned
1423 * @param return_value default value (`ThrowException`): throw exception on error.
1424 * @return true on success, false otherwise
1425 */
1426 static bool C_GetInterfaceList(const Dynamically_Loaded_Library& pkcs11_module,
1427 Interface* interface_list_ptr,
1428 Ulong* count_ptr,
1429 ReturnValue* return_value = ThrowException);
1430
1431 /**
1432 * C_GetInterface is used to obtain an interface supported by a Cryptoki
1433 * library. pInterfaceName specifies the name of the interface, pVersion
1434 * specifies the interface version, ppInterface points to the location
1435 * that receives the interface, flags specifies the required interface
1436 * flags. There are multiple ways for an application to specify a
1437 * particular interface when calling C_GetInterface:
1438 * 1. If pInterfaceName is not nullptr, the name of the interface
1439 * returned must match. If pInterfaceName is nullptr, the cryptoki
1440 * library can return a default interface of its choice
1441 * 2. If pVersion is not nullptr, the version of the interface returned
1442 * must match. If pVersion is nullptr, the cryptoki library can
1443 * return an interface of any version
1444 * 3. If flags is non-zero, the interface returned must match all of the
1445 * supplied flag values (but may include additional flags not
1446 * specified). If flags is 0, the cryptoki library can return an
1447 * interface with any flags
1448 *
1449 * @param pkcs11_module The PKCS #11 module
1450 * @param interface_name_ptr name of the interface
1451 * @param version_ptr version of the interface
1452 * @param interface_ptr_ptr returned interface
1453 * @param flags flags controlling the semantics of the interface
1454 * @param return_value default value (`ThrowException`): throw exception on error.
1455 * @return true on success, false otherwise
1456 */
1457 static bool C_GetInterface(const Dynamically_Loaded_Library& pkcs11_module,
1458 const Utf8Char* interface_name_ptr,
1459 const Version* version_ptr,
1460 Interface** interface_ptr_ptr,
1461 Flags flags,
1462 ReturnValue* return_value = ThrowException);
1463
1464 /****************************** Slot and token management functions ******************************/
1465
1466 /**
1467 * C_GetSlotList obtains a list of slots in the system.
1468 * @param token_present only slots with tokens
1469 * @param slot_list_ptr receives array of slot IDs
1470 * @param count_ptr receives number of slots
1471 * @param return_value default value (`ThrowException`): throw exception on error.
1472 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1473 * At least the following PKCS #11 return values may be returned:
1474 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
1475 * \li FunctionFailed \li GeneralError \li HostMemory
1476 * \li OK
1477 * @return true on success, false otherwise
1478 */
1479 bool C_GetSlotList(Bbool token_present,
1480 SlotId* slot_list_ptr,
1481 Ulong* count_ptr,
1482 ReturnValue* return_value = ThrowException) const;
1483
1484 /**
1485 * C_GetSlotList obtains a list of slots in the system.
1486 * @param token_present only slots with tokens
1487 * @param slot_ids receives vector of slot IDs
1488 * @param return_value default value (`ThrowException`): throw exception on error.
1489 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1490 * At least the following PKCS #11 return values may be returned:
1491 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
1492 * \li FunctionFailed \li GeneralError \li HostMemory
1493 * \li OK
1494 * @return true on success, false otherwise
1495 */
1496 bool C_GetSlotList(bool token_present,
1497 std::vector<SlotId>& slot_ids,
1498 ReturnValue* return_value = ThrowException) const;
1499
1500 /**
1501 * C_GetSlotInfo obtains information about a particular slot in the system.
1502 * @param slot_id the ID of the slot
1503 * @param info_ptr receives the slot information
1504 * @param return_value default value (`ThrowException`): throw exception on error.
1505 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1506 * At least the following PKCS #11 return values may be returned:
1507 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
1508 * \li FunctionFailed \li GeneralError \li HostMemory
1509 * \li OK \li SlotIdInvalid
1510 * @return true on success, false otherwise
1511 */
1512 bool C_GetSlotInfo(SlotId slot_id, SlotInfo* info_ptr, ReturnValue* return_value = ThrowException) const;
1513
1514 /**
1515 * C_GetTokenInfo obtains information about a particular token in the system.
1516 * @param slot_id ID of the token's slot
1517 * @param info_ptr receives the token information
1518 * @param return_value default value (`ThrowException`): throw exception on error.
1519 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1520 * At least the following PKCS #11 return values may be returned:
1521 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1522 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1523 * \li HostMemory \li OK \li SlotIdInvalid
1524 * \li TokenNotPresent \li TokenNotRecognized \li ArgumentsBad
1525 * @return true on success, false otherwise
1526 */
1527 bool C_GetTokenInfo(SlotId slot_id, TokenInfo* info_ptr, ReturnValue* return_value = ThrowException) const;
1528
1529 /**
1530 * C_WaitForSlotEvent waits for a slot event (token insertion, removal, etc.) to occur.
1531 * @param flags blocking/nonblocking flag
1532 * @param slot_ptr location that receives the slot ID
1533 * @param reserved reserved. Should be nullptr
1534 * @param return_value default value (`ThrowException`): throw exception on error.
1535 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1536 * At least the following PKCS #11 return values may be returned:
1537 * \li ArgumentsBad \li CryptokiNotInitialized \li FunctionFailed
1538 * \li GeneralError \li HostMemory \li NoEvent
1539 * \li OK
1540 * @return true on success, false otherwise
1541 */
1543 SlotId* slot_ptr,
1544 void* reserved,
1545 ReturnValue* return_value = ThrowException) const;
1546
1547 /**
1548 * C_GetMechanismList obtains a list of mechanism types supported by a token.
1549 * @param slot_id ID of token's slot
1550 * @param mechanism_list_ptr gets mech. array
1551 * @param count_ptr gets # of mechs.
1552 * @param return_value default value (`ThrowException`): throw exception on error.
1553 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1554 * At least the following PKCS #11 return values may be returned:
1555 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
1556 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
1557 * \li GeneralError \li HostMemory \li OK
1558 * \li SlotIdInvalid \li TokenNotPresent \li TokenNotRecognized
1559 * \li ArgumentsBad
1560 * @return true on success, false otherwise
1561 */
1562 bool C_GetMechanismList(SlotId slot_id,
1563 MechanismType* mechanism_list_ptr,
1564 Ulong* count_ptr,
1565 ReturnValue* return_value = ThrowException) const;
1566
1567 /**
1568 * C_GetMechanismList obtains a list of mechanism types supported by a token.
1569 * @param slot_id ID of token's slot
1570 * @param mechanisms receives vector of supported mechanisms
1571 * @param return_value default value (`ThrowException`): throw exception on error.
1572 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1573 * At least the following PKCS #11 return values may be returned:
1574 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
1575 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
1576 * \li GeneralError \li HostMemory \li OK
1577 * \li SlotIdInvalid \li TokenNotPresent \li TokenNotRecognized
1578 * \li ArgumentsBad
1579 * @return true on success, false otherwise
1580 */
1581 bool C_GetMechanismList(SlotId slot_id,
1582 std::vector<MechanismType>& mechanisms,
1583 ReturnValue* return_value = ThrowException) const;
1584
1585 /**
1586 * C_GetMechanismInfo obtains information about a particular mechanism possibly supported by a token.
1587 * @param slot_id ID of the token's slot
1588 * @param type type of mechanism
1589 * @param info_ptr receives mechanism info
1590 * @param return_value default value (`ThrowException`): throw exception on error.
1591 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1592 * At least the following PKCS #11 return values may be returned:
1593 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1594 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1595 * \li HostMemory \li MechanismInvalid \li OK
1596 * \li SlotIdInvalid \li TokenNotPresent \li TokenNotRecognized
1597 * \li ArgumentsBad
1598 * @return true on success, false otherwise
1599 */
1600 bool C_GetMechanismInfo(SlotId slot_id,
1601 MechanismType type,
1602 MechanismInfo* info_ptr,
1603 ReturnValue* return_value = ThrowException) const;
1604
1605 /**
1606 * C_InitToken initializes a token.
1607 * @param slot_id ID of the token's slot
1608 * @param so_pin_ptr the SO's initial PIN
1609 * @param so_pin_len length in bytes of the SO_PIN
1610 * @param label_ptr 32-byte token label (blank padded)
1611 * @param return_value default value (`ThrowException`): throw exception on error.
1612 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1613 * At least the following PKCS #11 return values may be returned:
1614 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1615 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1616 * \li GeneralError \li HostMemory \li OK
1617 * \li PinIncorrect \li PinLocked \li SessionExists
1618 * \li SlotIdInvalid \li TokenNotPresent \li TokenNotRecognized
1619 * \li TokenWriteProtected \li ArgumentsBad
1620 * @return true on success, false otherwise
1621 */
1622 bool C_InitToken(SlotId slot_id,
1623 const Utf8Char* so_pin_ptr,
1624 Ulong so_pin_len,
1625 const Utf8Char* label_ptr,
1626 ReturnValue* return_value = ThrowException) const;
1627
1628 /**
1629 * C_InitToken initializes a token.
1630 * @param slot_id ID of the token's slot
1631 * @param so_pin the SO's initial PIN
1632 * @param label token label (at max 32 bytes long)
1633 * @param return_value default value (`ThrowException`): throw exception on error.
1634 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1635 * At least the following PKCS #11 return values may be returned:
1636 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1637 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1638 * \li GeneralError \li HostMemory \li OK
1639 * \li PinIncorrect \li PinLocked \li SessionExists
1640 * \li SlotIdInvalid \li TokenNotPresent \li TokenNotRecognized
1641 * \li TokenWriteProtected \li ArgumentsBad
1642 * @return true on success, false otherwise
1643 */
1644 template <typename TAlloc>
1645 bool C_InitToken(SlotId slot_id,
1646 const std::vector<uint8_t, TAlloc>& so_pin,
1647 std::string_view label,
1648 ReturnValue* return_value = ThrowException) const {
1649 std::string padded_label(label);
1650 if(label.size() < 32) {
1651 padded_label.insert(padded_label.end(), 32 - label.size(), ' ');
1652 }
1653
1654 return C_InitToken(slot_id,
1655 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(so_pin.data())),
1656 checked_ulong_cast(so_pin.size()),
1657 reinterpret_cast<Utf8Char*>(const_cast<char*>(padded_label.c_str())),
1658 return_value);
1659 }
1660
1661 /**
1662 * C_InitPIN initializes the normal user's PIN.
1663 * @param session the session's handle
1664 * @param pin_ptr the normal user's PIN
1665 * @param pin_len length in bytes of the PIN
1666 * @param return_value default value (`ThrowException`): throw exception on error.
1667 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1668 * At least the following PKCS #11 return values may be returned:
1669 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1670 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1671 * \li GeneralError \li HostMemory \li OK
1672 * \li PinInvalid \li PinLenRange \li SessionClosed
1673 * \li SessionReadOnly \li SessionHandleInvalid \li TokenWriteProtected
1674 * \li UserNotLoggedIn \li ArgumentsBad
1675 * @return true on success, false otherwise
1676 */
1677 bool C_InitPIN(SessionHandle session,
1678 const Utf8Char* pin_ptr,
1679 Ulong pin_len,
1680 ReturnValue* return_value = ThrowException) const;
1681
1682 /**
1683 * C_InitPIN initializes the normal user's PIN.
1684 * @param session the session's handle
1685 * @param pin the normal user's PIN
1686 * @param return_value default value (`ThrowException`): throw exception on error.
1687 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1688 * At least the following PKCS #11 return values may be returned:
1689 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1690 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1691 * \li GeneralError \li HostMemory \li OK
1692 * \li PinInvalid \li PinLenRange \li SessionClosed
1693 * \li SessionReadOnly \li SessionHandleInvalid \li TokenWriteProtected
1694 * \li UserNotLoggedIn \li ArgumentsBad
1695 * @return true on success, false otherwise
1696 */
1697 template <typename TAlloc>
1699 const std::vector<uint8_t, TAlloc>& pin,
1700 ReturnValue* return_value = ThrowException) const {
1701 return C_InitPIN(session,
1702 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(pin.data())),
1703 checked_ulong_cast(pin.size()),
1704 return_value);
1705 }
1706
1707 /**
1708 * C_SetPIN modifies the PIN of the user who is logged in.
1709 * @param session the session's handle
1710 * @param old_pin_ptr the old PIN
1711 * @param old_len length of the old PIN
1712 * @param new_pin_ptr the new PIN
1713 * @param new_len length of the new PIN
1714 * @param return_value default value (`ThrowException`): throw exception on error.
1715 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1716 * At least the following PKCS #11 return values may be returned:
1717 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1718 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1719 * \li GeneralError \li HostMemory \li OK
1720 * \li PinIncorrect \li PinInvalid \li PinLenRange
1721 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1722 * \li SessionReadOnly \li TokenWriteProtected \li ArgumentsBad
1723 * @return true on success, false otherwise
1724 */
1725 bool C_SetPIN(SessionHandle session,
1726 const Utf8Char* old_pin_ptr,
1727 Ulong old_len,
1728 const Utf8Char* new_pin_ptr,
1729 Ulong new_len,
1730 ReturnValue* return_value = ThrowException) const;
1731
1732 /**
1733 * C_SetPIN modifies the PIN of the user who is logged in.
1734 * @param session the session's handle
1735 * @param old_pin the old PIN
1736 * @param new_pin the new PIN
1737 * @param return_value default value (`ThrowException`): throw exception on error.
1738 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1739 * At least the following PKCS #11 return values may be returned:
1740 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1741 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1742 * \li GeneralError \li HostMemory \li OK
1743 * \li PinIncorrect \li PinInvalid \li PinLenRange
1744 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1745 * \li SessionReadOnly \li TokenWriteProtected \li ArgumentsBad
1746 * @return true on success, false otherwise
1747 */
1748 template <typename TAlloc>
1750 const std::vector<uint8_t, TAlloc>& old_pin,
1751 const std::vector<uint8_t, TAlloc>& new_pin,
1752 ReturnValue* return_value = ThrowException) const {
1753 return C_SetPIN(session,
1754 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(old_pin.data())),
1755 checked_ulong_cast(old_pin.size()),
1756 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(new_pin.data())),
1757 checked_ulong_cast(new_pin.size()),
1758 return_value);
1759 }
1760
1761 /****************************** Session management ******************************/
1762
1763 /**
1764 * C_OpenSession opens a session between an application and a token.
1765 * @param slot_id the slot's ID
1766 * @param flags from CK_SESSION_INFO
1767 * @param application passed to callback
1768 * @param notify callback function
1769 * @param session_ptr gets session handle
1770 * @param return_value default value (`ThrowException`): throw exception on error.
1771 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1772 * At least the following PKCS #11 return values may be returned:
1773 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1774 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1775 * \li HostMemory \li OK \li SessionCount
1776 * \li SessionParallelNotSupported \li SessionReadWriteSoExists \li SlotIdInvalid
1777 * \li TokenNotPresent \li TokenNotRecognized \li TokenWriteProtected
1778 * \li ArgumentsBad
1779 * @return true on success, false otherwise
1780 */
1781 bool C_OpenSession(SlotId slot_id,
1782 Flags flags,
1783 void* application,
1784 Notify notify,
1785 SessionHandle* session_ptr,
1786 ReturnValue* return_value = ThrowException) const;
1787
1788 /**
1789 * C_CloseSession closes a session between an application and a token.
1790 * @param session the session's handle
1791 * @param return_value default value (`ThrowException`): throw exception on error.
1792 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1793 * At least the following PKCS #11 return values may be returned:
1794 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1795 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1796 * \li HostMemory \li OK \li SessionClosed
1797 * \li SessionHandleInvalid
1798 * @return true on success, false otherwise
1799 */
1800 bool C_CloseSession(SessionHandle session, ReturnValue* return_value = ThrowException) const;
1801
1802 /**
1803 * C_CloseAllSessions closes all sessions with a token.
1804 * @param slot_id the token's slot
1805 * @param return_value default value (`ThrowException`): throw exception on error.
1806 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1807 * At least the following PKCS #11 return values may be returned:
1808 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1809 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1810 * \li HostMemory \li OK \li SlotIdInvalid
1811 * \li TokenNotPresent
1812 * @return true on success, false otherwise
1813 */
1814 bool C_CloseAllSessions(SlotId slot_id, ReturnValue* return_value = ThrowException) const;
1815
1816 /**
1817 * C_GetSessionInfo obtains information about the session.
1818 * @param session the session's handle
1819 * @param info_ptr receives session info
1820 * @param return_value default value (`ThrowException`): throw exception on error.
1821 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1822 * At least the following PKCS #11 return values may be returned:
1823 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1824 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1825 * \li HostMemory \li OK \li SessionClosed
1826 * \li SessionHandleInvalid \li ArgumentsBad
1827 * @return true on success, false otherwise
1828 */
1829 bool C_GetSessionInfo(SessionHandle session,
1830 SessionInfo* info_ptr,
1831 ReturnValue* return_value = ThrowException) const;
1832
1833 /**
1834 * C_SessionCancel terminates active session based operations.
1835 *
1836 * @param session the session's handle
1837 * @param flags flags control which sessions are cancelled
1838 * @param return_value default value (`ThrowException`): throw exception on error
1839 * @return true on success, false otherwise
1840 */
1841 bool C_SessionCancel(SessionHandle session, Flags flags, ReturnValue* return_value = ThrowException);
1842
1843 /**
1844 * C_GetOperationState obtains the state of the cryptographic operation in a session.
1845 * @param session session's handle
1846 * @param operation_state_ptr gets state
1847 * @param operation_state_len_ptr gets state length
1848 * @param return_value default value (`ThrowException`): throw exception on error.
1849 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1850 * At least the following PKCS #11 return values may be returned:
1851 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
1852 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
1853 * \li GeneralError \li HostMemory \li OK
1854 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
1855 * \li StateUnsaveable \li ArgumentsBad
1856 * @return true on success, false otherwise
1857 */
1859 Byte* operation_state_ptr,
1860 Ulong* operation_state_len_ptr,
1861 ReturnValue* return_value = ThrowException) const;
1862
1863 /**
1864 * C_SetOperationState restores the state of the cryptographic operation in a session.
1865 * @param session session's handle
1866 * @param operation_state_ptr holds state
1867 * @param operation_state_len holds state length
1868 * @param encryption_key en/decryption key
1869 * @param authentication_key sign/verify key
1870 * @param return_value default value (`ThrowException`): throw exception on error.
1871 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1872 * At least the following PKCS #11 return values may be returned:
1873 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1874 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1875 * \li HostMemory \li KeyChanged \li KeyNeeded
1876 * \li KeyNotNeeded \li OK \li SavedStateInvalid
1877 * \li SessionClosed \li SessionHandleInvalid \li ArgumentsBad
1878 * @return true on success, false otherwise
1879 */
1881 const Byte* operation_state_ptr,
1882 Ulong operation_state_len,
1883 ObjectHandle encryption_key,
1884 ObjectHandle authentication_key,
1885 ReturnValue* return_value = ThrowException) const;
1886
1887 /**
1888 * C_Login logs a user into a token.
1889 * @param session the session's handle
1890 * @param user_type the user type
1891 * @param pin_ptr the user's PIN
1892 * @param pin_len the length of the PIN
1893 * @param return_value default value (`ThrowException`): throw exception on error.
1894 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1895 * At least the following PKCS #11 return values may be returned:
1896 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
1897 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
1898 * \li FunctionFailed \li GeneralError \li HostMemory
1899 * \li OK \li OperationNotInitialized \li PinIncorrect
1900 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1901 * \li SessionReadOnlyExists \li UserAlreadyLoggedIn \li UserAnotherAlreadyLoggedIn
1902 * \li UserPinNotInitialized \li UserTooManyTypes \li UserTypeInvalid
1903 * @return true on success, false otherwise
1904 */
1905 bool C_Login(SessionHandle session,
1906 UserType user_type,
1907 const Utf8Char* pin_ptr,
1908 Ulong pin_len,
1909 ReturnValue* return_value = ThrowException) const;
1910
1911 /**
1912 * C_Login logs a user into a token.
1913 * @param session the session's handle
1914 * @param user_type the user type
1915 * @param pin the user or security officer's PIN
1916 * @param return_value default value (`ThrowException`): throw exception on error.
1917 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1918 * At least the following PKCS #11 return values may be returned:
1919 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
1920 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
1921 * \li FunctionFailed \li GeneralError \li HostMemory
1922 * \li OK \li OperationNotInitialized \li PinIncorrect
1923 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1924 * \li SessionReadOnlyExists \li UserAlreadyLoggedIn \li UserAnotherAlreadyLoggedIn
1925 * \li UserPinNotInitialized \li UserTooManyTypes \li UserTypeInvalid
1926 * @return true on success, false otherwise
1927 */
1928 template <typename TAlloc>
1930 UserType user_type,
1931 const std::vector<uint8_t, TAlloc>& pin,
1932 ReturnValue* return_value = ThrowException) const {
1933 return C_Login(session,
1934 user_type,
1935 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(pin.data())),
1936 checked_ulong_cast(pin.size()),
1937 return_value);
1938 }
1939
1940 /**
1941 * C_LoginUser logs a user into a token.
1942 *
1943 * @param session the session's handle
1944 * @param user_type the user type
1945 * @param pin_ptr the user's PIN
1946 * @param pin_len the length of the PIN
1947 * @param username_ptr the user's name
1948 * @param username_len the length of the user's name
1949 * @param return_value default value (`ThrowException`): throw exception on error
1950 * @return true on success, false otherwise
1951 */
1952 bool C_LoginUser(SessionHandle session,
1953 UserType user_type,
1954 const Utf8Char* pin_ptr,
1955 Ulong pin_len,
1956 const Utf8Char* username_ptr,
1957 Ulong username_len,
1958 ReturnValue* return_value = ThrowException);
1959
1960 /**
1961 * C_Logout logs a user out from a token.
1962 * @param session the session's handle
1963 * @param return_value default value (`ThrowException`): throw exception on error.
1964 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1965 * At least the following PKCS #11 return values may be returned:
1966 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1967 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1968 * \li HostMemory \li OK \li SessionClosed
1969 * \li SessionHandleInvalid \li UserNotLoggedIn
1970 * @return true on success, false otherwise
1971 */
1972 bool C_Logout(SessionHandle session, ReturnValue* return_value = ThrowException) const;
1973
1974 /**
1975 * C_GetSessionValidationFlags fetches the requested flags from the session. See
1976 * Validation indicators (section4.15.3.1) for meaning and semantics for these
1977 * flags. Applications are responsible for the appropriate locking to protect
1978 * session to get a meaningful result from this call.
1979 *
1980 * @param session the session's handle
1981 * @param type which state of flags
1982 * @param flags_ptr validation flags
1983 * @param return_value default value (`ThrowException`): throw exception on error
1984 * @return true on success, false otherwise
1985 */
1987 Ulong type,
1988 Flags* flags_ptr,
1989 ReturnValue* return_value = ThrowException);
1990
1991 /****************************** Object management functions ******************************/
1992
1993 /**
1994 * C_CreateObject creates a new object.
1995 * @param session the session's handle
1996 * @param attribute_template_ptr the object's template
1997 * @param count attributes in template
1998 * @param object_ptr gets new object's handle.
1999 * @param return_value default value (`ThrowException`): throw exception on error.
2000 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2001 * At least the following PKCS #11 return values may be returned:
2002 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
2003 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
2004 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2005 * \li DomainParamsInvalid \li FunctionFailed \li GeneralError
2006 * \li HostMemory \li OK \li PinExpired
2007 * \li SessionClosed \li SessionHandleInvalid \li SessionReadOnly
2008 * \li TemplateIncomplete \li TemplateInconsistent \li TokenWriteProtected
2009 * \li UserNotLoggedIn
2010 * @return true on success, false otherwise
2011 */
2012 bool C_CreateObject(SessionHandle session,
2013 Attribute* attribute_template_ptr,
2014 Ulong count,
2015 ObjectHandle* object_ptr,
2016 ReturnValue* return_value = ThrowException) const;
2017
2018 /**
2019 * C_CopyObject copies an object, creating a new object for the copy.
2020 * @param session the session's handle
2021 * @param object the object's handle
2022 * @param attribute_template_ptr template for new object
2023 * @param count attributes in template
2024 * @param new_object_ptr receives handle of copy
2025 * @param return_value default value (`ThrowException`): throw exception on error.
2026 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2027 * At least the following PKCS #11 return values may be returned:
2028 * \li ActionProhibited \li ArgumentsBad \li AttributeReadOnly
2029 * \li AttributeTypeInvalid \li AttributeValueInvalid \li CryptokiNotInitialized
2030 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2031 * \li FunctionFailed \li GeneralError \li HostMemory
2032 * \li ObjectHandleInvalid \li OK \li PinExpired
2033 * \li SessionClosed \li SessionHandleInvalid \li SessionReadOnly
2034 * \li TemplateInconsistent \li TokenWriteProtected \li UserNotLoggedIn
2035 * @return true on success, false otherwise
2036 */
2037 bool C_CopyObject(SessionHandle session,
2038 ObjectHandle object,
2039 Attribute* attribute_template_ptr,
2040 Ulong count,
2041 ObjectHandle* new_object_ptr,
2042 ReturnValue* return_value = ThrowException) const;
2043
2044 /**
2045 * C_DestroyObject destroys an object.
2046 * @param session the session's handle
2047 * @param object the object's handle
2048 * @param return_value default value (`ThrowException`): throw exception on error.
2049 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2050 * At least the following PKCS #11 return values may be returned:
2051 * \li ActionProhibited \li CryptokiNotInitialized \li DeviceError
2052 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2053 * \li GeneralError \li HostMemory \li ObjectHandleInvalid
2054 * \li OK \li PinExpired \li SessionClosed
2055 * \li SessionHandleInvalid \li SessionReadOnly \li TokenWriteProtected
2056 * @return true on success, false otherwise
2057 */
2058 bool C_DestroyObject(SessionHandle session,
2059 ObjectHandle object,
2060 ReturnValue* return_value = ThrowException) const;
2061
2062 /**
2063 * C_GetObjectSize gets the size of an object in bytes.
2064 * @param session the session's handle
2065 * @param object the object's handle
2066 * @param size_ptr receives size of object
2067 * @param return_value default value (`ThrowException`): throw exception on error.
2068 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2069 * At least the following PKCS #11 return values may be returned:
2070 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2071 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2072 * \li GeneralError \li HostMemory \li InformationSensitive
2073 * \li ObjectHandleInvalid \li OK \li SessionClosed
2074 * \li SessionHandleInvalid
2075 * @return true on success, false otherwise
2076 */
2077 bool C_GetObjectSize(SessionHandle session,
2078 ObjectHandle object,
2079 Ulong* size_ptr,
2080 ReturnValue* return_value = ThrowException) const;
2081
2082 /**
2083 * C_GetAttributeValue obtains the value of one or more object attributes.
2084 * @param session the session's handle
2085 * @param object the object's handle
2086 * @param attribute_template_ptr specifies attrs; gets vals
2087 * @param count attributes in template
2088 * @param return_value default value (`ThrowException`): throw exception on error.
2089 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2090 * At least the following PKCS #11 return values may be returned:
2091 * \li ArgumentsBad \li AttributeSensitive \li AttributeTypeInvalid
2092 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
2093 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2094 * \li GeneralError \li HostMemory \li ObjectHandleInvalid
2095 * \li OK \li SessionClosed \li SessionHandleInvalid
2096 * @return true on success, false otherwise
2097 */
2099 ObjectHandle object,
2100 Attribute* attribute_template_ptr,
2101 Ulong count,
2102 ReturnValue* return_value = ThrowException) const;
2103
2104 /**
2105 * C_GetAttributeValue obtains the value of one or more object attributes.
2106 * @param session the session's handle
2107 * @param object the object's handle
2108 * @param attribute_values specifies attrs; gets vals
2109 * @param return_value default value (`ThrowException`): throw exception on error.
2110 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2111 * At least the following PKCS #11 return values may be returned:
2112 * \li ArgumentsBad \li AttributeSensitive \li AttributeTypeInvalid
2113 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
2114 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2115 * \li GeneralError \li HostMemory \li ObjectHandleInvalid
2116 * \li OK \li SessionClosed \li SessionHandleInvalid
2117 * @return true on success, false otherwise
2118 */
2119 template <typename TAlloc>
2121 ObjectHandle object,
2122 std::map<AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
2123 ReturnValue* return_value = ThrowException) const {
2124 std::vector<Attribute> getter_template;
2125
2126 getter_template.reserve(attribute_values.size());
2127 for(const auto& entry : attribute_values) {
2128 getter_template.emplace_back(Attribute{static_cast<CK_ATTRIBUTE_TYPE>(entry.first), nullptr, 0});
2129 }
2130
2131 const bool success = C_GetAttributeValue(session,
2132 object,
2133 const_cast<Attribute*>(getter_template.data()),
2134 checked_ulong_cast(getter_template.size()),
2135 return_value);
2136
2137 if(!success) {
2138 return success;
2139 }
2140
2141 size_t i = 0;
2142 for(auto& entry : attribute_values) {
2143 entry.second.clear();
2144 entry.second.resize(getter_template.at(i).ulValueLen);
2145 getter_template.at(i).pValue = const_cast<uint8_t*>(entry.second.data());
2146 i++;
2147 }
2148
2149 return C_GetAttributeValue(session,
2150 object,
2151 const_cast<Attribute*>(getter_template.data()),
2152 checked_ulong_cast(getter_template.size()),
2153 return_value);
2154 }
2155
2156 /**
2157 * C_SetAttributeValue modifies the value of one or more object attributes.
2158 * @param session the session's handle
2159 * @param object the object's handle
2160 * @param attribute_template_ptr specifies attrs and values
2161 * @param count attributes in template
2162 * @param return_value default value (`ThrowException`): throw exception on error.
2163 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2164 * At least the following PKCS #11 return values may be returned:
2165 * \li ActionProhibited \li ArgumentsBad \li AttributeReadOnly
2166 * \li AttributeTypeInvalid \li AttributeValueInvalid \li CryptokiNotInitialized
2167 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2168 * \li FunctionFailed \li GeneralError \li HostMemory
2169 * \li ObjectHandleInvalid \li OK \li SessionClosed
2170 * \li SessionHandleInvalid \li SessionReadOnly \li TemplateInconsistent
2171 * \li TokenWriteProtected \li UserNotLoggedIn
2172 * @return true on success, false otherwise
2173 */
2175 ObjectHandle object,
2176 Attribute* attribute_template_ptr,
2177 Ulong count,
2178 ReturnValue* return_value = ThrowException) const;
2179
2180 /**
2181 * C_SetAttributeValue modifies the value of one or more object attributes.
2182 * @param session the session's handle
2183 * @param object the object's handle
2184 * @param attribute_values specifies attrs and values
2185 * @param return_value default value (`ThrowException`): throw exception on error.
2186 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2187 * At least the following PKCS #11 return values may be returned:
2188 * \li ActionProhibited \li ArgumentsBad \li AttributeReadOnly
2189 * \li AttributeTypeInvalid \li AttributeValueInvalid \li CryptokiNotInitialized
2190 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2191 * \li FunctionFailed \li GeneralError \li HostMemory
2192 * \li ObjectHandleInvalid \li OK \li SessionClosed
2193 * \li SessionHandleInvalid \li SessionReadOnly \li TemplateInconsistent
2194 * \li TokenWriteProtected \li UserNotLoggedIn
2195 * @return true on success, false otherwise
2196 */
2197 template <typename TAlloc>
2199 ObjectHandle object,
2200 std::map<AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
2201 ReturnValue* return_value = ThrowException) const {
2202 std::vector<Attribute> setter_template;
2203
2204 setter_template.reserve(attribute_values.size());
2205 for(auto& entry : attribute_values) {
2206 setter_template.emplace_back(Attribute{static_cast<CK_ATTRIBUTE_TYPE>(entry.first),
2207 entry.second.data(),
2208 checked_ulong_cast(entry.second.size())});
2209 }
2210
2211 return C_SetAttributeValue(session,
2212 object,
2213 const_cast<Attribute*>(setter_template.data()),
2214 checked_ulong_cast(setter_template.size()),
2215 return_value);
2216 }
2217
2218 /**
2219 * C_FindObjectsInit initializes a search for token and session objects that match a template.
2220 * @param session the session's handle
2221 * @param attribute_template_ptr attribute values to match
2222 * @param count attrs in search template
2223 * @param return_value default value (`ThrowException`): throw exception on error.
2224 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2225 * At least the following PKCS #11 return values may be returned:
2226 * \li ArgumentsBad \li AttributeTypeInvalid \li AttributeValueInvalid
2227 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
2228 * \li DeviceRemoved \li FunctionFailed \li GeneralError
2229 * \li HostMemory \li OK \li OperationActive
2230 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
2231 * @return true on success, false otherwise
2232 */
2233 bool C_FindObjectsInit(SessionHandle session,
2234 Attribute* attribute_template_ptr,
2235 Ulong count,
2236 ReturnValue* return_value = ThrowException) const;
2237
2238 /**
2239 * C_FindObjects continues a search for token and session objects that match a template, obtaining additional object handles.
2240 * @param session session's handle
2241 * @param object_ptr gets obj. handles
2242 * @param max_object_count max handles to get
2243 * @param object_count_ptr actual # returned
2244 * @param return_value default value (`ThrowException`): throw exception on error.
2245 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2246 * At least the following PKCS #11 return values may be returned:
2247 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2248 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2249 * \li GeneralError \li HostMemory \li OK
2250 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2251 * @return true on success, false otherwise
2252 */
2253 bool C_FindObjects(SessionHandle session,
2254 ObjectHandle* object_ptr,
2255 Ulong max_object_count,
2256 Ulong* object_count_ptr,
2257 ReturnValue* return_value = ThrowException) const;
2258
2259 /**
2260 * C_FindObjectsFinal finishes a search for token and session objects.
2261 * @param session the session's handle
2262 * @param return_value default value (`ThrowException`): throw exception on error.
2263 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2264 * At least the following PKCS #11 return values may be returned:
2265 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
2266 * \li DeviceRemoved \li FunctionFailed \li GeneralError
2267 * \li HostMemory \li OK \li OperationNotInitialized
2268 * \li SessionClosed \li SessionHandleInvalid
2269 * @return true on success, false otherwise
2270 */
2271 bool C_FindObjectsFinal(SessionHandle session, ReturnValue* return_value = ThrowException) const;
2272
2273 /****************************** Encryption functions ******************************/
2274
2275 /**
2276 * C_EncryptInit initializes an encryption operation.
2277 * @param session the session's handle
2278 * @param mechanism_ptr the encryption mechanism
2279 * @param key handle of encryption key
2280 * @param return_value default value (`ThrowException`): throw exception on error.
2281 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2282 * At least the following PKCS #11 return values may be returned:
2283 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
2284 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2285 * \li GeneralError \li HostMemory \li KeyFunctionNotPermitted
2286 * \li KeyHandleInvalid \li KeySizeRange \li KeyTypeInconsistent
2287 * \li MechanismInvalid \li MechanismParamInvalid \li OK
2288 * \li OperationActive \li PinExpired \li SessionClosed
2289 * \li SessionHandleInvalid \li UserNotLoggedIn
2290 * @return true on success, false otherwise
2291 */
2292 bool C_EncryptInit(SessionHandle session,
2293 const Mechanism* mechanism_ptr,
2294 ObjectHandle key,
2295 ReturnValue* return_value = ThrowException) const;
2296
2297 /**
2298 * C_Encrypt encrypts single-part data.
2299 * @param session session's handle
2300 * @param data_ptr the plaintext data
2301 * @param data_len size of plaintext data in bytes
2302 * @param encrypted_data gets ciphertext
2303 * @param encrypted_data_len_ptr gets c-text size
2304 * @param return_value default value (`ThrowException`): throw exception on error.
2305 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2306 * At least the following PKCS #11 return values may be returned:
2307 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2308 * \li DataInvalid \li DataLenRange \li DeviceError
2309 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2310 * \li FunctionFailed \li GeneralError \li HostMemory
2311 * \li OK \li OperationNotInitialized \li SessionClosed
2312 * \li SessionHandleInvalid
2313 * @return true on success, false otherwise
2314 */
2315 bool C_Encrypt(SessionHandle session,
2316 const Byte* data_ptr,
2317 Ulong data_len,
2318 Byte* encrypted_data,
2319 Ulong* encrypted_data_len_ptr,
2320 ReturnValue* return_value = ThrowException) const;
2321
2322 /**
2323 * C_Encrypt encrypts single-part data.
2324 * @param session session's handle
2325 * @param plaintext_data the plaintext data
2326 * @param encrypted_data gets ciphertext
2327 * @param return_value default value (`ThrowException`): throw exception on error.
2328 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2329 * At least the following PKCS #11 return values may be returned:
2330 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2331 * \li DataInvalid \li DataLenRange \li DeviceError
2332 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2333 * \li FunctionFailed \li GeneralError \li HostMemory
2334 * \li OK \li OperationNotInitialized \li SessionClosed
2335 * \li SessionHandleInvalid
2336 * @return true on success, false otherwise
2337 */
2338 template <typename TAllocA, typename TAllocB>
2340 const std::vector<uint8_t, TAllocA>& plaintext_data,
2341 std::vector<uint8_t, TAllocB>& encrypted_data,
2342 ReturnValue* return_value = ThrowException) const {
2343 Ulong encrypted_size = 0;
2344 if(!C_Encrypt(session,
2345 const_cast<Byte*>((plaintext_data.data())),
2346 checked_ulong_cast(plaintext_data.size()),
2347 nullptr,
2348 &encrypted_size,
2349 return_value)) {
2350 return false;
2351 }
2352
2353 encrypted_data.resize(encrypted_size);
2354 if(!C_Encrypt(session,
2355 const_cast<Byte*>(plaintext_data.data()),
2356 checked_ulong_cast(plaintext_data.size()),
2357 encrypted_data.data(),
2358 &encrypted_size,
2359 return_value)) {
2360 return false;
2361 }
2362 encrypted_data.resize(encrypted_size);
2363 return true;
2364 }
2365
2366 /**
2367 * C_EncryptUpdate continues a multiple-part encryption operation.
2368 * @param session session's handle
2369 * @param part_ptr the plaintext data
2370 * @param part_len plaintext data len
2371 * @param encrypted_part_ptr gets ciphertext
2372 * @param encrypted_part_len_ptr gets c-text size
2373 * @param return_value default value (`ThrowException`): throw exception on error.
2374 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2375 * At least the following PKCS #11 return values may be returned:
2376 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2377 * \li DataLenRange \li DeviceError \li DeviceMemory
2378 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2379 * \li GeneralError \li HostMemory \li OK
2380 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2381 * @return true on success, false otherwise
2382 */
2383 bool C_EncryptUpdate(SessionHandle session,
2384 const Byte* part_ptr,
2385 Ulong part_len,
2386 Byte* encrypted_part_ptr,
2387 Ulong* encrypted_part_len_ptr,
2388 ReturnValue* return_value = ThrowException) const;
2389
2390 /**
2391 * C_EncryptFinal finishes a multiple-part encryption operation.
2392 * @param session session handle
2393 * @param last_encrypted_part_ptr last c-text
2394 * @param last_encrypted_part_len_ptr gets last size
2395 * @param return_value default value (`ThrowException`): throw exception on error.
2396 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2397 * At least the following PKCS #11 return values may be returned:
2398 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2399 * \li DataLenRange \li DeviceError \li DeviceMemory
2400 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2401 * \li GeneralError \li HostMemory \li OK
2402 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2403 * @return true on success, false otherwise
2404 */
2405 bool C_EncryptFinal(SessionHandle session,
2406 Byte* last_encrypted_part_ptr,
2407 Ulong* last_encrypted_part_len_ptr,
2408 ReturnValue* return_value = ThrowException) const;
2409
2410 /*********************** Message-based encryption functions ***********************/
2411
2412 /**
2413 * C_MessageEncryptInit prepares a session for one or more encryption
2414 * operations that use the same encryption mechanism and
2415 * encryption key.
2416 *
2417 * @param session the session's handle
2418 * @param mechanism_ptr the encryption mechanism
2419 * @param key handle of encryption key
2420 * @param return_value default value (`ThrowException`): throw exception on error
2421 * @return true on success, false otherwise
2422 */
2424 const Mechanism* mechanism_ptr,
2425 ObjectHandle key,
2426 ReturnValue* return_value = ThrowException);
2427
2428 /**
2429 * C_EncryptMessage encrypts a message in a single part.
2430 *
2431 * @param session the session's handle
2432 * @param parameter_ptr message specific parameter
2433 * @param parameter_len length of message specific parameter
2434 * @param associated_data_ptr AEAD Associated data
2435 * @param associated_data_len AEAD Associated data length
2436 * @param plaintext_ptr plain text
2437 * @param plaintext_len plain text length
2438 * @param ciphertext_ptr gets cipher text
2439 * @param ciphertext_len_ptr gets cipher text length
2440 * @param return_value default value (`ThrowException`): throw exception on error
2441 * @return true on success, false otherwise
2442 */
2443 bool C_EncryptMessage(SessionHandle session,
2444 const void* parameter_ptr,
2445 Ulong parameter_len,
2446 const Byte* associated_data_ptr,
2447 Ulong associated_data_len,
2448 const Byte* plaintext_ptr,
2449 Ulong plaintext_len,
2450 Byte* ciphertext_ptr,
2451 Ulong* ciphertext_len_ptr,
2452 ReturnValue* return_value = ThrowException);
2453
2454 /**
2455 * C_EncryptMessageBegin begins a multiple-part message encryption operation.
2456 *
2457 * @param session the session's handle
2458 * @param parameter_ptr message specific parameter
2459 * @param parameter_len length of message specific parameter
2460 * @param associated_data_ptr AEAD Associated data
2461 * @param associated_data_len AEAD Associated data length
2462 * @param return_value default value (`ThrowException`): throw exception on error
2463 * @return true on success, false otherwise
2464 */
2466 const void* parameter_ptr,
2467 Ulong parameter_len,
2468 const Byte* associated_data_ptr,
2469 Ulong associated_data_len,
2470 ReturnValue* return_value = ThrowException);
2471
2472 /**
2473 * C_EncryptMessageNext continues a multiple-part message encryption operation,
2474 * processing another message part.
2475 *
2476 * @param session the session's handle
2477 * @param parameter_ptr message specific parameter
2478 * @param parameter_len length of message specific parameter
2479 * @param plaintext_part_ptr plain text
2480 * @param plaintext_part_len plain text length
2481 * @param ciphertext_ptr gets cipher text
2482 * @param ciphertext_part_len_ptr gets cipher text length
2483 * @param flags multi mode flag
2484 * @param return_value default value (`ThrowException`): throw exception on error
2485 * @return true on success, false otherwise
2486 */
2488 const void* parameter_ptr,
2489 Ulong parameter_len,
2490 const Byte* plaintext_part_ptr,
2491 Ulong plaintext_part_len,
2492 Byte* ciphertext_ptr,
2493 Ulong* ciphertext_part_len_ptr,
2494 Flags flags,
2495 ReturnValue* return_value = ThrowException);
2496
2497 /**
2498 * C_MessageDecryptFinal finishes a message-based decryption process.
2499 *
2500 * @param session the session's handle
2501 * @param return_value default value (`ThrowException`): throw exception on error
2502 * @return true on success, false otherwise
2503 */
2504 bool C_MessageEncryptFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
2505
2506 /****************************** Decryption functions ******************************/
2507
2508 /**
2509 * C_DecryptInit initializes a decryption operation.
2510 * @param session the session's handle
2511 * @param mechanism_ptr the decryption mechanism
2512 * @param key handle of decryption key
2513 * @param return_value default value (`ThrowException`): throw exception on error.
2514 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2515 * At least the following PKCS #11 return values may be returned:
2516 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2517 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2518 * \li FunctionFailed \li GeneralError \li HostMemory
2519 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
2520 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
2521 * \li OK \li OperationActive \li PinExpired
2522 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2523 * @return true on success, false otherwise
2524 */
2525 bool C_DecryptInit(SessionHandle session,
2526 const Mechanism* mechanism_ptr,
2527 ObjectHandle key,
2528 ReturnValue* return_value = ThrowException) const;
2529
2530 /**
2531 * C_Decrypt decrypts encrypted data in a single part.
2532 * @param session session's handle
2533 * @param encrypted_data_ptr ciphertext
2534 * @param encrypted_data_len ciphertext length
2535 * @param data_ptr gets plaintext
2536 * @param data_len_ptr gets p-text size
2537 * @param return_value default value (`ThrowException`): throw exception on error.
2538 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2539 * At least the following PKCS #11 return values may be returned:
2540 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2541 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2542 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2543 * \li FunctionFailed \li GeneralError \li HostMemory
2544 * \li OK \li OperationNotInitialized \li SessionClosed
2545 * \li SessionHandleInvalid \li UserNotLoggedIn
2546 * @return true on success, false otherwise
2547 */
2548 bool C_Decrypt(SessionHandle session,
2549 const Byte* encrypted_data_ptr,
2550 Ulong encrypted_data_len,
2551 Byte* data_ptr,
2552 Ulong* data_len_ptr,
2553 ReturnValue* return_value = ThrowException) const;
2554
2555 /**
2556 * C_Decrypt decrypts encrypted data in a single part.
2557 * @param session session's handle
2558 * @param encrypted_data ciphertext
2559 * @param decrypted_data gets plaintext
2560 * @param return_value default value (`ThrowException`): throw exception on error.
2561 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2562 * At least the following PKCS #11 return values may be returned:
2563 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2564 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2565 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2566 * \li FunctionFailed \li GeneralError \li HostMemory
2567 * \li OK \li OperationNotInitialized \li SessionClosed
2568 * \li SessionHandleInvalid \li UserNotLoggedIn
2569 * @return true on success, false otherwise
2570 */
2571 template <typename TAllocA, typename TAllocB>
2573 const std::vector<uint8_t, TAllocA>& encrypted_data,
2574 std::vector<uint8_t, TAllocB>& decrypted_data,
2575 ReturnValue* return_value = ThrowException) const {
2576 Ulong decrypted_size = 0;
2577 if(!C_Decrypt(session,
2578 const_cast<Byte*>((encrypted_data.data())),
2579 checked_ulong_cast(encrypted_data.size()),
2580 nullptr,
2581 &decrypted_size,
2582 return_value)) {
2583 return false;
2584 }
2585
2586 decrypted_data.resize(decrypted_size);
2587 if(!C_Decrypt(session,
2588 const_cast<Byte*>(encrypted_data.data()),
2589 checked_ulong_cast(encrypted_data.size()),
2590 decrypted_data.data(),
2591 &decrypted_size,
2592 return_value)) {
2593 return false;
2594 }
2595 decrypted_data.resize(decrypted_size);
2596 return true;
2597 }
2598
2599 /**
2600 * C_DecryptUpdate continues a multiple-part decryption operation.
2601 * @param session session's handle
2602 * @param encrypted_part_ptr encrypted data
2603 * @param encrypted_part_len input length
2604 * @param part_ptr gets plaintext
2605 * @param part_len_ptr p-text size
2606 * @param return_value default value (`ThrowException`): throw exception on error.
2607 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2608 * At least the following PKCS #11 return values may be returned:
2609 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2610 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2611 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2612 * \li FunctionFailed \li GeneralError \li HostMemory
2613 * \li OK \li OperationNotInitialized \li SessionClosed
2614 * \li SessionHandleInvalid \li UserNotLoggedIn
2615 * @return true on success, false otherwise
2616 */
2617 bool C_DecryptUpdate(SessionHandle session,
2618 const Byte* encrypted_part_ptr,
2619 Ulong encrypted_part_len,
2620 Byte* part_ptr,
2621 Ulong* part_len_ptr,
2622 ReturnValue* return_value = ThrowException) const;
2623
2624 /**
2625 * C_DecryptFinal finishes a multiple-part decryption operation.
2626 * @param session the session's handle
2627 * @param last_part_ptr gets plaintext
2628 * @param last_part_len_ptr p-text size
2629 * @param return_value default value (`ThrowException`): throw exception on error.
2630 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2631 * At least the following PKCS #11 return values may be returned:
2632 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2633 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2634 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2635 * \li FunctionFailed \li GeneralError \li HostMemory
2636 * \li OK \li OperationNotInitialized \li SessionClosed
2637 * \li SessionHandleInvalid \li UserNotLoggedIn
2638 * @return true on success, false otherwise
2639 */
2640 bool C_DecryptFinal(SessionHandle session,
2641 Byte* last_part_ptr,
2642 Ulong* last_part_len_ptr,
2643 ReturnValue* return_value = ThrowException) const;
2644
2645 /*********************** Message-based decryption functions ***********************/
2646
2647 /**
2648 * C_MessageDecryptInit initializes a message-based decryption process,
2649 * preparing a session for one or more decryption operations that use the
2650 * same decryption mechanism and decryption key.
2651 *
2652 * @param session the session's handle
2653 * @param mechanism_ptr the decryption mechanism
2654 * @param key handle of decryption key
2655 * @param return_value default value (`ThrowException`): throw exception on error
2656 * @return true on success, false otherwise
2657 */
2659 const Mechanism* mechanism_ptr,
2660 ObjectHandle key,
2661 ReturnValue* return_value = ThrowException);
2662
2663 /**
2664 * C_DecryptMessage decrypts an encrypted message in a single part.
2665 *
2666 * @param session the session's handle
2667 * @param parameter_ptr message specific parameter
2668 * @param parameter_len length of message specific parameter
2669 * @param associated_data_ptr AEAD Associated data
2670 * @param associated_data_len AEAD Associated data length
2671 * @param ciphertext_ptr cipher text
2672 * @param ciphertext_len cipher text length
2673 * @param plaintext_ptr gets plain text
2674 * @param plaintext_len_ptr gets plain text length
2675 * @param return_value default value (`ThrowException`): throw exception on error
2676 * @return true on success, false otherwise
2677 */
2678 bool C_DecryptMessage(SessionHandle session,
2679 const void* parameter_ptr,
2680 Ulong parameter_len,
2681 const Byte* associated_data_ptr,
2682 Ulong associated_data_len,
2683 const Byte* ciphertext_ptr,
2684 Ulong ciphertext_len,
2685 Byte* plaintext_ptr,
2686 Ulong* plaintext_len_ptr,
2687 ReturnValue* return_value = ThrowException);
2688
2689 /**
2690 * C_DecryptMessageBegin begins a multiple-part message decryption operation.
2691 *
2692 * @param session the session's handle
2693 * @param parameter_ptr message specific parameter
2694 * @param parameter_len length of message specific parameter
2695 * @param associated_data_ptr AEAD Associated data
2696 * @param associated_data_len AEAD Associated data length
2697 * @param return_value default value (`ThrowException`): throw exception on error
2698 * @return true on success, false otherwise
2699 */
2701 const void* parameter_ptr,
2702 Ulong parameter_len,
2703 const Byte* associated_data_ptr,
2704 Ulong associated_data_len,
2705 ReturnValue* return_value = ThrowException);
2706
2707 /**
2708 * C_DecryptMessageNext continues a multiple-part message decryption operation,
2709 * processing another encrypted message part.
2710 *
2711 * @param session the session's handle
2712 * @param parameter_ptr message specific parameter
2713 * @param parameter_len length of message specific parameter
2714 * @param ciphertext_part_ptr cipher text
2715 * @param ciphertext_part_len cipher text length
2716 * @param plaintext_ptr gets plain text
2717 * @param plaintext_part_len_ptr gets plain text length
2718 * @param flags multi mode flag
2719 * @param return_value default value (`ThrowException`): throw exception on error
2720 * @return true on success, false otherwise
2721 */
2723 const void* parameter_ptr,
2724 Ulong parameter_len,
2725 const Byte* ciphertext_part_ptr,
2726 Ulong ciphertext_part_len,
2727 Byte* plaintext_ptr,
2728 Ulong* plaintext_part_len_ptr,
2729 Flags flags,
2730 ReturnValue* return_value = ThrowException);
2731
2732 /**
2733 * C_MessageDecryptFinal finishes a message-based decryption process.
2734 *
2735 * @param session the session's handle
2736 * @param return_value default value (`ThrowException`): throw exception on error
2737 * @return true on success, false otherwise
2738 */
2739 bool C_MessageDecryptFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
2740
2741 /****************************** Message digesting functions ******************************/
2742
2743 /**
2744 * C_DigestInit initializes a message-digesting operation.
2745 * @param session the session's handle
2746 * @param mechanism_ptr the digesting mechanism
2747 * @param return_value default value (`ThrowException`): throw exception on error.
2748 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2749 * At least the following PKCS #11 return values may be returned:
2750 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2751 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2752 * \li FunctionFailed \li GeneralError \li HostMemory
2753 * \li MechanismInvalid \li MechanismParamInvalid \li OK
2754 * \li OperationActive \li PinExpired \li SessionClosed
2755 * \li SessionHandleInvalid \li UserNotLoggedIn
2756 * @return true on success, false otherwise
2757 */
2758 bool C_DigestInit(SessionHandle session,
2759 const Mechanism* mechanism_ptr,
2760 ReturnValue* return_value = ThrowException) const;
2761
2762 /**
2763 * C_Digest digests data in a single part.
2764 * @param session the session's handle
2765 * @param data_ptr data to be digested
2766 * @param data_len bytes of data to digest
2767 * @param digest_ptr gets the message digest
2768 * @param digest_len_ptr gets digest length
2769 * @param return_value default value (`ThrowException`): throw exception on error.
2770 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2771 * At least the following PKCS #11 return values may be returned:
2772 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2773 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2774 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2775 * \li HostMemory \li OK \li OperationNotInitialized
2776 * \li SessionClosed \li SessionHandleInvalid
2777 * @return true on success, false otherwise
2778 */
2779 bool C_Digest(SessionHandle session,
2780 const Byte* data_ptr,
2781 Ulong data_len,
2782 Byte* digest_ptr,
2783 Ulong* digest_len_ptr,
2784 ReturnValue* return_value = ThrowException) const;
2785
2786 /**
2787 * C_DigestUpdate continues a multiple-part message-digesting operation.
2788 * @param session the session's handle
2789 * @param part_ptr data to be digested
2790 * @param part_len bytes of data to be digested
2791 * @param return_value default value (`ThrowException`): throw exception on error.
2792 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2793 * At least the following PKCS #11 return values may be returned:
2794 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2795 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2796 * \li FunctionFailed \li GeneralError \li HostMemory
2797 * \li OK \li OperationNotInitialized \li SessionClosed
2798 * \li SessionHandleInvalid
2799 * @return true on success, false otherwise
2800 */
2801 bool C_DigestUpdate(SessionHandle session,
2802 const Byte* part_ptr,
2803 Ulong part_len,
2804 ReturnValue* return_value = ThrowException) const;
2805
2806 /**
2807 * C_DigestKey continues a multi-part message-digesting operation, by digesting the value of a secret key as part of the data already digested.
2808 * @param session the session's handle
2809 * @param key secret key to digest
2810 * @param return_value default value (`ThrowException`): throw exception on error.
2811 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2812 * At least the following PKCS #11 return values may be returned:
2813 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
2814 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2815 * \li GeneralError \li HostMemory \li KeyHandleInvalid
2816 * \li KeyIndigestible \li KeySizeRange \li OK
2817 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2818 * @return true on success, false otherwise
2819 */
2820 bool C_DigestKey(SessionHandle session, ObjectHandle key, ReturnValue* return_value = ThrowException) const;
2821
2822 /**
2823 * C_DigestFinal finishes a multiple-part message-digesting operation.
2824 * @param session the session's handle
2825 * @param digest_ptr gets the message digest
2826 * @param digest_len_ptr gets uint8_t count of digest
2827 * @param return_value default value (`ThrowException`): throw exception on error.
2828 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2829 * At least the following PKCS #11 return values may be returned:
2830 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2831 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2832 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2833 * \li HostMemory \li OK \li OperationNotInitialized
2834 * \li SessionClosed \li SessionHandleInvalid
2835 * @return true on success, false otherwise
2836 */
2837 bool C_DigestFinal(SessionHandle session,
2838 Byte* digest_ptr,
2839 Ulong* digest_len_ptr,
2840 ReturnValue* return_value = ThrowException) const;
2841
2842 /****************************** Signing and MACing functions ******************************/
2843
2844 /**
2845 * C_SignInit initializes a signature (private key encryption) operation, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.
2846 * @param session the session's handle
2847 * @param mechanism_ptr the signature mechanism
2848 * @param key handle of signature key
2849 * @param return_value default value (`ThrowException`): throw exception on error.
2850 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2851 * At least the following PKCS #11 return values may be returned:
2852 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2853 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2854 * \li FunctionFailed \li GeneralError \li HostMemory
2855 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
2856 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
2857 * \li OK \li OperationActive \li PinExpired
2858 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2859 * @return true on success, false otherwise
2860 */
2861 bool C_SignInit(SessionHandle session,
2862 const Mechanism* mechanism_ptr,
2863 ObjectHandle key,
2864 ReturnValue* return_value = ThrowException) const;
2865
2866 /**
2867 * C_Sign signs (encrypts with private key) data in a single part, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.
2868 * @param session the session's handle
2869 * @param data_ptr the data to sign
2870 * @param data_len count of bytes to sign
2871 * @param signature_ptr gets the signature
2872 * @param signature_len_ptr gets signature length
2873 * @param return_value default value (`ThrowException`): throw exception on error.
2874 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2875 * At least the following PKCS #11 return values may be returned:
2876 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2877 * \li DataInvalid \li DataLenRange \li DeviceError
2878 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2879 * \li FunctionFailed \li GeneralError \li HostMemory
2880 * \li OK \li OperationNotInitialized \li SessionClosed
2881 * \li SessionHandleInvalid \li UserNotLoggedIn \li FunctionRejected
2882 * @return true on success, false otherwise
2883 */
2884 bool C_Sign(SessionHandle session,
2885 const Byte* data_ptr,
2886 Ulong data_len,
2887 Byte* signature_ptr,
2888 Ulong* signature_len_ptr,
2889 ReturnValue* return_value = ThrowException) const;
2890
2891 /**
2892 * C_Sign signs (encrypts with private key) data in a single part, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.
2893 * @param session the session's handle
2894 * @param data the data to sign
2895 * @param signature gets the signature
2896 * @param return_value default value (`ThrowException`): throw exception on error.
2897 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2898 * At least the following PKCS #11 return values may be returned:
2899 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2900 * \li DataInvalid \li DataLenRange \li DeviceError
2901 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2902 * \li FunctionFailed \li GeneralError \li HostMemory
2903 * \li OK \li OperationNotInitialized \li SessionClosed
2904 * \li SessionHandleInvalid \li UserNotLoggedIn \li FunctionRejected
2905 * @return true on success, false otherwise
2906 */
2907 template <typename TAllocA, typename TAllocB>
2908 bool C_Sign(SessionHandle session,
2909 const std::vector<uint8_t, TAllocA>& data,
2910 std::vector<uint8_t, TAllocB>& signature,
2911 ReturnValue* return_value = ThrowException) const {
2912 Ulong signature_size = 0;
2913 if(!C_Sign(session, data.data(), checked_ulong_cast(data.size()), nullptr, &signature_size, return_value)) {
2914 return false;
2915 }
2916
2917 signature.resize(signature_size);
2918 if(!C_Sign(session,
2919 data.data(),
2920 checked_ulong_cast(data.size()),
2921 signature.data(),
2922 &signature_size,
2923 return_value)) {
2924 return false;
2925 }
2926 signature.resize(signature_size);
2927 return true;
2928 }
2929
2930 /**
2931 * C_SignUpdate continues a multiple-part signature operation, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.
2932 * @param session the session's handle
2933 * @param part_ptr the data to sign
2934 * @param part_len count of bytes to sign
2935 * @param return_value default value (`ThrowException`): throw exception on error.
2936 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2937 * At least the following PKCS #11 return values may be returned:
2938 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
2939 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2940 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2941 * \li HostMemory \li OK \li OperationNotInitialized
2942 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2943 * @return true on success, false otherwise
2944 */
2945 bool C_SignUpdate(SessionHandle session,
2946 const Byte* part_ptr,
2947 Ulong part_len,
2948 ReturnValue* return_value = ThrowException) const;
2949
2950 /**
2951 * C_SignUpdate continues a multiple-part signature operation, where the signature is (will be) an appendix to the data, and plaintext cannot be recovered from the signature.
2952 * @param session the session's handle
2953 * @param part the data to sign
2954 * @param return_value default value (`ThrowException`): throw exception on error.
2955 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2956 * At least the following PKCS #11 return values may be returned:
2957 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
2958 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2959 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2960 * \li HostMemory \li OK \li OperationNotInitialized
2961 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2962 * @return true on success, false otherwise
2963 */
2964 template <typename TAlloc>
2966 const std::vector<uint8_t, TAlloc>& part,
2967 ReturnValue* return_value = ThrowException) const {
2968 return C_SignUpdate(session, part.data(), checked_ulong_cast(part.size()), return_value);
2969 }
2970
2971 /**
2972 * C_SignFinal finishes a multiple-part signature operation, returning the signature.
2973 * @param session the session's handle
2974 * @param signature_ptr gets the signature
2975 * @param signature_len_ptr gets signature length
2976 * @param return_value default value (`ThrowException`): throw exception on error.
2977 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2978 * At least the following PKCS #11 return values may be returned:
2979 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2980 * \li DataLenRange \li DeviceError \li DeviceMemory
2981 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2982 * \li GeneralError \li HostMemory \li OK
2983 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2984 * \li UserNotLoggedIn \li FunctionRejected
2985 * @return true on success, false otherwise
2986 */
2987 bool C_SignFinal(SessionHandle session,
2988 Byte* signature_ptr,
2989 Ulong* signature_len_ptr,
2990 ReturnValue* return_value = ThrowException) const;
2991
2992 /**
2993 * C_SignFinal finishes a multiple-part signature operation, returning the signature.
2994 * @param session the session's handle
2995 * @param signature gets the signature
2996 * @param return_value default value (`ThrowException`): throw exception on error.
2997 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2998 * At least the following PKCS #11 return values may be returned:
2999 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3000 * \li DataLenRange \li DeviceError \li DeviceMemory
3001 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3002 * \li GeneralError \li HostMemory \li OK
3003 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3004 * \li UserNotLoggedIn \li FunctionRejected
3005 * @return true on success, false otherwise
3006 */
3007 template <typename TAlloc>
3009 std::vector<uint8_t, TAlloc>& signature,
3010 ReturnValue* return_value = ThrowException) const {
3011 Ulong signature_size = 0;
3012 if(!C_SignFinal(session, nullptr, &signature_size, return_value)) {
3013 return false;
3014 }
3015
3016 signature.resize(signature_size);
3017 if(!C_SignFinal(session, signature.data(), &signature_size, return_value)) {
3018 return false;
3019 }
3020 signature.resize(signature_size);
3021 return true;
3022 }
3023
3024 /**
3025 * C_SignRecoverInit initializes a signature operation, where the data can be recovered from the signature.
3026 * @param session the session's handle
3027 * @param mechanism_ptr the signature mechanism
3028 * @param key handle of the signature key
3029 * @param return_value default value (`ThrowException`): throw exception on error.
3030 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3031 * At least the following PKCS #11 return values may be returned:
3032 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3033 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3034 * \li FunctionFailed \li GeneralError \li HostMemory
3035 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
3036 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
3037 * \li OK \li OperationActive \li PinExpired
3038 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3039 * @return true on success, false otherwise
3040 */
3041 bool C_SignRecoverInit(SessionHandle session,
3042 const Mechanism* mechanism_ptr,
3043 ObjectHandle key,
3044 ReturnValue* return_value = ThrowException) const;
3045
3046 /**
3047 * C_SignRecover signs data in a single operation, where the data can be recovered from the signature.
3048 * @param session the session's handle
3049 * @param data_ptr the data to sign
3050 * @param data_len count of bytes to sign
3051 * @param signature_ptr gets the signature
3052 * @param signature_len_ptr gets signature length
3053 * @param return_value default value (`ThrowException`): throw exception on error.
3054 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3055 * At least the following PKCS #11 return values may be returned:
3056 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3057 * \li DataInvalid \li DataLenRange \li DeviceError
3058 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3059 * \li FunctionFailed \li GeneralError \li HostMemory
3060 * \li OK \li OperationNotInitialized \li SessionClosed
3061 * \li SessionHandleInvalid \li UserNotLoggedIn
3062 * @return true on success, false otherwise
3063 */
3064 bool C_SignRecover(SessionHandle session,
3065 const Byte* data_ptr,
3066 Ulong data_len,
3067 Byte* signature_ptr,
3068 Ulong* signature_len_ptr,
3069 ReturnValue* return_value = ThrowException) const;
3070
3071 /******************* Message-based signing and MACing functions *******************/
3072
3073 /**
3074 * C_MessageSignInit initializes a message-based signature process, preparing a
3075 * session for one or more signature operations (where the signature is an
3076 * appendix to the data) that use the same signature mechanism and
3077 * signature key.
3078 *
3079 * @param session the session's handle
3080 * @param mechanism_ptr the signing mechanism
3081 * @param key handle of signing key
3082 * @param return_value default value (`ThrowException`): throw exception on error
3083 * @return true on success, false otherwise
3084 */
3085 bool C_MessageSignInit(SessionHandle session,
3086 const Mechanism* mechanism_ptr,
3087 ObjectHandle key,
3088 ReturnValue* return_value = ThrowException);
3089
3090 /**
3091 * C_SignMessage signs a message in a single part, where the signature is an
3092 * appendix to the message. C_MessageSignInit must previously been called
3093 * on the session.
3094 *
3095 * @param session the session's handle
3096 * @param parameter_ptr message specific parameter
3097 * @param parameter_len length of message specific parameter
3098 * @param data_ptr data to sign
3099 * @param data_len data to sign length
3100 * @param signature_ptr gets signature
3101 * @param signature_len_ptr gets signature length
3102 * @param return_value default value (`ThrowException`): throw exception on error
3103 * @return true on success, false otherwise
3104 */
3105 bool C_SignMessage(SessionHandle session,
3106 const void* parameter_ptr,
3107 Ulong parameter_len,
3108 const Byte* data_ptr,
3109 Ulong data_len,
3110 Byte* signature_ptr,
3111 Ulong* signature_len_ptr,
3112 ReturnValue* return_value = ThrowException);
3113
3114 /**
3115 * C_SignMessageBegin begins a multiple-part message signature operation, where
3116 * the signature is an appendix to the message. C_MessageSignInit must
3117 * previously been called on the session.
3118 *
3119 * @param session the session's handle
3120 * @param parameter_ptr message specific parameter
3121 * @param parameter_len length of message specific parameter
3122 * @param return_value default value (`ThrowException`): throw exception on error
3123 * @return true on success, false otherwise
3124 */
3125 bool C_SignMessageBegin(SessionHandle session,
3126 const void* parameter_ptr,
3127 Ulong parameter_len,
3128 ReturnValue* return_value = ThrowException);
3129
3130 /**
3131 * C_SignMessageNext continues a multiple-part message signature operation,
3132 * processing another data part, or finishes a multiple-part message
3133 * signature operation, returning the signature.
3134 *
3135 * @param session the session's handle
3136 * @param parameter_ptr message specific parameter
3137 * @param parameter_len length of message specific parameter
3138 * @param data_ptr data to sign
3139 * @param data_len data to sign length
3140 * @param signature_ptr gets signature
3141 * @param signature_len_ptr gets signature length
3142 * @param return_value default value (`ThrowException`): throw exception on error
3143 * @return true on success, false otherwise
3144 */
3145 bool C_SignMessageNext(SessionHandle session,
3146 const void* parameter_ptr,
3147 Ulong parameter_len,
3148 const Byte* data_ptr,
3149 Ulong data_len,
3150 Byte* signature_ptr,
3151 Ulong* signature_len_ptr,
3152 ReturnValue* return_value = ThrowException);
3153
3154 /**
3155 * C_MessageSignFinal finishes a message-based signing process.
3156 *
3157 * @param session the session's handle
3158 * @param return_value default value (`ThrowException`): throw exception on error
3159 * @return true on success, false otherwise
3160 */
3161 bool C_MessageSignFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
3162
3163 /****************************** Functions for verifying signatures and MACs ******************************/
3164
3165 /**
3166 * C_VerifyInit initializes a verification operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature (e.g. DSA).
3167 * @param session the session's handle
3168 * @param mechanism_ptr the verification mechanism
3169 * @param key verification key
3170 * @param return_value default value (`ThrowException`): throw exception on error.
3171 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3172 * At least the following PKCS #11 return values may be returned:
3173 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3174 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3175 * \li FunctionFailed \li GeneralError \li HostMemory
3176 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
3177 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
3178 * \li OK \li OperationActive \li PinExpired
3179 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3180 * @return true on success, false otherwise
3181 */
3182 bool C_VerifyInit(SessionHandle session,
3183 const Mechanism* mechanism_ptr,
3184 ObjectHandle key,
3185 ReturnValue* return_value = ThrowException) const;
3186
3187 /**
3188 * C_Verify verifies a signature in a single-part operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature.
3189 * @param session the session's handle
3190 * @param data_ptr signed data
3191 * @param data_len length of signed data
3192 * @param signature_ptr signature
3193 * @param signature_len signature length
3194 * @param return_value default value (`ThrowException`): throw exception on error.
3195 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3196 * At least the following PKCS #11 return values may be returned:
3197 * \li ArgumentsBad \li CryptokiNotInitialized \li DataInvalid
3198 * \li DataLenRange \li DeviceError \li DeviceMemory
3199 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3200 * \li GeneralError \li HostMemory \li OK
3201 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3202 * \li SignatureInvalid \li SignatureLenRange
3203 * @return true on success, false otherwise
3204 */
3205 bool C_Verify(SessionHandle session,
3206 const Byte* data_ptr,
3207 Ulong data_len,
3208 const Byte* signature_ptr,
3209 Ulong signature_len,
3210 ReturnValue* return_value = ThrowException) const;
3211
3212 /**
3213 * C_Verify verifies a signature in a single-part operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature.
3214 * @param session the session's handle
3215 * @param data signed data
3216 * @param signature signature
3217 * @param return_value default value (`ThrowException`): throw exception on error.
3218 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3219 * At least the following PKCS #11 return values may be returned:
3220 * \li ArgumentsBad \li CryptokiNotInitialized \li DataInvalid
3221 * \li DataLenRange \li DeviceError \li DeviceMemory
3222 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3223 * \li GeneralError \li HostMemory \li OK
3224 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3225 * \li SignatureInvalid \li SignatureLenRange
3226 * @return true on success, false otherwise
3227 */
3228 template <typename TAllocA, typename TAllocB>
3230 const std::vector<uint8_t, TAllocA>& data,
3231 std::vector<uint8_t, TAllocB>& signature,
3232 ReturnValue* return_value = ThrowException) const {
3233 return C_Verify(session,
3234 data.data(),
3235 checked_ulong_cast(data.size()),
3236 signature.data(),
3237 checked_ulong_cast(signature.size()),
3238 return_value);
3239 }
3240
3241 /**
3242 * C_VerifyUpdate continues a multiple-part verification operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature.
3243 * @param session the session's handle
3244 * @param part_ptr signed data
3245 * @param part_len length of signed data
3246 * @param return_value default value (`ThrowException`): throw exception on error.
3247 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3248 * At least the following PKCS #11 return values may be returned:
3249 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
3250 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3251 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3252 * \li HostMemory \li OK \li OperationNotInitialized
3253 * \li SessionClosed \li SessionHandleInvalid
3254 * @return true on success, false otherwise
3255 */
3256 bool C_VerifyUpdate(SessionHandle session,
3257 const Byte* part_ptr,
3258 Ulong part_len,
3259 ReturnValue* return_value = ThrowException) const;
3260
3261 /**
3262 * C_VerifyUpdate continues a multiple-part verification operation, where the signature is an appendix to the data, and plaintext cannot be recovered from the signature.
3263 * @param session the session's handle
3264 * @param part signed data
3265 * @param return_value default value (`ThrowException`): throw exception on error.
3266 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3267 * At least the following PKCS #11 return values may be returned:
3268 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
3269 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3270 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3271 * \li HostMemory \li OK \li OperationNotInitialized
3272 * \li SessionClosed \li SessionHandleInvalid
3273 * @return true on success, false otherwise
3274 */
3275 template <typename TAlloc>
3277 std::vector<uint8_t, TAlloc> part,
3278 ReturnValue* return_value = ThrowException) const {
3279 return C_VerifyUpdate(session, part.data(), checked_ulong_cast(part.size()), return_value);
3280 }
3281
3282 /**
3283 * C_VerifyFinal finishes a multiple-part verification operation, checking the signature.
3284 * @param session the session's handle
3285 * @param signature_ptr signature to verify
3286 * @param signature_len signature length
3287 * @param return_value default value (`ThrowException`): throw exception on error.
3288 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3289 * At least the following PKCS #11 return values may be returned:
3290 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
3291 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3292 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3293 * \li HostMemory \li OK \li OperationNotInitialized
3294 * \li SessionClosed \li SessionHandleInvalid \li SignatureInvalid
3295 * \li SignatureLenRange
3296 * @return true on success, false otherwise
3297 */
3298 bool C_VerifyFinal(SessionHandle session,
3299 const Byte* signature_ptr,
3300 Ulong signature_len,
3301 ReturnValue* return_value = ThrowException) const;
3302
3303 /**
3304 * C_VerifyRecoverInit initializes a signature verification operation, where the data is recovered from the signature.
3305 * @param session the session's handle
3306 * @param mechanism_ptr the verification mechanism
3307 * @param key verification key
3308 * @param return_value default value (`ThrowException`): throw exception on error.
3309 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3310 * At least the following PKCS #11 return values may be returned:
3311 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3312 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3313 * \li FunctionFailed \li GeneralError \li HostMemory
3314 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
3315 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
3316 * \li OK \li OperationActive \li PinExpired
3317 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3318 * @return true on success, false otherwise
3319 */
3321 const Mechanism* mechanism_ptr,
3322 ObjectHandle key,
3323 ReturnValue* return_value = ThrowException) const;
3324
3325 /**
3326 * C_VerifyRecover verifies a signature in a single-part operation, where the data is recovered from the signature.
3327 * @param session the session's handle
3328 * @param signature_ptr signature to verify
3329 * @param signature_len signature length
3330 * @param data_ptr gets signed data
3331 * @param data_len_ptr gets signed data len
3332 * @param return_value default value (`ThrowException`): throw exception on error.
3333 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3334 * At least the following PKCS #11 return values may be returned:
3335 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3336 * \li DataInvalid \li DataLenRange \li DeviceError
3337 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3338 * \li FunctionFailed \li GeneralError \li HostMemory
3339 * \li OK \li OperationNotInitialized \li SessionClosed
3340 * \li SessionHandleInvalid \li SignatureLenRange \li SignatureInvalid
3341 * @return true on success, false otherwise
3342 */
3343 bool C_VerifyRecover(SessionHandle session,
3344 const Byte* signature_ptr,
3345 Ulong signature_len,
3346 Byte* data_ptr,
3347 Ulong* data_len_ptr,
3348 ReturnValue* return_value = ThrowException) const;
3349
3350 /**
3351 * C_VerifySignatureInit initializes a verification operation, where the
3352 * signature is included as part of the initialization.
3353 *
3354 * @param session the session's handle
3355 * @param mechanism_ptr the verification mechanism
3356 * @param key verification key
3357 * @param signature_ptr signature
3358 * @param signature_len signature length
3359 * @param return_value default value (`ThrowException`): throw exception on error
3360 * @return true on success, false otherwise
3361 */
3363 const Mechanism* mechanism_ptr,
3364 ObjectHandle key,
3365 const Byte* signature_ptr,
3366 Ulong signature_len,
3367 ReturnValue* return_value = ThrowException);
3368
3369 /**
3370 * C_VerifySignature verifies a signature in a single-part operation, where the
3371 * signature is an appendix to the data.
3372 *
3373 * @param session the session's handle
3374 * @param data_ptr signed data
3375 * @param data_len length of signed data
3376 * @param return_value default value (`ThrowException`): throw exception on error
3377 * @return true on success, false otherwise
3378 */
3379 bool C_VerifySignature(SessionHandle session,
3380 const Byte* data_ptr,
3381 Ulong data_len,
3382 ReturnValue* return_value = ThrowException);
3383
3384 /**
3385 * C_VerifySignatureUpdate continues a multiple-part verification operation,
3386 * processing another data part.
3387 *
3388 * @param session the session's handle
3389 * @param part_ptr signed data
3390 * @param part_len length of signed data
3391 * @param return_value default value (`ThrowException`): throw exception on error
3392 * @return true on success, false otherwise
3393 */
3395 const Byte* part_ptr,
3396 Ulong part_len,
3397 ReturnValue* return_value = ThrowException);
3398
3399 /**
3400 * C_VerifySignatureFinal finishes a multiple-part verification operation,
3401 * checking the signature.
3402 *
3403 * @param session the session's handle
3404 * @param return_value default value (`ThrowException`): throw exception on error
3405 * @return true on success, false otherwise
3406 */
3407 bool C_VerifySignatureFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
3408
3409 /*********** Message-based functions for verifying signatures and MACs ************/
3410
3411 /**
3412 * C_MessageVerifyInit initializes a message-based verification process,
3413 * preparing a session for one or more verification operations (where the
3414 * signature is an appendix to the data) that use the same verification
3415 * mechanism and verification key.
3416 *
3417 * @param session the session's handle
3418 * @param mechanism_ptr the signing mechanism
3419 * @param key handle of signing key
3420 * @param return_value default value (`ThrowException`): throw exception on error
3421 * @return true on success, false otherwise
3422 */
3424 const Mechanism* mechanism_ptr,
3425 ObjectHandle key,
3426 ReturnValue* return_value = ThrowException);
3427
3428 /**
3429 * C_VerifyMessage verifies a signature on a message in a single part operation,
3430 * where the signature is an appendix to the data. C_MessageVerifyInit must
3431 * previously been called on the session.
3432 *
3433 * @param session the session's handle
3434 * @param parameter_ptr message specific parameter
3435 * @param parameter_len length of message specific parameter
3436 * @param data_ptr data to sign
3437 * @param data_len data to sign length
3438 * @param signature_ptr signature
3439 * @param signature_len signature length
3440 * @param return_value default value (`ThrowException`): throw exception on error
3441 * @return true on success, false otherwise
3442 */
3443 bool C_VerifyMessage(SessionHandle session,
3444 const void* parameter_ptr,
3445 Ulong parameter_len,
3446 const Byte* data_ptr,
3447 Ulong data_len,
3448 const Byte* signature_ptr,
3449 Ulong signature_len,
3450 ReturnValue* return_value = ThrowException);
3451
3452 /**
3453 * C_VerifyMessageBegin begins a multiple-part message verification operation,
3454 * where the signature is an appendix to the message. C_MessageVerifyInit
3455 * must previously been called on the session.
3456 *
3457 * @param session the session's handle
3458 * @param parameter_ptr message specific parameter
3459 * @param parameter_len length of message specific parameter
3460 * @param return_value default value (`ThrowException`): throw exception on error
3461 * @return true on success, false otherwise
3462 */
3464 const void* parameter_ptr,
3465 Ulong parameter_len,
3466 ReturnValue* return_value = ThrowException);
3467
3468 /**
3469 * C_VerifyMessageNext continues a multiple-part message verification operation,
3470 * processing another data part, or finishes a multiple-part message
3471 * verification operation, checking the signature.
3472 *
3473 * @param session the session's handle
3474 * @param parameter_ptr message specific parameter
3475 * @param parameter_len length of message specific parameter
3476 * @param data_ptr data to sign
3477 * @param data_len data to sign length
3478 * @param signature_ptr signature
3479 * @param signature_len signature length
3480 * @param return_value default value (`ThrowException`): throw exception on error
3481 * @return true on success, false otherwise
3482 */
3484 const void* parameter_ptr,
3485 Ulong parameter_len,
3486 const Byte* data_ptr,
3487 Ulong data_len,
3488 const Byte* signature_ptr,
3489 Ulong signature_len,
3490 ReturnValue* return_value = ThrowException);
3491
3492 /**
3493 * C_MessageVerifyFinal finishes a message-based verification process.
3494 *
3495 * @param session the session's handle
3496 * @param return_value default value (`ThrowException`): throw exception on error
3497 * @return true on success, false otherwise
3498 */
3499 bool C_MessageVerifyFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
3500
3501 /****************************** Dual-purpose cryptographic functions ******************************/
3502
3503 /**
3504 * C_DigestEncryptUpdate continues a multiple-part digesting and encryption operation.
3505 * @param session session's handle
3506 * @param part_ptr the plaintext data
3507 * @param part_len plaintext length
3508 * @param encrypted_part_ptr gets ciphertext
3509 * @param encrypted_part_len_ptr gets c-text length
3510 * @param return_value default value (`ThrowException`): throw exception on error.
3511 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3512 * At least the following PKCS #11 return values may be returned:
3513 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3514 * \li DataLenRange \li DeviceError \li DeviceMemory
3515 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3516 * \li GeneralError \li HostMemory \li OK
3517 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3518 * @return true on success, false otherwise
3519 */
3521 const Byte* part_ptr,
3522 Ulong part_len,
3523 Byte* encrypted_part_ptr,
3524 Ulong* encrypted_part_len_ptr,
3525 ReturnValue* return_value = ThrowException) const;
3526
3527 /**
3528 * C_DecryptDigestUpdate continues a multiple-part decryption and digesting operation.
3529 * @param session session's handle
3530 * @param encrypted_part_ptr ciphertext
3531 * @param encrypted_part_len ciphertext length
3532 * @param part_ptr gets plaintext
3533 * @param part_len_ptr gets plaintext len
3534 * @param return_value default value (`ThrowException`): throw exception on error.
3535 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3536 * At least the following PKCS #11 return values may be returned:
3537 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3538 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3539 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
3540 * \li FunctionFailed \li GeneralError \li HostMemory
3541 * \li OK \li OperationNotInitialized \li SessionClosed
3542 * \li SessionHandleInvalid
3543 * @return true on success, false otherwise
3544 */
3546 const Byte* encrypted_part_ptr,
3547 Ulong encrypted_part_len,
3548 Byte* part_ptr,
3549 Ulong* part_len_ptr,
3550 ReturnValue* return_value = ThrowException) const;
3551
3552 /**
3553 * C_SignEncryptUpdate continues a multiple-part signing and encryption operation.
3554 * @param session session's handle
3555 * @param part_ptr the plaintext data
3556 * @param part_len plaintext length
3557 * @param encrypted_part_ptr gets ciphertext
3558 * @param encrypted_part_len_ptr gets c-text length
3559 * @param return_value default value (`ThrowException`): throw exception on error.
3560 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3561 * At least the following PKCS #11 return values may be returned:
3562 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3563 * \li DataLenRange \li DeviceError \li DeviceMemory
3564 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3565 * \li GeneralError \li HostMemory \li OK
3566 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3567 * \li UserNotLoggedIn
3568 * @return true on success, false otherwise
3569 */
3571 const Byte* part_ptr,
3572 Ulong part_len,
3573 Byte* encrypted_part_ptr,
3574 Ulong* encrypted_part_len_ptr,
3575 ReturnValue* return_value = ThrowException) const;
3576
3577 /**
3578 * C_DecryptVerifyUpdate continues a multiple-part decryption and verify operation.
3579 * @param session session's handle
3580 * @param encrypted_part_ptr ciphertext
3581 * @param encrypted_part_len ciphertext length
3582 * @param part_ptr gets plaintext
3583 * @param part_len_ptr gets p-text length
3584 * @param return_value default value (`ThrowException`): throw exception on error.
3585 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3586 * At least the following PKCS #11 return values may be returned:
3587 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3588 * \li DataLenRange \li DeviceError \li DeviceMemory
3589 * \li DeviceRemoved \li EncryptedDataInvalid \li EncryptedDataLenRange
3590 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3591 * \li HostMemory \li OK \li OperationNotInitialized
3592 * \li SessionClosed \li SessionHandleInvalid
3593 * @return true on success, false otherwise
3594 */
3596 const Byte* encrypted_part_ptr,
3597 Ulong encrypted_part_len,
3598 Byte* part_ptr,
3599 Ulong* part_len_ptr,
3600 ReturnValue* return_value = ThrowException) const;
3601
3602 /****************************** Key management functions ******************************/
3603
3604 /**
3605 * C_GenerateKey generates a secret key, creating a new key object.
3606 * @param session the session's handle
3607 * @param mechanism_ptr key generation mech.
3608 * @param attribute_template_ptr template for new key
3609 * @param count # of attrs in template
3610 * @param key_ptr gets handle of new key
3611 * @param return_value default value (`ThrowException`): throw exception on error.
3612 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3613 * At least the following PKCS #11 return values may be returned:
3614 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3615 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
3616 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3617 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3618 * \li HostMemory \li MechanismInvalid \li MechanismParamInvalid
3619 * \li OK \li OperationActive \li PinExpired
3620 * \li SessionClosed \li SessionHandleInvalid \li SessionReadOnly
3621 * \li TemplateIncomplete \li TemplateInconsistent \li TokenWriteProtected
3622 * \li UserNotLoggedIn
3623 * @return true on success, false otherwise
3624 */
3625 bool C_GenerateKey(SessionHandle session,
3626 const Mechanism* mechanism_ptr,
3627 Attribute* attribute_template_ptr,
3628 Ulong count,
3629 ObjectHandle* key_ptr,
3630 ReturnValue* return_value = ThrowException) const;
3631
3632 /**
3633 * C_GenerateKeyPair generates a public-key/private-key pair, creating new key objects.
3634 * @param session session handle
3635 * @param mechanism_ptr key-gen mech.
3636 * @param public_key_template_ptr template for pub. key
3637 * @param public_key_attribute_count # pub. attrs.
3638 * @param private_key_template_ptr template for priv. key
3639 * @param private_key_attribute_count # priv. attrs.
3640 * @param public_key_ptr gets pub. key handle
3641 * @param private_key_ptr gets priv. key handle
3642 * @param return_value default value (`ThrowException`): throw exception on error.
3643 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3644 * At least the following PKCS #11 return values may be returned:
3645 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3646 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
3647 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3648 * \li DomainParamsInvalid \li FunctionCanceled \li FunctionFailed
3649 * \li GeneralError \li HostMemory \li MechanismInvalid
3650 * \li MechanismParamInvalid \li OK \li OperationActive
3651 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
3652 * \li SessionReadOnly \li TemplateIncomplete \li TemplateInconsistent
3653 * \li TokenWriteProtected \li UserNotLoggedIn
3654 * @return true on success, false otherwise
3655 */
3656 bool C_GenerateKeyPair(SessionHandle session,
3657 const Mechanism* mechanism_ptr,
3658 Attribute* public_key_template_ptr,
3659 Ulong public_key_attribute_count,
3660 Attribute* private_key_template_ptr,
3661 Ulong private_key_attribute_count,
3662 ObjectHandle* public_key_ptr,
3663 ObjectHandle* private_key_ptr,
3664 ReturnValue* return_value = ThrowException) const;
3665
3666 /**
3667 * C_WrapKey wraps (i.e., encrypts) a key.
3668 * @param session the session's handle
3669 * @param mechanism_ptr the wrapping mechanism
3670 * @param wrapping_key wrapping key
3671 * @param key key to be wrapped
3672 * @param wrapped_key_ptr gets wrapped key
3673 * @param wrapped_key_len_ptr gets wrapped key size
3674 * @param return_value default value (`ThrowException`): throw exception on error.
3675 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3676 * At least the following PKCS #11 return values may be returned:
3677 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3678 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3679 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3680 * \li HostMemory \li KeyHandleInvalid \li KeyNotWrappable
3681 * \li KeySizeRange \li KeyUnextractable \li MechanismInvalid
3682 * \li MechanismParamInvalid \li OK \li OperationActive
3683 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
3684 * \li UserNotLoggedIn \li WrappingKeyHandleInvalid \li WrappingKeySizeRange
3685 * \li WrappingKeyTypeInconsistent
3686 * @return true on success, false otherwise
3687 */
3688 bool C_WrapKey(SessionHandle session,
3689 const Mechanism* mechanism_ptr,
3690 ObjectHandle wrapping_key,
3691 ObjectHandle key,
3692 Byte* wrapped_key_ptr,
3693 Ulong* wrapped_key_len_ptr,
3694 ReturnValue* return_value = ThrowException) const;
3695
3696 /**
3697 * C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new key object.
3698 * @param session session's handle
3699 * @param mechanism_ptr unwrapping mech.
3700 * @param unwrapping_key unwrapping key
3701 * @param wrapped_key_ptr the wrapped key
3702 * @param wrapped_key_len wrapped key len
3703 * @param attribute_template_ptr new key template
3704 * @param attribute_count template length
3705 * @param key_ptr gets new handle
3706 * @param return_value default value (`ThrowException`): throw exception on error.
3707 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3708 * At least the following PKCS #11 return values may be returned:
3709 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3710 * \li AttributeValueInvalid \li BufferTooSmall \li CryptokiNotInitialized
3711 * \li CurveNotSupported \li DeviceError \li DeviceMemory
3712 * \li DeviceRemoved \li DomainParamsInvalid \li FunctionCanceled
3713 * \li FunctionFailed \li GeneralError \li HostMemory
3714 * \li MechanismInvalid \li MechanismParamInvalid \li OK
3715 * \li OperationActive \li PinExpired \li SessionClosed
3716 * \li SessionHandleInvalid \li SessionReadOnly \li TemplateIncomplete
3717 * \li TemplateInconsistent \li TokenWriteProtected \li UnwrappingKeyHandleInvalid
3718 * \li UnwrappingKeySizeRange \li UnwrappingKeyTypeInconsistent \li UserNotLoggedIn
3719 * \li WrappedKeyInvalid \li WrappedKeyLenRange
3720 * @return true on success, false otherwise
3721 */
3722 bool C_UnwrapKey(SessionHandle session,
3723 const Mechanism* mechanism_ptr,
3724 ObjectHandle unwrapping_key,
3725 const Byte* wrapped_key_ptr,
3726 Ulong wrapped_key_len,
3727 Attribute* attribute_template_ptr,
3728 Ulong attribute_count,
3729 ObjectHandle* key_ptr,
3730 ReturnValue* return_value = ThrowException) const;
3731
3732 /**
3733 * C_DeriveKey derives a key from a base key, creating a new key object.
3734 * @param session session's handle
3735 * @param mechanism_ptr key deriv. mech.
3736 * @param base_key base key
3737 * @param attribute_template_ptr new key template
3738 * @param attribute_count template length
3739 * @param key_ptr gets new handle
3740 * @param return_value default value (`ThrowException`): throw exception on error.
3741 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3742 * At least the following PKCS #11 return values may be returned:
3743 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3744 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
3745 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3746 * \li DomainParamsInvalid \li FunctionCanceled \li FunctionFailed
3747 * \li GeneralError \li HostMemory \li KeyHandleInvalid
3748 * \li KeySizeRange \li KeyTypeInconsistent \li MechanismInvalid
3749 * \li MechanismParamInvalid \li OK \li OperationActive
3750 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
3751 * \li SessionReadOnly \li TemplateIncomplete \li TemplateInconsistent
3752 * \li TokenWriteProtected \li UserNotLoggedIn
3753 * @return true on success, false otherwise
3754 */
3755 bool C_DeriveKey(SessionHandle session,
3756 const Mechanism* mechanism_ptr,
3757 ObjectHandle base_key,
3758 Attribute* attribute_template_ptr,
3759 Ulong attribute_count,
3760 ObjectHandle* key_ptr,
3761 ReturnValue* return_value = ThrowException) const;
3762
3763 /**
3764 * C_WrapKeyAuthenticated wraps (i.e. encrypts) a private or secret key.
3765 *
3766 * @param session session's handle
3767 * @param mechanism_ptr wrapping mechanism
3768 * @param wrapping_key wrapping key
3769 * @param key key to be wrapped
3770 * @param associated_data_ptr associated data for an AEAD mechanism
3771 * @param associated_data_len length of the associated data
3772 * @param wrapped_key_ptr gets the wrapped key
3773 * @param wrapped_key_len_ptr gets the length of the wrapped key
3774 * @param return_value default value (`ThrowException`): throw exception on error
3775 * @return true on success, false otherwise
3776 */
3778 const Mechanism* mechanism_ptr,
3779 ObjectHandle wrapping_key,
3780 ObjectHandle key,
3781 const Byte* associated_data_ptr,
3782 Ulong associated_data_len,
3783 Byte* wrapped_key_ptr,
3784 Ulong* wrapped_key_len_ptr,
3785 ReturnValue* return_value = ThrowException) const;
3786
3787 /**
3788 * C_UnwrapKeyAuthenticated unwraps (i.e. decrypts) a wrapped key,
3789 * creating a new private key or secret key object.
3790 *
3791 * @param session session's handle
3792 * @param mechanism_ptr unwrapping mechanism
3793 * @param unwrapping_key unwrapping key
3794 * @param wrapped_key_ptr wrapped key
3795 * @param wrapped_key_len length of the wrapped key
3796 * @param attribute_template_ptr new key template
3797 * @param attribute_count template length
3798 * @param associated_data_ptr associated data for an AEAD mechanism
3799 * @param associated_data_len length of the associated data
3800 * @param key_ptr gets new key handle
3801 * @param return_value default value (`ThrowException`): throw exception on error
3802 * @return true on success, false otherwise
3803 */
3805 const Mechanism* mechanism_ptr,
3806 ObjectHandle unwrapping_key,
3807 const Byte* wrapped_key_ptr,
3808 Ulong wrapped_key_len,
3809 Attribute* attribute_template_ptr,
3810 Ulong attribute_count,
3811 const Byte* associated_data_ptr,
3812 Ulong associated_data_len,
3813 ObjectHandle* key_ptr,
3814 ReturnValue* return_value = ThrowException) const;
3815
3816 /**
3817 * C_EncapulateKey creates a new secret key object from a public key using a
3818 * KEM.
3819 *
3820 * @param session the session's handle
3821 * @param mechanism_ptr the encapsulation mechanism
3822 * @param public_key the encapsulating key
3823 * @param template_ptr new key template
3824 * @param attribute_count template length
3825 * @param ciphertext_ptr the wrapped key
3826 * @param ciphertext_len_ptr the wrapped key size
3827 * @param key_ptr the encapsulated key
3828 * @param return_value default value (`ThrowException`): throw exception on error
3829 * @return true on success, false otherwise
3830 */
3831 bool C_EncapsulateKey(SessionHandle session,
3832 const Mechanism* mechanism_ptr,
3833 ObjectHandle public_key,
3834 Attribute* template_ptr,
3835 Ulong attribute_count,
3836 Byte* ciphertext_ptr,
3837 Ulong* ciphertext_len_ptr,
3838 ObjectHandle* key_ptr,
3839 ReturnValue* return_value = ThrowException);
3840
3841 /**
3842 * C_DecapsulateKey creates a new secret key object based on the private key and
3843 * ciphertext generated by a prior encapsulate operation. This new key
3844 * (called a ‘shared key’ in most KEM documentation) is identical to the
3845 * key returned by C_EncapsulateKey when it was called with the matching public
3846 * key and returned the same cipher text. This function is a KEM style
3847 * function.
3848 *
3849 * @param session the session's handle
3850 * @param mechanism_ptr the decapsulation mechanism
3851 * @param private_key the decapsulating key
3852 * @param template_ptr new key template
3853 * @param attribute_count template length
3854 * @param ciphertext_ptr the wrapped key
3855 * @param ciphertext_len the wrapped key size
3856 * @param key_ptr the decapsulated key
3857 * @param return_value default value (`ThrowException`): throw exception on error
3858 * @return true on success, false otherwise
3859 */
3860 bool C_DecapsulateKey(SessionHandle session,
3861 const Mechanism* mechanism_ptr,
3862 ObjectHandle private_key,
3863 Attribute* template_ptr,
3864 Ulong attribute_count,
3865 const Byte* ciphertext_ptr,
3866 Ulong ciphertext_len,
3867 ObjectHandle* key_ptr,
3868 ReturnValue* return_value = ThrowException);
3869
3870 /****************************** Random number generation functions ******************************/
3871
3872 /**
3873 * C_SeedRandom mixes additional seed material into the token's random number generator.
3874 * @param session the session's handle
3875 * @param seed_ptr the seed material
3876 * @param seed_len length of seed material
3877 * @param return_value default value (`ThrowException`): throw exception on error.
3878 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3879 * At least the following PKCS #11 return values may be returned:
3880 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3881 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3882 * \li FunctionFailed \li GeneralError \li HostMemory
3883 * \li OK \li OperationActive \li RandomSeedNotSupported
3884 * \li RandomNoRng \li SessionClosed \li SessionHandleInvalid
3885 * \li UserNotLoggedIn
3886 * @return true on success, false otherwise
3887 */
3888 bool C_SeedRandom(SessionHandle session,
3889 const Byte* seed_ptr,
3890 Ulong seed_len,
3891 ReturnValue* return_value = ThrowException) const;
3892
3893 /**
3894 * C_GenerateRandom generates random data.
3895 * @param session the session's handle
3896 * @param random_data_ptr receives the random data
3897 * @param random_len # of bytes to generate
3898 * @param return_value default value (`ThrowException`): throw exception on error.
3899 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3900 * At least the following PKCS #11 return values may be returned:
3901 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3902 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3903 * \li FunctionFailed \li GeneralError \li HostMemory
3904 * \li OK \li OperationActive \li RandomNoRng
3905 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3906 * @return true on success, false otherwise
3907 */
3908 bool C_GenerateRandom(SessionHandle session,
3909 Byte* random_data_ptr,
3910 Ulong random_len,
3911 ReturnValue* return_value = ThrowException) const;
3912
3913 /****************************** Parallel function management functions ******************************/
3914
3915 /**
3916 * C_GetFunctionStatus is a legacy function; it obtains an updated status of a function running in parallel with an application.
3917 * @param session the session's handle
3918 * @param return_value default value (`ThrowException`): throw exception on error.
3919 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3920 * At least the following PKCS #11 return values may be returned:
3921 * \li CryptokiNotInitialized \li FunctionFailed \li FunctionNotParallel
3922 * \li GeneralError \li HostMemory \li SessionHandleInvalid
3923 * \li SessionClosed
3924 * @return true on success, false otherwise
3925 */
3926 bool C_GetFunctionStatus(SessionHandle session, ReturnValue* return_value = ThrowException) const;
3927
3928 /**
3929 * C_CancelFunction is a legacy function; it cancels a function running in parallel.
3930 * @param session the session's handle
3931 * @param return_value default value (`ThrowException`): throw exception on error.
3932 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3933 * At least the following PKCS #11 return values may be returned:
3934 * \li CryptokiNotInitialized \li FunctionFailed \li FunctionNotParallel
3935 * \li GeneralError \li HostMemory \li SessionHandleInvalid
3936 * \li SessionClosed
3937 * @return true on success, false otherwise
3938 */
3939 bool C_CancelFunction(SessionHandle session, ReturnValue* return_value = ThrowException) const;
3940
3941 /******************* Asynchronous function management functions *******************/
3942
3943 /**
3944 * C_AsyncComplete checks if the function identified by function_name_ptr has
3945 * completed an asynchronous operation and, if so, returns the associated
3946 * result(s).
3947 *
3948 * @param session the session's handle
3949 * @param function_name_ptr pkcs11 function name
3950 * @param result_ptr operation result
3951 * @param return_value default value (`ThrowException`): throw exception on error
3952 * @return true on success, false otherwise
3953 */
3954 bool C_AsyncComplete(SessionHandle session,
3955 const Utf8Char* function_name_ptr,
3956 AsyncData* result_ptr,
3957 ReturnValue* return_value = ThrowException);
3958
3959 /**
3960 * C_AsyncGetID is used to persist an operation past a C_Finalize call and allow
3961 * another instance of the client to reconnect after a call to
3962 * C_Initialize. C_AsyncGetID places a module dependent identifier for
3963 * the asynchronous operation being performed by the function identified by
3964 * function_name_ptr.
3965 *
3966 * @param session the session's handle
3967 * @param function_name_ptr pkcs11 function name
3968 * @param id_ptr persistent operation id
3969 * @param return_value default value (`ThrowException`): throw exception on error
3970 * @return true on success, false otherwise
3971 */
3972 bool C_AsyncGetID(SessionHandle session,
3973 const Utf8Char* function_name_ptr,
3974 Ulong* id_ptr,
3975 ReturnValue* return_value = ThrowException);
3976
3977 /**
3978 * C_AsyncJoin checks if the function identified by function_name_ptr and id is a
3979 * valid asynchronous operation and, if so, reconnects the client application to
3980 * the module using the buffer specified by data_ptr and data_len in place of those
3981 * passed into the original call to function_name_ptr.
3982 *
3983 * @param session the session's handle
3984 * @param function_name_ptr pkcs11 function name
3985 * @param id persistent operation id
3986 * @param data_ptr location for the data
3987 * @param data_len data length
3988 * @param return_value default value (`ThrowException`): throw exception on error
3989 * @return true on success, false otherwise
3990 */
3991 bool C_AsyncJoin(SessionHandle session,
3992 const Utf8Char* function_name_ptr,
3993 Ulong id,
3994 Byte* data_ptr,
3995 Ulong data_len,
3996 ReturnValue* return_value = ThrowException);
3997
3998 /**
3999 * Return the PKCS11 function list that this LowLevel class contains.
4000 *
4001 * This is primarily useful when invoking vendor specific extension
4002 * functions which are not supported directly by LowLevel or the higher
4003 * level PKCS11 API.
4004 */
4005 BOTAN_DEPRECATED("Use get_interface().func_2_40()") FunctionList* get_functions() const;
4006
4007 const InterfaceWrapper& get_interface() { return m_interface_wrapper; }
4008
4009 protected:
4010 /**
4011 * it is possible for an application to inherit from LowLevel in order to
4012 * implement wrappers for vendor specific extensions using the same error
4013 * handling mechanisms as the rest of the library.
4014 */
4015 static bool handle_return_value(CK_RV function_result, ReturnValue* return_value);
4016
4017 private:
4018 InterfaceWrapper m_interface_wrapper;
4019};
4020
4022 public:
4023 explicit PKCS11_Error(std::string_view what) : Exception("PKCS11 error", what) {}
4024
4025 ErrorType error_type() const noexcept override { return ErrorType::Pkcs11Error; }
4026};
4027
4029 public:
4030 explicit PKCS11_ReturnError(ReturnValue return_val);
4031
4032 inline ReturnValue get_return_value() const { return m_return_val; }
4033
4034 int error_code() const noexcept override { return static_cast<int>(m_return_val); }
4035
4036 private:
4037 const ReturnValue m_return_val;
4038};
4039
4040} // namespace PKCS11
4041
4042} // namespace Botan
4043
4044#endif
#define BOTAN_PUBLIC_API(maj, min)
Definition api.h:21
#define BOTAN_DEPRECATED(msg)
Definition api.h:73
const char * what() const noexcept override
Definition exceptn.h:94
Exception(std::string_view msg)
Definition exceptn.cpp:71
Wraps a PKCS #11 Interface object.
Definition p11.h:1283
InterfaceWrapper(const InterfaceWrapper &)=default
InterfaceWrapper & operator=(const InterfaceWrapper &)=default
InterfaceWrapper & operator=(InterfaceWrapper &&)=default
InterfaceWrapper(Interface p11_interface)
Basic constructor using an interface.
const Interface & raw_interface() const
Access the underlying interface object.
Definition p11.h:1298
InterfaceWrapper(InterfaceWrapper &&)=default
bool C_InitPIN(SessionHandle session, const std::vector< uint8_t, TAlloc > &pin, ReturnValue *return_value=ThrowException) const
Definition p11.h:1698
bool C_SetAttributeValue(SessionHandle session, ObjectHandle object, std::map< AttributeType, std::vector< uint8_t, TAlloc > > &attribute_values, ReturnValue *return_value=ThrowException) const
Definition p11.h:2198
bool C_Sign(SessionHandle session, const std::vector< uint8_t, TAllocA > &data, std::vector< uint8_t, TAllocB > &signature, ReturnValue *return_value=ThrowException) const
Definition p11.h:2908
bool C_SetPIN(SessionHandle session, const std::vector< uint8_t, TAlloc > &old_pin, const std::vector< uint8_t, TAlloc > &new_pin, ReturnValue *return_value=ThrowException) const
Definition p11.h:1749
bool C_SignUpdate(SessionHandle session, const std::vector< uint8_t, TAlloc > &part, ReturnValue *return_value=ThrowException) const
Definition p11.h:2965
bool C_InitToken(SlotId slot_id, const std::vector< uint8_t, TAlloc > &so_pin, std::string_view label, ReturnValue *return_value=ThrowException) const
Definition p11.h:1645
bool C_Login(SessionHandle session, UserType user_type, const std::vector< uint8_t, TAlloc > &pin, ReturnValue *return_value=ThrowException) const
Definition p11.h:1929
LowLevel(FunctionList *ptr)
Definition p11.cpp:64
const InterfaceWrapper & get_interface()
Definition p11.h:4007
bool C_Encrypt(SessionHandle session, const std::vector< uint8_t, TAllocA > &plaintext_data, std::vector< uint8_t, TAllocB > &encrypted_data, ReturnValue *return_value=ThrowException) const
Definition p11.h:2339
bool C_Verify(SessionHandle session, const std::vector< uint8_t, TAllocA > &data, std::vector< uint8_t, TAllocB > &signature, ReturnValue *return_value=ThrowException) const
Definition p11.h:3229
bool C_Decrypt(SessionHandle session, const std::vector< uint8_t, TAllocA > &encrypted_data, std::vector< uint8_t, TAllocB > &decrypted_data, ReturnValue *return_value=ThrowException) const
Definition p11.h:2572
bool C_VerifyUpdate(SessionHandle session, std::vector< uint8_t, TAlloc > part, ReturnValue *return_value=ThrowException) const
Definition p11.h:3276
bool C_SignFinal(SessionHandle session, std::vector< uint8_t, TAlloc > &signature, ReturnValue *return_value=ThrowException) const
Definition p11.h:3008
bool C_GetAttributeValue(SessionHandle session, ObjectHandle object, std::map< AttributeType, std::vector< uint8_t, TAlloc > > &attribute_values, ReturnValue *return_value=ThrowException) const
Definition p11.h:2120
ErrorType error_type() const noexcept override
Definition p11.h:4025
PKCS11_Error(std::string_view what)
Definition p11.h:4023
int error_code() const noexcept override
Definition p11.h:4034
ReturnValue get_return_value() const
Definition p11.h:4032
PKCS11_ReturnError(ReturnValue return_val)
MlDsaParameterSet
Definition p11.h:1009
CK_SLOT_ID SlotId
Definition p11.h:1203
CK_RSA_PKCS_OAEP_PARAMS RsaPkcsOaepParams
Definition p11.h:1216
CK_DESTROYMUTEX DestroyMutex
Definition p11.h:1196
ReturnValue * ThrowException
Definition p11.cpp:21
Ulong checked_ulong_cast(size_t v)
Definition p11.h:1228
CK_CREATEMUTEX CreateMutex
Definition p11.h:1195
PublicPointEncoding
Definition p11.h:1184
MlKemParameterSet
Definition p11.h:1030
JavaMidpSecurityDomain
Definition p11.h:253
secure_vector< uint8_t > secure_string
Definition p11.h:46
CK_FUNCTION_LIST FunctionList
Definition p11.h:1188
AttributeType
Definition p11.h:50
CK_C_INITIALIZE_ARGS C_InitializeArgs
Definition p11.h:1194
CK_MECHANISM Mechanism
Definition p11.h:1207
CK_NOTIFY Notify
Definition p11.h:1210
CertificateType
Definition p11.h:213
void change_pin(Slot &slot, const secure_string &old_pin, const secure_string &new_pin)
Definition p11.cpp:46
SlhDsaParameterSet
Definition p11.h:1015
CK_ECDH1_DERIVE_PARAMS Ecdh1DeriveParams
Definition p11.h:1218
CK_OBJECT_HANDLE ObjectHandle
Definition p11.h:1214
void change_so_pin(Slot &slot, const secure_string &old_so_pin, const secure_string &new_so_pin)
Definition p11.cpp:52
GeneratorFunction
Definition p11.h:383
CK_UNLOCKMUTEX UnlockMutex
Definition p11.h:1198
CK_ATTRIBUTE Attribute
Definition p11.h:1213
@ LibraryCantCreateOsThreads
Definition p11.h:364
@ AsyncSessionSupported
Definition p11.h:327
@ ProtectedAuthenticationPath
Definition p11.h:313
@ SecondaryAuthentication
Definition p11.h:316
Sp800_108DkmLengthMethod
Definition p11.h:268
CK_VERSION Version
Definition p11.h:1201
CK_FUNCTION_LIST_PTR FunctionListPtr
Definition p11.h:1189
CK_BYTE Byte
Definition p11.h:1215
CK_INFO Info
Definition p11.h:1200
CK_SLOT_INFO SlotInfo
Definition p11.h:1205
CK_INTERFACE Interface
Definition p11.h:1192
CK_VOID_PTR VoidPtr
Definition p11.h:1193
CK_FLAGS Flags
Definition p11.h:1199
CK_FUNCTION_LIST_3_0 FunctionList30
Definition p11.h:1190
Flag operator|(Flag a, Flag b)
Definition p11.h:378
CK_DATE Date
Definition p11.h:1219
CK_SESSION_INFO SessionInfo
Definition p11.h:1212
CK_TOKEN_INFO TokenInfo
Definition p11.h:1206
const Bbool True
Definition p11.h:1225
CK_ASYNC_DATA AsyncData
Definition p11.h:1220
CK_UTF8CHAR Utf8Char
Definition p11.h:1209
ValidationAuthorityType
Definition p11.h:1170
CK_FUNCTION_LIST_3_2 FunctionList32
Definition p11.h:1191
CK_ULONG Ulong
Definition p11.h:1204
CK_RSA_PKCS_PSS_PARAMS RsaPkcsPssParams
Definition p11.h:1217
const Bbool False
Definition p11.h:1226
OtpChallengeRequirement
Definition p11.h:247
CertificateCategory
Definition p11.h:222
CK_BBOOL Bbool
Definition p11.h:1202
void set_pin(Slot &slot, const secure_string &so_pin, const secure_string &pin)
Definition p11.cpp:58
SessionValidationFlagsType
Definition p11.h:1044
CK_MECHANISM_INFO MechanismInfo
Definition p11.h:1208
Flags flags(Flag flags)
Definition p11.h:1235
void initialize_token(Slot &slot, std::string_view label, const secure_string &so_pin, const secure_string &pin)
Definition p11.cpp:41
CK_LOCKMUTEX LockMutex
Definition p11.h:1197
CK_SESSION_HANDLE SessionHandle
Definition p11.h:1211
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:128
ErrorType
Definition exceptn.h:21
#define CKG_NO_GENERATE
Definition pkcs11.h:437
#define CKM_HASH_ML_DSA_SHA3_512
Definition pkcs11.h:580
CK_RV C_SignMessage(CK_SESSION_HANDLE, void *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
CK_RV C_SignUpdate(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG)
#define CKK_BLAKE2B_160_HMAC
Definition pkcs11.h:514
#define CKD_NULL
Definition pkcs11.h:311
#define CKA_NEVER_EXTRACTABLE
Definition pkcs11.h:196
#define CKM_HASH_ML_DSA_SHA3_256
Definition pkcs11.h:578
#define CKM_AES_XTS_KEY_GEN
Definition pkcs11.h:882
#define CKM_SEED_KEY_GEN
Definition pkcs11.h:831
#define CKM_TLS_MASTER_KEY_DERIVE
Definition pkcs11.h:753
#define CKD_SHA1_KDF
Definition pkcs11.h:312
#define CKD_SHA256_KDF
Definition pkcs11.h:316
CK_RV C_FindObjects(CK_SESSION_HANDLE, CK_OBJECT_HANDLE *, CK_ULONG, CK_ULONG *)
#define CKR_NEXT_OTP
Definition pkcs11.h:1176
#define CKK_DES3
Definition pkcs11.h:477
#define CKA_PUBLIC_CRC64_VALUE
Definition pkcs11.h:289
#define CKM_DSA_PARAMETER_GEN
Definition pkcs11.h:926
#define CKR_SESSION_COUNT
Definition pkcs11.h:1135
#define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE
Definition pkcs11.h:797
#define CKM_CONCATENATE_BASE_AND_DATA
Definition pkcs11.h:744
#define CKM_PKCS5_PBKD2
Definition pkcs11.h:790
CK_ULONG CK_ML_KEM_PARAMETER_SET_TYPE
Definition pkcs11.h:61
#define CKM_AES_GMAC
Definition pkcs11.h:897
#define CKM_KIP_DERIVE
Definition pkcs11.h:811
#define CKM_DSA_SHA3_512
Definition pkcs11.h:567
#define CKR_DEVICE_MEMORY
Definition pkcs11.h:1106
#define CKM_SHAKE_128_KEY_DERIVATION
Definition pkcs11.h:774
#define CKM_NULL
Definition pkcs11.h:951
#define CKA_JAVA_MIDP_SECURITY_DOMAIN
Definition pkcs11.h:155
#define CKM_SSL3_SHA1_MAC
Definition pkcs11.h:758
#define CKA_OTP_TIME_INTERVAL
Definition pkcs11.h:208
#define CKK_RC4
Definition pkcs11.h:474
#define CKK_SHA3_256_HMAC
Definition pkcs11.h:511
#define CKA_TOKEN
Definition pkcs11.h:140
#define CKR_GENERAL_ERROR
Definition pkcs11.h:1092
#define CKR_MECHANISM_INVALID
Definition pkcs11.h:1124
#define CKR_SLOT_ID_INVALID
Definition pkcs11.h:1091
#define CKC_VENDOR_DEFINED
Definition pkcs11.h:308
#define CKG_MGF1_SHA256
Definition pkcs11.h:445
#define CKM_SSL3_MASTER_KEY_DERIVE
Definition pkcs11.h:749
#define CKD_SHA3_512_KDF
Definition pkcs11.h:323
#define CKM_RSA_PKCS
Definition pkcs11.h:541
#define CKK_HKDF
Definition pkcs11.h:522
#define CKM_ECDSA_SHA1
Definition pkcs11.h:863
#define CKP_ML_DSA_87
Definition pkcs11.h:1066
#define CKM_CHACHA20_KEY_GEN
Definition pkcs11.h:922
#define CKR_KEY_CHANGED
Definition pkcs11.h:1118
#define CKK_SHA224_HMAC
Definition pkcs11.h:502
#define CKM_IDEA_ECB
Definition pkcs11.h:737
#define CKD_SHA512_KDF
Definition pkcs11.h:318
#define CKA_START_DATE
Definition pkcs11.h:174
#define CKK_DH
Definition pkcs11.h:468
CK_RV C_VerifyRecoverInit(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE)
#define CKA_TRUST_CODE_SIGNING
Definition pkcs11.h:281
#define CKK_RC5
Definition pkcs11.h:481
#define CKR_ATTRIBUTE_TYPE_INVALID
Definition pkcs11.h:1100
#define CKA_OTP_SERVICE_IDENTIFIER
Definition pkcs11.h:217
CK_RV C_DecryptVerifyUpdate(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
CK_RV C_DecryptMessageNext(CK_SESSION_HANDLE, void *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *, CK_FLAGS)
#define CKM_GOSTR3411_HMAC
Definition pkcs11.h:916
CK_RV(* CK_UNLOCKMUTEX)(void *)
Definition pkcs11.h:1262
CK_RV C_GetFunctionStatus(CK_SESSION_HANDLE)
#define CKK_BLAKE2B_256_HMAC
Definition pkcs11.h:515
CK_RV C_GetSessionInfo(CK_SESSION_HANDLE, CK_SESSION_INFO *)
#define CKM_WTLS_PRE_MASTER_KEY_GEN
Definition pkcs11.h:792
CK_RV C_DecryptMessageBegin(CK_SESSION_HANDLE, void *, CK_ULONG, CK_BYTE *, CK_ULONG)
#define CKM_BLAKE2B_512_HMAC
Definition pkcs11.h:968
#define CKM_SHA3_384_HMAC
Definition pkcs11.h:705
#define CKM_DES3_CMAC
Definition pkcs11.h:652
#define CKO_VALIDATION
Definition pkcs11.h:1039
#define CKM_RC2_MAC
Definition pkcs11.h:633
#define CKM_SHA256_KEY_DERIVATION
Definition pkcs11.h:762
#define CKA_SERIAL_NUMBER
Definition pkcs11.h:149
#define CKK_DES2
Definition pkcs11.h:476
#define CKF_LOGIN_REQUIRED
Definition pkcs11.h:416
#define CKM_SHA3_512_HMAC
Definition pkcs11.h:709
#define CKV_TYPE_FIRMWARE
Definition pkcs11.h:1225
#define CKF_HW_SLOT
Definition pkcs11.h:411
#define CKO_PUBLIC_KEY
Definition pkcs11.h:1031
#define CKM_BLAKE2B_160
Definition pkcs11.h:952
#define CKF_EC_UNCOMPRESS
Definition pkcs11.h:378
#define CKA_SUB_PRIME_BITS
Definition pkcs11.h:191
#define CKM_RSA_X_509
Definition pkcs11.h:543
#define CK_OTP_CHALLENGE
Definition pkcs11.h:102
#define CKF_LIBRARY_CANT_CREATE_OS_THREADS
Definition pkcs11.h:342
#define CKM_SEED_MAC_GENERAL
Definition pkcs11.h:835
#define CKF_PROTECTED_AUTHENTICATION_PATH
Definition pkcs11.h:420
CK_RV C_MessageVerifyInit(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE)
#define CKA_ISSUER
Definition pkcs11.h:148
#define CKM_ARIA_KEY_GEN
Definition pkcs11.h:823
#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY
Definition pkcs11.h:157
#define CKM_EC_KEY_PAIR_GEN_W_EXTRA_BITS
Definition pkcs11.h:868
#define CKR_FUNCTION_CANCELED
Definition pkcs11.h:1111
#define CKF_DECAPSULATE
Definition pkcs11.h:382
CK_ULONG CK_GENERATOR_FUNCTION
Definition pkcs11.h:50
#define CKA_TRUST_IPSEC_IKE
Definition pkcs11.h:283
#define CKA_UNIQUE_ID
Definition pkcs11.h:143
#define CKP_COMPLETE_PROVIDER
Definition pkcs11.h:1049
#define CKG_GENERATE_COUNTER_XOR
Definition pkcs11.h:441
#define CKR_PENDING
Definition pkcs11.h:1186
#define CKM_AES_CTR
Definition pkcs11.h:889
#define CKM_TLS12_MAC
Definition pkcs11.h:800
#define CKM_HASH_ML_DSA_SHA256
Definition pkcs11.h:574
#define CKM_IKE2_PRF_PLUS_DERIVE
Definition pkcs11.h:996
#define CKG_MGF1_SHA3_224
Definition pkcs11.h:449
#define CKM_DES3_CBC
Definition pkcs11.h:647
#define CKM_TWOFISH_CBC_PAD
Definition pkcs11.h:903
CK_RV C_MessageSignFinal(CK_SESSION_HANDLE)
#define CKM_SP800_108_FEEDBACK_KDF
Definition pkcs11.h:994
#define CKM_AES_CMAC
Definition pkcs11.h:893
#define CKM_BLAKE2B_256_KEY_GEN
Definition pkcs11.h:961
#define CKM_SKIPJACK_CFB8
Definition pkcs11.h:846
#define CKM_RSA_X9_31_KEY_PAIR_GEN
Definition pkcs11.h:550
CK_ULONG CK_SESSION_VALIDATION_FLAGS_TYPE
Definition pkcs11.h:75
#define CKR_KEY_UNEXTRACTABLE
Definition pkcs11.h:1123
#define CKR_DATA_INVALID
Definition pkcs11.h:1103
#define CKR_UNWRAPPING_KEY_HANDLE_INVALID
Definition pkcs11.h:1149
#define CKM_CONCATENATE_BASE_AND_KEY
Definition pkcs11.h:743
#define CKR_NEED_TO_CREATE_THREADS
Definition pkcs11.h:1096
#define CKA_X2RATCHET_HKS
Definition pkcs11.h:250
#define CKM_SHA_1_KEY_GEN
Definition pkcs11.h:943
CK_RV C_DigestKey(CK_SESSION_HANDLE, CK_OBJECT_HANDLE)
#define CKK_SHA256_HMAC
Definition pkcs11.h:499
#define CKM_DSA_SHA3_384
Definition pkcs11.h:566
#define CK_OTP_VALUE
Definition pkcs11.h:100
#define CKA_VALIDATION_MODULE_ID
Definition pkcs11.h:269
#define CKK_SHA512_T_HMAC
Definition pkcs11.h:525
#define CKP_SLH_DSA_SHA2_192F
Definition pkcs11.h:1080
#define CKM_SHA512_256
Definition pkcs11.h:612
#define CKM_SEED_ECB_ENCRYPT_DATA
Definition pkcs11.h:837
#define CKR_WRAPPING_KEY_SIZE_RANGE
Definition pkcs11.h:1161
#define CKM_FORTEZZA_TIMESTAMP
Definition pkcs11.h:853
#define CKS_RW_PUBLIC_SESSION
Definition pkcs11.h:1197
#define CKR_MECHANISM_PARAM_INVALID
Definition pkcs11.h:1125
#define CKA_SUPPORTED_CMS_ATTRIBUTES
Definition pkcs11.h:239
#define CKF_TOKEN_INITIALIZED
Definition pkcs11.h:422
#define CKR_TOKEN_NOT_RECOGNIZED
Definition pkcs11.h:1147
#define CKM_HASH_ML_DSA
Definition pkcs11.h:570
#define CKF_MESSAGE_ENCRYPT
Definition pkcs11.h:355
#define CKM_MD5
Definition pkcs11.h:666
CK_RV C_GetSlotInfo(CK_SLOT_ID, CK_SLOT_INFO *)
#define CKM_SHA512_HMAC_GENERAL
Definition pkcs11.h:689
#define CKM_SHA3_256_RSA_PKCS
Definition pkcs11.h:622
#define CKM_CAST3_ECB
Definition pkcs11.h:719
#define CKM_X2RATCHET_DECRYPT
Definition pkcs11.h:980
#define CKM_SKIPJACK_CFB64
Definition pkcs11.h:843
#define CKM_DES_CBC_ENCRYPT_DATA
Definition pkcs11.h:905
#define CK_FALSE
Definition pkcs11.h:37
#define CKC_WTLS
Definition pkcs11.h:307
#define CKM_SHA_1_HMAC
Definition pkcs11.h:670
#define CKD_SHA1_KDF_ASN1
Definition pkcs11.h:313
#define CKM_SHA3_224_HMAC_GENERAL
Definition pkcs11.h:702
#define CKR_ATTRIBUTE_SENSITIVE
Definition pkcs11.h:1099
#define CKM_HASH_SLH_DSA_SHA512
Definition pkcs11.h:593
#define CKG_MGF1_SHA512
Definition pkcs11.h:447
#define CKA_VALIDATION_LEVEL
Definition pkcs11.h:268
#define CKM_CAMELLIA_MAC
Definition pkcs11.h:817
#define CKA_HSS_KEYS_REMAINING
Definition pkcs11.h:263
#define CKM_IDEA_KEY_GEN
Definition pkcs11.h:736
CK_RV C_VerifySignature(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG)
#define CKV_TYPE_HYBRID
Definition pkcs11.h:1226
#define CKM_ECDH1_COFACTOR_DERIVE
Definition pkcs11.h:870
#define CKR_RANDOM_NO_RNG
Definition pkcs11.h:1164
#define CKR_PARAMETER_SET_NOT_SUPPORTED
Definition pkcs11.h:1191
#define CKM_ARIA_CBC_ENCRYPT_DATA
Definition pkcs11.h:830
#define CKM_SALSA20_KEY_GEN
Definition pkcs11.h:985
#define CKM_CAMELLIA_KEY_GEN
Definition pkcs11.h:814
#define CKR_PIN_LEN_RANGE
Definition pkcs11.h:1131
#define CKC_X_509
Definition pkcs11.h:305
#define CKF_DIGEST
Definition pkcs11.h:364
#define CKG_GENERATE
Definition pkcs11.h:438
#define CKM_BLAKE2B_384_HMAC
Definition pkcs11.h:963
#define CKM_HSS
Definition pkcs11.h:1001
#define CKA_PROFILE_ID
Definition pkcs11.h:240
#define CKM_SHA3_512_HMAC_GENERAL
Definition pkcs11.h:710
#define CKF_USER_PIN_FINAL_TRY
Definition pkcs11.h:425
#define CKM_ECDSA_SHA224
Definition pkcs11.h:864
#define CKF_DERIVE
Definition pkcs11.h:373
#define CKM_BATON_KEY_GEN
Definition pkcs11.h:854
CK_RV C_CreateObject(CK_SESSION_HANDLE, CK_ATTRIBUTE *, CK_ULONG, CK_OBJECT_HANDLE *)
#define CKR_DEVICE_ERROR
Definition pkcs11.h:1105
#define CKA_PRIVATE_EXPONENT
Definition pkcs11.h:179
#define CKR_RANDOM_SEED_NOT_SUPPORTED
Definition pkcs11.h:1163
#define CKM_XEDDSA
Definition pkcs11.h:981
#define CKP_ML_DSA_65
Definition pkcs11.h:1065
#define CKA_RESOLUTION
Definition pkcs11.h:228
#define CKK_SHA3_384_HMAC
Definition pkcs11.h:512
CK_RV C_WrapKey(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE, CK_OBJECT_HANDLE, CK_BYTE *, CK_ULONG *)
#define CKR_SESSION_PARALLEL_NOT_SUPPORTED
Definition pkcs11.h:1137
#define CKM_MD2
Definition pkcs11.h:663
CK_RV C_DigestEncryptUpdate(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKM_BATON_CBC128
Definition pkcs11.h:857
#define CKR_KEY_EXHAUSTED
Definition pkcs11.h:1185
CK_RV C_Sign(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKM_DSA
Definition pkcs11.h:557
#define CKA_ID
Definition pkcs11.h:163
#define CKA_OBJECT_ID
Definition pkcs11.h:146
#define CKM_AES_CFB8
Definition pkcs11.h:934
#define CKM_HKDF_DATA
Definition pkcs11.h:983
#define CKM_HASH_SLH_DSA_SHA224
Definition pkcs11.h:590
CK_RV C_EncryptMessageBegin(CK_SESSION_HANDLE, void *, CK_ULONG, CK_BYTE *, CK_ULONG)
#define CKM_CMS_SIG
Definition pkcs11.h:810
#define CKA_APPLICATION
Definition pkcs11.h:144
#define CKM_RIPEMD128
Definition pkcs11.h:672
#define CKA_HSS_LMOTS_TYPES
Definition pkcs11.h:262
CK_RV C_DeriveKey(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE, CK_ATTRIBUTE *, CK_ULONG, CK_OBJECT_HANDLE *)
#define CKF_VERIFY
Definition pkcs11.h:367
#define CKM_AES_CBC_PAD
Definition pkcs11.h:888
#define CKF_END_OF_MESSAGE
Definition pkcs11.h:390
CK_RV C_Initialize(void *)
#define CKA_X2RATCHET_NHKR
Definition pkcs11.h:252
#define CKG_MGF1_SHA224
Definition pkcs11.h:448
#define CKH_DETERMINISTIC_REQUIRED
Definition pkcs11.h:463
#define CKA_X2RATCHET_PNS
Definition pkcs11.h:256
#define CKM_CAST3_CBC
Definition pkcs11.h:720
#define CKM_ECDH1_DERIVE
Definition pkcs11.h:869
#define CK_OTP_TIME
Definition pkcs11.h:103
#define CKM_VENDOR_DEFINED
Definition pkcs11.h:1009
#define CKR_ATTRIBUTE_READ_ONLY
Definition pkcs11.h:1098
#define CKR_KEY_FUNCTION_NOT_PERMITTED
Definition pkcs11.h:1121
#define CKA_HW_FEATURE_TYPE
Definition pkcs11.h:223
#define CKM_TWOFISH_KEY_GEN
Definition pkcs11.h:900
#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT
Definition pkcs11.h:1162
#define CKN_SURRENDER
Definition pkcs11.h:1025
#define CKM_HASH_SLH_DSA_SHA384
Definition pkcs11.h:592
#define CK_OTP_OUTPUT_LENGTH
Definition pkcs11.h:106
#define CKK_CAST128
Definition pkcs11.h:480
#define CKA_DECAPSULATE
Definition pkcs11.h:287
#define CKA_VERIFY_RECOVER
Definition pkcs11.h:172
#define CKP_SLH_DSA_SHA2_128F
Definition pkcs11.h:1076
#define CKM_DSA_SHA3_256
Definition pkcs11.h:565
#define CK_OTP_PARAM_IGNORED
Definition pkcs11.h:116
#define CKM_AES_XTS
Definition pkcs11.h:881
#define CKA_TRUST_EMAIL_PROTECTION
Definition pkcs11.h:282
#define CKM_SHA512_224_HMAC_GENERAL
Definition pkcs11.h:610
#define CKP_PUBLIC_CERTIFICATES_TOKEN
Definition pkcs11.h:1048
#define CKD_SHA512_KDF_SP800
Definition pkcs11.h:328
#define CKM_SKIPJACK_RELAYX
Definition pkcs11.h:849
CK_ULONG CK_RV
Definition pkcs11.h:73
#define CKM_SHA512_224_HMAC
Definition pkcs11.h:609
#define CKA_VALIDATION_AUTHORITY_TYPE
Definition pkcs11.h:271
#define CKR_SESSION_EXISTS
Definition pkcs11.h:1139
#define CKM_MD5_HMAC_GENERAL
Definition pkcs11.h:668
#define CKM_MD2_RSA_PKCS
Definition pkcs11.h:544
#define CKR_FUNCTION_REJECTED
Definition pkcs11.h:1182
#define CKM_SHA_1_HMAC_GENERAL
Definition pkcs11.h:671
#define CKM_TLS10_MAC_CLIENT
Definition pkcs11.h:799
unsigned long int CK_ULONG
Definition pkcs11.h:20
#define CKO_SECRET_KEY
Definition pkcs11.h:1033
#define CKK_RSA
Definition pkcs11.h:466
#define CKM_JUNIPER_ECB128
Definition pkcs11.h:875
#define CKA_PUBLIC_EXPONENT
Definition pkcs11.h:178
#define CKM_SKIPJACK_CBC64
Definition pkcs11.h:841
#define CKS_LAST_VALIDATION_OK
Definition pkcs11.h:1202
#define CKM_DES_ECB
Definition pkcs11.h:639
CK_RV C_InitPIN(CK_SESSION_HANDLE, CK_UTF8CHAR *, CK_ULONG)
#define CKM_CAST_CBC
Definition pkcs11.h:714
#define CKA_VALIDATION_COUNTRY
Definition pkcs11.h:272
#define CKM_BLAKE2B_384
Definition pkcs11.h:962
#define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE
Definition pkcs11.h:796
CK_RV C_EncryptUpdate(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKM_PBE_SHA1_DES2_EDE_CBC
Definition pkcs11.h:787
#define CKM_X9_42_DH_KEY_PAIR_GEN
Definition pkcs11.h:585
#define CKK_CAMELLIA
Definition pkcs11.h:493
#define CKA_MODIFIABLE
Definition pkcs11.h:199
#define CRYPTOKI_VERSION_MINOR
Definition pkcs11.h:12
#define CKK_SEED
Definition pkcs11.h:503
#define CKM_RC5_MAC
Definition pkcs11.h:733
#define CKP_SLH_DSA_SHAKE_128F
Definition pkcs11.h:1077
CK_RV C_MessageEncryptFinal(CK_SESSION_HANDLE)
#define CKM_RSA_PKCS_KEY_PAIR_GEN
Definition pkcs11.h:540
#define CKA_ENCAPSULATE
Definition pkcs11.h:286
#define CKR_SESSION_READ_ONLY
Definition pkcs11.h:1138
#define CKK_KEA
Definition pkcs11.h:471
#define CKM_RC2_CBC
Definition pkcs11.h:632
#define CKP_ML_KEM_512
Definition pkcs11.h:1069
#define CKA_OTP_TIME_REQUIREMENT
Definition pkcs11.h:211
#define CKA_X2RATCHET_BAGSIZE
Definition pkcs11.h:242
#define CKM_IKE1_PRF_DERIVE
Definition pkcs11.h:998
#define CKM_KEA_KEY_DERIVE
Definition pkcs11.h:851
#define CKR_OPERATION_CANCEL_FAILED
Definition pkcs11.h:1184
#define CKD_BLAKE2B_384_KDF
Definition pkcs11.h:335
#define CKR_TOKEN_RESOURCE_EXCEEDED
Definition pkcs11.h:1183
#define CKC_X_509_ATTR_CERT
Definition pkcs11.h:306
#define CKM_JUNIPER_KEY_GEN
Definition pkcs11.h:874
#define CK_OTP_PARAM_OPTIONAL
Definition pkcs11.h:117
#define CKM_RC5_CBC
Definition pkcs11.h:732
CK_ULONG CK_VALIDATION_AUTHORITY_TYPE
Definition pkcs11.h:82
#define CKM_ARIA_CBC_PAD
Definition pkcs11.h:828
#define CKF_ASYNC_SESSION
Definition pkcs11.h:406
#define CKM_HSS_KEY_PAIR_GEN
Definition pkcs11.h:1000
#define CKA_VALIDATION_PROFILE
Definition pkcs11.h:276
#define CKR_ENCRYPTED_DATA_LEN_RANGE
Definition pkcs11.h:1109
#define CKM_SHA512_KEY_DERIVATION
Definition pkcs11.h:764
#define CKP_BASELINE_PROVIDER
Definition pkcs11.h:1045
#define CKA_BITS_PER_PIXEL
Definition pkcs11.h:232
#define CKR_SIGNATURE_INVALID
Definition pkcs11.h:1142
CK_RV C_AsyncJoin(CK_SESSION_HANDLE, CK_UTF8CHAR *, CK_ULONG, CK_BYTE *, CK_ULONG)
#define CKA_AC_ISSUER
Definition pkcs11.h:150
#define CKM_TLS_KDF
Definition pkcs11.h:807
#define CKM_AES_MAC_GENERAL
Definition pkcs11.h:887
#define CKM_X2RATCHET_INITIALIZE
Definition pkcs11.h:977
#define CKM_CAST128_CBC_PAD
Definition pkcs11.h:729
#define CKM_BATON_ECB128
Definition pkcs11.h:855
#define CKA_OTP_USER_IDENTIFIER
Definition pkcs11.h:216
#define CKM_BLOWFISH_CBC
Definition pkcs11.h:899
#define CKP_AUTHENTICATION_TOKEN
Definition pkcs11.h:1047
#define CKA_DECAPSULATE_TEMPLATE
Definition pkcs11.h:278
#define CKM_SHA3_256_RSA_PKCS_PSS
Definition pkcs11.h:625
#define CKM_FASTHASH
Definition pkcs11.h:880
#define CKM_TLS12_EXTENDED_MASTER_KEY_DERIVE_DH
Definition pkcs11.h:621
#define CKR_SESSION_HANDLE_INVALID
Definition pkcs11.h:1136
#define CKF_EC_F_2M
Definition pkcs11.h:375
#define CKM_XMSSMT
Definition pkcs11.h:1005
#define CKM_ARIA_ECB
Definition pkcs11.h:824
#define CKP_VENDOR_DEFINED
Definition pkcs11.h:1051
#define CKM_HASH_ML_DSA_SHAKE128
Definition pkcs11.h:581
#define CKM_X3DH_RESPOND
Definition pkcs11.h:976
CK_RV C_DecapsulateKey(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE, CK_ATTRIBUTE *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_OBJECT_HANDLE *)
#define CK_CERTIFICATE_CATEGORY_OTHER_ENTITY
Definition pkcs11.h:97
#define CKM_HKDF_KEY_GEN
Definition pkcs11.h:984
#define CKO_CERTIFICATE
Definition pkcs11.h:1030
#define CKA_CHECK_VALUE
Definition pkcs11.h:160
#define CKM_DES_CBC
Definition pkcs11.h:640
CK_RV C_UnwrapKeyAuthenticated(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE, CK_BYTE *, CK_ULONG, CK_ATTRIBUTE *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_OBJECT_HANDLE *)
#define CKF_USER_PIN_INITIALIZED
Definition pkcs11.h:417
CK_RV C_Login(CK_SESSION_HANDLE, CK_USER_TYPE, CK_UTF8CHAR *, CK_ULONG)
#define CKM_BLAKE2B_256
Definition pkcs11.h:957
CK_ULONG CK_NOTIFICATION
Definition pkcs11.h:62
#define CKA_PUBLIC_KEY_INFO
Definition pkcs11.h:185
CK_RV C_VerifyUpdate(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG)
#define CKA_X2RATCHET_HKR
Definition pkcs11.h:249
#define CKA_OTP_USER_FRIENDLY_MODE
Definition pkcs11.h:209
#define CKM_SHA384_HMAC_GENERAL
Definition pkcs11.h:686
#define CKK_SHA512_224_HMAC
Definition pkcs11.h:523
#define CKF_RW_SESSION
Definition pkcs11.h:404
#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN
Definition pkcs11.h:1156
#define CKM_SECURID_KEY_GEN
Definition pkcs11.h:690
#define CKM_IDEA_MAC_GENERAL
Definition pkcs11.h:740
#define CKS_RO_USER_FUNCTIONS
Definition pkcs11.h:1196
#define CKM_TLS_KEY_AND_MAC_DERIVE
Definition pkcs11.h:754
#define CKP_ML_DSA_44
Definition pkcs11.h:1064
#define CKM_GOST28147_ECB
Definition pkcs11.h:918
#define CKA_PRIME
Definition pkcs11.h:186
#define CKR_ARGUMENTS_BAD
Definition pkcs11.h:1094
CK_RV C_MessageEncryptInit(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE)
#define CKM_SECURID
Definition pkcs11.h:691
#define CKM_AES_CCM
Definition pkcs11.h:891
#define CKR_CANCEL
Definition pkcs11.h:1089
CK_RV C_GetTokenInfo(CK_SLOT_ID, CK_TOKEN_INFO *)
#define CKM_SHA512_224_KEY_DERIVATION
Definition pkcs11.h:611
#define CKM_SHA256
Definition pkcs11.h:678
#define CKV_TYPE_UNSPECIFIED
Definition pkcs11.h:1222
#define CKM_DSA_FIPS_G_GEN
Definition pkcs11.h:931
#define CKM_IDEA_CBC_PAD
Definition pkcs11.h:741
#define CKM_SHA512_T_HMAC_GENERAL
Definition pkcs11.h:618
#define CKK_BLOWFISH
Definition pkcs11.h:488
#define CKM_CDMF_CBC_PAD
Definition pkcs11.h:658
#define CKG_MGF1_SHA3_256
Definition pkcs11.h:450
#define CKV_AUTHORITY_TYPE_UNSPECIFIED
Definition pkcs11.h:1217
#define CKU_USER
Definition pkcs11.h:1213
#define CKR_PIN_TOO_WEAK
Definition pkcs11.h:1180
#define CKA_MODULUS
Definition pkcs11.h:176
unsigned char CK_BYTE
Definition pkcs11.h:17
#define CKM_AES_CFB64
Definition pkcs11.h:933
#define CKM_TLS_MASTER_KEY_DERIVE_DH
Definition pkcs11.h:755
#define CKA_PRIVATE
Definition pkcs11.h:141
#define CKM_DSA_SHA3_224
Definition pkcs11.h:564
#define CKM_DES_KEY_GEN
Definition pkcs11.h:638
CK_ULONG CK_SLOT_ID
Definition pkcs11.h:77
CK_RV C_MessageDecryptFinal(CK_SESSION_HANDLE)
CK_ULONG CK_FLAGS
Definition pkcs11.h:49
#define CK_OTP_PIN
Definition pkcs11.h:101
#define CKR_PIN_EXPIRED
Definition pkcs11.h:1132
#define CKM_HASH_ML_DSA_SHA384
Definition pkcs11.h:575
#define CKP_SLH_DSA_SHA2_192S
Definition pkcs11.h:1078
#define CKM_CAST3_MAC_GENERAL
Definition pkcs11.h:722
CK_ULONG CK_OBJECT_CLASS
Definition pkcs11.h:63
CK_RV C_GetSessionValidationFlags(CK_SESSION_HANDLE, CK_SESSION_VALIDATION_FLAGS_TYPE, CK_FLAGS *)
#define CKM_PBE_SHA1_RC2_128_CBC
Definition pkcs11.h:788
#define CKG_MGF1_SHA384
Definition pkcs11.h:446
#define CKM_AES_KEY_WRAP_KWP
Definition pkcs11.h:939
#define CKR_PIN_LOCKED
Definition pkcs11.h:1133
#define CKA_PRIME_1
Definition pkcs11.h:180
#define CKA_NAME_HASH_ALGORITHM
Definition pkcs11.h:159
#define CKM_DSA_SHA512
Definition pkcs11.h:562
#define CKM_SSL3_PRE_MASTER_KEY_GEN
Definition pkcs11.h:748
#define CKM_SSL3_MASTER_KEY_DERIVE_DH
Definition pkcs11.h:751
#define CK_SP800_108_ITERATION_VARIABLE
Definition pkcs11.h:127
#define CKM_IDEA_MAC
Definition pkcs11.h:739
#define CKR_LIBRARY_LOAD_FAILED
Definition pkcs11.h:1179
#define CKM_MD5_RSA_PKCS
Definition pkcs11.h:545
#define CKT_TRUST_MUST_VERIFY_TRUST
Definition pkcs11.h:1209
#define CKM_DSA_SHA384
Definition pkcs11.h:561
#define CKM_RIPEMD128_HMAC_GENERAL
Definition pkcs11.h:674
#define CKP_SLH_DSA_SHA2_256S
Definition pkcs11.h:1082
#define CKM_ECDH_X_AES_KEY_WRAP
Definition pkcs11.h:1006
#define CKF_WRAP
Definition pkcs11.h:371
#define CKK_DES
Definition pkcs11.h:475
#define CKM_PUB_KEY_FROM_PRIV_KEY
Definition pkcs11.h:1008
#define CKP_SLH_DSA_SHAKE_192F
Definition pkcs11.h:1081
CK_RV C_CopyObject(CK_SESSION_HANDLE, CK_OBJECT_HANDLE, CK_ATTRIBUTE *, CK_ULONG, CK_OBJECT_HANDLE *)
#define CKM_PBA_SHA1_WITH_SHA1_HMAC
Definition pkcs11.h:791
#define CKA_TRUST_OCSP_SIGNING
Definition pkcs11.h:285
#define CKA_OTP_SERVICE_LOGO_TYPE
Definition pkcs11.h:219
CK_ULONG CK_SESSION_HANDLE
Definition pkcs11.h:74
#define CKA_OTP_CHALLENGE_REQUIREMENT
Definition pkcs11.h:210
#define CKK_ACTI
Definition pkcs11.h:492
#define CKR_CANT_LOCK
Definition pkcs11.h:1097
#define CKM_DES_CBC_PAD
Definition pkcs11.h:643
#define CKR_TOKEN_NOT_PRESENT
Definition pkcs11.h:1146
#define CK_OTP_FORMAT_DECIMAL
Definition pkcs11.h:110
#define CKD_SHA3_256_KDF
Definition pkcs11.h:321
#define CKM_BLAKE2B_160_KEY_DERIVE
Definition pkcs11.h:955
#define CKA_OTP_FORMAT
Definition pkcs11.h:206
#define CKF_EXTENSION
Definition pkcs11.h:383
#define CKM_SHA512_T
Definition pkcs11.h:616
#define CKM_DES3_CBC_PAD
Definition pkcs11.h:650
#define CKM_BLAKE2B_256_HMAC
Definition pkcs11.h:958
#define CKM_SHA512_T_KEY_DERIVATION
Definition pkcs11.h:619
#define CKH_HEDGE_REQUIRED
Definition pkcs11.h:462
#define CKA_EC_POINT
Definition pkcs11.h:203
#define CKA_HSS_LMS_TYPES
Definition pkcs11.h:261
#define CKR_CRYPTOKI_NOT_INITIALIZED
Definition pkcs11.h:1171
#define CKM_SHA3_384
Definition pkcs11.h:704
#define CKG_MGF1_SHA3_384
Definition pkcs11.h:451
#define CKM_KEA_DERIVE
Definition pkcs11.h:852
#define CKM_DH_PKCS_DERIVE
Definition pkcs11.h:572
#define CKM_CAMELLIA_MAC_GENERAL
Definition pkcs11.h:818
#define CKA_SENSITIVE
Definition pkcs11.h:164
#define CKM_MD2_HMAC_GENERAL
Definition pkcs11.h:665
#define CKM_SHA3_512_KEY_DERIVATION
Definition pkcs11.h:772
#define CKF_EC_F_P
Definition pkcs11.h:374
#define CKM_SEED_CBC_ENCRYPT_DATA
Definition pkcs11.h:838
#define CKM_DES3_CMAC_GENERAL
Definition pkcs11.h:651
#define CKR_PIN_INCORRECT
Definition pkcs11.h:1129
#define CKM_CAST128_MAC_GENERAL
Definition pkcs11.h:728
#define CKM_HASH_SLH_DSA
Definition pkcs11.h:589
CK_ULONG CK_OTP_PARAM_TYPE
Definition pkcs11.h:65
#define CKP_ML_KEM_768
Definition pkcs11.h:1070
#define CKM_ARIA_CBC
Definition pkcs11.h:825
#define CK_CERTIFICATE_CATEGORY_TOKEN_USER
Definition pkcs11.h:95
#define CKM_CAMELLIA_CTR
Definition pkcs11.h:822
#define CK_SP800_108_KEY_HANDLE
Definition pkcs11.h:132
#define CKR_TOKEN_NOT_INITIALIZED
Definition pkcs11.h:1190
#define CKM_PBE_SHA1_RC4_40
Definition pkcs11.h:785
#define CKM_SHA3_512
Definition pkcs11.h:708
#define CKF_SEED_RANDOM_REQUIRED
Definition pkcs11.h:433
#define CKM_TLS10_MAC_SERVER
Definition pkcs11.h:798
#define CKF_MULTI_MESSAGE
Definition pkcs11.h:359
#define CKM_X9_42_DH_DERIVE
Definition pkcs11.h:586
#define CKF_GENERATE_KEY_PAIR
Definition pkcs11.h:370
#define CKM_AES_KEY_WRAP
Definition pkcs11.h:937
#define CKM_SKIPJACK_PRIVATE_WRAP
Definition pkcs11.h:848
#define CKF_SIGN_RECOVER
Definition pkcs11.h:366
#define CKA_SIGN_RECOVER
Definition pkcs11.h:170
#define CKM_KEY_WRAP_LYNKS
Definition pkcs11.h:808
#define CKM_SHA512_RSA_PKCS_PSS
Definition pkcs11.h:605
#define CKO_PROFILE
Definition pkcs11.h:1038
#define CKM_SHA3_384_RSA_PKCS
Definition pkcs11.h:623
#define CKA_X2RATCHET_CKS
Definition pkcs11.h:245
#define CKF_REMOVABLE_DEVICE
Definition pkcs11.h:410
#define CKK_SLH_DSA
Definition pkcs11.h:531
#define CKP_PKCS5_PBKD2_HMAC_SHA512_256
Definition pkcs11.h:1061
#define CKM_CAMELLIA_CBC
Definition pkcs11.h:816
#define CKM_ECDSA_SHA512
Definition pkcs11.h:867
#define CKM_RSA_PKCS_OAEP
Definition pkcs11.h:549
#define CK_SECURITY_DOMAIN_MANUFACTURER
Definition pkcs11.h:122
#define CKM_DES_OFB64
Definition pkcs11.h:659
#define CKP_SLH_DSA_SHA2_256F
Definition pkcs11.h:1084
#define CKM_HASH_SLH_DSA_SHA3_224
Definition pkcs11.h:594
#define CKR_WRAPPED_KEY_INVALID
Definition pkcs11.h:1158
#define CKF_SECONDARY_AUTHENTICATION
Definition pkcs11.h:423
CK_RV C_GetObjectSize(CK_SESSION_HANDLE, CK_OBJECT_HANDLE, CK_ULONG *)
#define CKO_OTP_KEY
Definition pkcs11.h:1037
#define CKM_PBE_SHA1_RC4_128
Definition pkcs11.h:784
#define CKM_CDMF_MAC
Definition pkcs11.h:656
#define CKM_RSA_PKCS_OAEP_TPM_1_1
Definition pkcs11.h:942
#define CKM_SHA512_RSA_PKCS
Definition pkcs11.h:602
#define CKA_X2RATCHET_BOBS1STMSG
Definition pkcs11.h:243
#define CKA_EXPONENT_1
Definition pkcs11.h:182
#define CKD_BLAKE2B_512_KDF
Definition pkcs11.h:336
#define CKM_DES3_MAC_GENERAL
Definition pkcs11.h:649
#define CKM_SP800_108_COUNTER_KDF
Definition pkcs11.h:993
CK_RV C_SignRecoverInit(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE)
#define CKM_CAST_CBC_PAD
Definition pkcs11.h:717
#define CKF_HKDF_SALT_DATA
Definition pkcs11.h:347
#define CKP_PKCS5_PBKD2_HMAC_SHA224
Definition pkcs11.h:1056
#define CKM_SLH_DSA
Definition pkcs11.h:584
#define CKM_SHA224_HMAC
Definition pkcs11.h:682
#define CKM_SSL3_MD5_MAC
Definition pkcs11.h:757
#define CKM_EXTRACT_KEY_FROM_KEY
Definition pkcs11.h:747
CK_RV C_AsyncComplete(CK_SESSION_HANDLE, CK_UTF8CHAR *, CK_ASYNC_DATA *)
CK_RV C_SignInit(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE)
#define CKM_SKIPJACK_CFB32
Definition pkcs11.h:844
#define CKM_ECMQV_DERIVE
Definition pkcs11.h:871
#define CKA_SIGN
Definition pkcs11.h:169
#define CKM_ECDSA_SHA3_224
Definition pkcs11.h:986
#define CKM_AES_KEY_GEN
Definition pkcs11.h:883
#define CKF_USER_FRIENDLY_OTP
Definition pkcs11.h:398
#define CKR_WRAPPING_KEY_HANDLE_INVALID
Definition pkcs11.h:1160
#define CKM_SHA3_384_HMAC_GENERAL
Definition pkcs11.h:706
#define CKR_MUTEX_NOT_LOCKED
Definition pkcs11.h:1174
#define CKR_USER_TOO_MANY_TYPES
Definition pkcs11.h:1157
#define CKM_CAST_MAC_GENERAL
Definition pkcs11.h:716
CK_RV C_GetFunctionList(CK_FUNCTION_LIST **)
#define CKA_X2RATCHET_NHKS
Definition pkcs11.h:253
CK_ULONG CK_USER_TYPE
Definition pkcs11.h:81
CK_RV C_WrapKeyAuthenticated(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE, CK_OBJECT_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKM_SP800_108_DOUBLE_PIPELINE_KDF
Definition pkcs11.h:995
CK_RV C_SignRecover(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKM_BLAKE2B_512_HMAC_GENERAL
Definition pkcs11.h:969
#define CKM_SHA3_512_KEY_GEN
Definition pkcs11.h:711
#define CKF_USER_PIN_COUNT_LOW
Definition pkcs11.h:424
#define CKM_IDEA_CBC
Definition pkcs11.h:738
#define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC
Definition pkcs11.h:794
#define CKR_SESSION_CLOSED
Definition pkcs11.h:1134
#define CKM_EDDSA
Definition pkcs11.h:992
CK_RV C_SignMessageNext(CK_SESSION_HANDLE, void *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKR_AEAD_DECRYPT_FAILED
Definition pkcs11.h:1110
#define CKM_BLAKE2B_384_KEY_GEN
Definition pkcs11.h:966
#define CKA_EXPONENT_2
Definition pkcs11.h:183
#define CK_SECURITY_DOMAIN_THIRD_PARTY
Definition pkcs11.h:124
#define CKK_RIPEMD160_HMAC
Definition pkcs11.h:498
CK_RV C_FindObjectsInit(CK_SESSION_HANDLE, CK_ATTRIBUTE *, CK_ULONG)
#define CK_TRUE
Definition pkcs11.h:36
#define CKM_DSA_KEY_PAIR_GEN
Definition pkcs11.h:556
CK_RV C_VerifyMessageBegin(CK_SESSION_HANDLE, void *, CK_ULONG)
#define CKM_RC4_KEY_GEN
Definition pkcs11.h:636
#define CKM_ACTI_KEY_GEN
Definition pkcs11.h:695
#define CKM_SHA224
Definition pkcs11.h:681
#define CKM_SHA1_RSA_X9_31
Definition pkcs11.h:552
#define CKM_AES_CBC_ENCRYPT_DATA
Definition pkcs11.h:909
#define CKA_VALUE
Definition pkcs11.h:145
#define CKA_URL
Definition pkcs11.h:156
#define CKM_GOSTR3410
Definition pkcs11.h:911
CK_RV C_GetInterfaceList(CK_INTERFACE *, CK_ULONG *)
#define CKM_XMSS
Definition pkcs11.h:1004
#define CKM_CAMELLIA_CBC_PAD
Definition pkcs11.h:819
#define CKM_SHA3_384_KEY_GEN
Definition pkcs11.h:707
#define CKP_HKDF_TLS_TOKEN
Definition pkcs11.h:1050
#define CKM_HASH_SLH_DSA_SHA3_256
Definition pkcs11.h:595
#define CKF_EXCLUDE_COUNTER
Definition pkcs11.h:395
CK_RV C_DigestUpdate(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG)
#define CKM_CAMELLIA_ECB_ENCRYPT_DATA
Definition pkcs11.h:820
#define CKM_SKIPJACK_CFB16
Definition pkcs11.h:845
#define CKK_JUNIPER
Definition pkcs11.h:485
#define CKM_WTLS_MASTER_KEY_DERIVE
Definition pkcs11.h:793
#define CKM_SKIPJACK_KEY_GEN
Definition pkcs11.h:839
#define CKH_MONOTONIC_COUNTER
Definition pkcs11.h:455
#define CKM_POLY1305
Definition pkcs11.h:925
#define CKF_ENCRYPT
Definition pkcs11.h:362
#define CKM_SHA3_384_RSA_PKCS_PSS
Definition pkcs11.h:626
#define CKK_CHACHA20
Definition pkcs11.h:507
#define CKK_XMSS
Definition pkcs11.h:527
#define CKF_OS_LOCKING_OK
Definition pkcs11.h:343
#define CKM_GOST28147_KEY_WRAP
Definition pkcs11.h:921
#define CKM_SHA224_RSA_PKCS_PSS
Definition pkcs11.h:607
CK_ULONG CK_ML_DSA_PARAMETER_SET_TYPE
Definition pkcs11.h:60
#define CKA_LOCAL
Definition pkcs11.h:195
CK_RV C_Digest(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKM_EC_EDWARDS_KEY_PAIR_GEN
Definition pkcs11.h:990
#define CKM_MD5_KEY_DERIVATION
Definition pkcs11.h:759
#define CKM_BATON_ECB96
Definition pkcs11.h:856
#define CKP_PKCS5_PBKD2_HMAC_SHA384
Definition pkcs11.h:1058
#define CKD_SHA384_KDF_SP800
Definition pkcs11.h:327
#define CKM_CAST3_MAC
Definition pkcs11.h:721
#define CKR_OBJECT_HANDLE_INVALID
Definition pkcs11.h:1126
struct CK_FUNCTION_LIST * CK_FUNCTION_LIST_PTR
Definition pkcs11.h:1245
#define CKF_EC_ECPARAMETERS
Definition pkcs11.h:376
#define CKM_CDMF_KEY_GEN
Definition pkcs11.h:653
#define CKM_SHA512_224
Definition pkcs11.h:608
CK_ULONG CK_PRF_DATA_TYPE
Definition pkcs11.h:68
#define CKD_SHA256_KDF_SP800
Definition pkcs11.h:326
CK_RV C_CloseAllSessions(CK_SLOT_ID)
#define CKM_KEA_KEY_PAIR_GEN
Definition pkcs11.h:850
#define CKG_MGF1_SHA3_512
Definition pkcs11.h:452
#define CKM_SHA256_HMAC
Definition pkcs11.h:679
#define CKA_RESET_ON_INIT
Definition pkcs11.h:224
#define CKA_VERIFY
Definition pkcs11.h:171
#define CKR_PIN_INVALID
Definition pkcs11.h:1130
CK_RV C_VerifyFinal(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG)
#define CKA_OTP_PIN_REQUIREMENT
Definition pkcs11.h:213
#define CKF_EC_OID
Definition pkcs11.h:377
CK_ULONG CK_RSA_PKCS_MGF_TYPE
Definition pkcs11.h:71
#define CKR_UNWRAPPING_KEY_SIZE_RANGE
Definition pkcs11.h:1150
#define CKM_HASH_SLH_DSA_SHA256
Definition pkcs11.h:591
#define CKM_X9_42_MQV_DERIVE
Definition pkcs11.h:588
CK_RV C_DecryptFinal(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG *)
#define CKM_TLS12_EXTENDED_MASTER_KEY_DERIVE
Definition pkcs11.h:620
CK_RV C_EncryptInit(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE)
CK_RV C_MessageSignInit(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE)
#define CKM_GOST28147
Definition pkcs11.h:919
CK_RV C_GenerateKey(CK_SESSION_HANDLE, CK_MECHANISM *, CK_ATTRIBUTE *, CK_ULONG, CK_OBJECT_HANDLE *)
#define CKM_CDMF_ECB
Definition pkcs11.h:654
#define CKD_CPDIVERSIFY_KDF
Definition pkcs11.h:319
void * CK_VOID_PTR
Definition pkcs11.h:30
#define CKM_POLY1305_KEY_GEN
Definition pkcs11.h:924
#define CKM_TLS12_MASTER_KEY_DERIVE
Definition pkcs11.h:802
#define CKM_BLAKE2B_384_HMAC_GENERAL
Definition pkcs11.h:964
CK_RV C_Logout(CK_SESSION_HANDLE)
#define CKM_SHA256_KEY_GEN
Definition pkcs11.h:945
#define CKO_DATA
Definition pkcs11.h:1029
#define CKM_SHA3_224_RSA_PKCS
Definition pkcs11.h:628
#define CKM_BATON_SHUFFLE
Definition pkcs11.h:859
#define CKO_PRIVATE_KEY
Definition pkcs11.h:1032
#define CKM_SHA3_224
Definition pkcs11.h:700
#define CKM_HASH_SLH_DSA_SHAKE256
Definition pkcs11.h:599
#define CKM_SHA512_256_HMAC_GENERAL
Definition pkcs11.h:614
CK_RV C_EncryptMessageNext(CK_SESSION_HANDLE, void *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *, CK_FLAGS)
#define CKK_IDEA
Definition pkcs11.h:482
#define CKM_RC5_MAC_GENERAL
Definition pkcs11.h:734
CK_RV C_GetInfo(CK_INFO *)
#define CKD_SHA384_KDF
Definition pkcs11.h:317
#define CKR_ENCRYPTED_DATA_INVALID
Definition pkcs11.h:1108
#define CKM_RC2_CBC_PAD
Definition pkcs11.h:635
CK_ULONG CK_SLH_DSA_PARAMETER_SET_TYPE
Definition pkcs11.h:76
#define CKP_PKCS5_PBKD2_HMAC_GOSTR3411
Definition pkcs11.h:1055
#define CKM_SEED_CBC_PAD
Definition pkcs11.h:836
#define CKR_CRYPTOKI_ALREADY_INITIALIZED
Definition pkcs11.h:1172
#define CKM_GENERIC_SECRET_KEY_GEN
Definition pkcs11.h:742
#define CKM_DH_PKCS_KEY_PAIR_GEN
Definition pkcs11.h:571
#define CKF_EC_CURVENAME
Definition pkcs11.h:380
#define CKM_DES3_ECB_ENCRYPT_DATA
Definition pkcs11.h:906
CK_RV(* CK_LOCKMUTEX)(void *)
Definition pkcs11.h:1261
#define CKA_X2RATCHET_NS
Definition pkcs11.h:255
#define CKP_SLH_DSA_SHAKE_256S
Definition pkcs11.h:1083
#define CKA_ALLOWED_MECHANISMS
Definition pkcs11.h:296
CK_ULONG CK_TRUST
Definition pkcs11.h:80
#define CK_OTP_FLAGS
Definition pkcs11.h:105
#define CKF_SERIAL_SESSION
Definition pkcs11.h:405
#define CKR_FUNCTION_FAILED
Definition pkcs11.h:1093
#define CKA_X2RATCHET_NR
Definition pkcs11.h:254
#define CKA_VALIDATION_CERTIFICATE_URI
Definition pkcs11.h:274
#define CKM_CDMF_MAC_GENERAL
Definition pkcs11.h:657
#define CKH_CLOCK
Definition pkcs11.h:456
#define CKA_OTP_COUNTER_REQUIREMENT
Definition pkcs11.h:212
#define CKM_SHA384
Definition pkcs11.h:684
#define CKA_COPYABLE
Definition pkcs11.h:200
#define CKM_SHA512_KEY_GEN
Definition pkcs11.h:947
#define CKF_ENCAPSULATE
Definition pkcs11.h:381
#define CKF_DUAL_CRYPTO_OPERATIONS
Definition pkcs11.h:421
#define CKA_PRIME_2
Definition pkcs11.h:181
#define CKR_OPERATION_NOT_INITIALIZED
Definition pkcs11.h:1128
CK_ULONG CK_CERTIFICATE_CATEGORY
Definition pkcs11.h:45
#define CKR_ACTION_PROHIBITED
Definition pkcs11.h:1102
#define CKF_SO_PIN_TO_BE_CHANGED
Definition pkcs11.h:431
CK_RV C_SetAttributeValue(CK_SESSION_HANDLE, CK_OBJECT_HANDLE, CK_ATTRIBUTE *, CK_ULONG)
#define CKR_SESSION_READ_ONLY_EXISTS
Definition pkcs11.h:1140
#define CKM_TLS_PRE_MASTER_KEY_GEN
Definition pkcs11.h:752
#define CKM_EC_KEY_PAIR_GEN
Definition pkcs11.h:861
#define CKM_SHA384_KEY_GEN
Definition pkcs11.h:946
#define CKK_DSA
Definition pkcs11.h:467
#define CKR_SESSION_READ_WRITE_SO_EXISTS
Definition pkcs11.h:1141
#define CKM_RC5_KEY_GEN
Definition pkcs11.h:730
#define CKK_BATON
Definition pkcs11.h:484
#define CKR_KEY_SIZE_RANGE
Definition pkcs11.h:1115
#define CKA_X2RATCHET_ISALICE
Definition pkcs11.h:251
#define CKM_AES_GCM
Definition pkcs11.h:890
#define CKM_DH_PKCS_PARAMETER_GEN
Definition pkcs11.h:927
#define CKM_PBE_MD5_CAST128_CBC
Definition pkcs11.h:782
#define CKM_SHA384_HMAC
Definition pkcs11.h:685
#define CKM_BLAKE2B_160_KEY_GEN
Definition pkcs11.h:956
CK_RV C_AsyncGetID(CK_SESSION_HANDLE, CK_UTF8CHAR *, CK_ULONG *)
#define CKR_TEMPLATE_INCONSISTENT
Definition pkcs11.h:1145
#define CKM_CDMF_CBC
Definition pkcs11.h:655
#define CKA_TRUST_SERVER_AUTH
Definition pkcs11.h:279
#define CKA_COLOR
Definition pkcs11.h:231
CK_RV C_SessionCancel(CK_SESSION_HANDLE, CK_FLAGS)
#define CKM_RC5_CBC_PAD
Definition pkcs11.h:735
#define CKR_OPERATION_ACTIVE
Definition pkcs11.h:1127
#define CKR_DATA_LEN_RANGE
Definition pkcs11.h:1104
#define CKO_MECHANISM
Definition pkcs11.h:1036
#define CKA_UNWRAP
Definition pkcs11.h:168
#define CKM_HKDF_DERIVE
Definition pkcs11.h:982
CK_RV C_CancelFunction(CK_SESSION_HANDLE)
#define CKM_SHA1_RSA_PKCS
Definition pkcs11.h:546
#define CKF_ARRAY_ATTRIBUTE
Definition pkcs11.h:339
#define CKK_GOSTR3410
Definition pkcs11.h:504
#define CKM_SHA512
Definition pkcs11.h:687
#define CKM_MD2_KEY_DERIVATION
Definition pkcs11.h:760
CK_ULONG CK_KEY_TYPE
Definition pkcs11.h:55
#define CKM_ML_KEM
Definition pkcs11.h:563
#define CKK_AES_XTS
Definition pkcs11.h:509
#define CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN
Definition pkcs11.h:930
#define CKA_TRUSTED
Definition pkcs11.h:153
#define CK_OTP_COUNTER
Definition pkcs11.h:104
#define CKM_SHA512_224_KEY_GEN
Definition pkcs11.h:948
unsigned char CK_BBOOL
Definition pkcs11.h:16
CK_RV C_InitToken(CK_SLOT_ID, CK_UTF8CHAR *, CK_ULONG, CK_UTF8CHAR *)
#define CKA_WRAP_WITH_TRUSTED
Definition pkcs11.h:205
#define CKK_GOSTR3411
Definition pkcs11.h:505
CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE
Definition pkcs11.h:66
#define CKA_HSS_LMS_TYPE
Definition pkcs11.h:259
#define CKR_BUFFER_TOO_SMALL
Definition pkcs11.h:1167
#define CKM_ARIA_MAC_GENERAL
Definition pkcs11.h:827
#define CKM_X2RATCHET_RESPOND
Definition pkcs11.h:978
#define CKU_SO
Definition pkcs11.h:1212
#define CKM_CAMELLIA_CBC_ENCRYPT_DATA
Definition pkcs11.h:821
#define CKM_AES_CFB128
Definition pkcs11.h:935
CK_RV C_DestroyObject(CK_SESSION_HANDLE, CK_OBJECT_HANDLE)
CK_RV C_GetOperationState(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG *)
#define CKS_RW_USER_FUNCTIONS
Definition pkcs11.h:1198
#define CKM_AES_CMAC_GENERAL
Definition pkcs11.h:894
#define CKS_RO_PUBLIC_SESSION
Definition pkcs11.h:1195
CK_RV C_DecryptUpdate(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CK_OTP_FORMAT_BINARY
Definition pkcs11.h:113
#define CKO_HW_FEATURE
Definition pkcs11.h:1034
#define CK_SP800_108_COUNTER
Definition pkcs11.h:129
#define CKF_HKDF_SALT_KEY
Definition pkcs11.h:348
#define CKM_HASH_SLH_DSA_SHA3_512
Definition pkcs11.h:597
#define CKM_XMSSMT_KEY_PAIR_GEN
Definition pkcs11.h:1003
#define CKA_DECRYPT
Definition pkcs11.h:166
#define CKM_PBE_MD5_CAST_CBC
Definition pkcs11.h:780
CK_RV C_GenerateKeyPair(CK_SESSION_HANDLE, CK_MECHANISM *, CK_ATTRIBUTE *, CK_ULONG, CK_ATTRIBUTE *, CK_ULONG, CK_OBJECT_HANDLE *, CK_OBJECT_HANDLE *)
#define CKK_BLAKE2B_384_HMAC
Definition pkcs11.h:516
#define CKM_SHA1_KEY_DERIVATION
Definition pkcs11.h:761
#define CKA_OTP_LENGTH
Definition pkcs11.h:207
#define CKF_EXCLUDE_CHALLENGE
Definition pkcs11.h:396
#define CKP_SLH_DSA_SHA2_128S
Definition pkcs11.h:1074
#define CKO_VENDOR_DEFINED
Definition pkcs11.h:1041
#define CKP_PKCS5_PBKD2_HMAC_SHA512
Definition pkcs11.h:1059
CK_RV C_SetOperationState(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_OBJECT_HANDLE, CK_OBJECT_HANDLE)
#define CKA_KEY_TYPE
Definition pkcs11.h:161
#define CKR_USER_PIN_NOT_INITIALIZED
Definition pkcs11.h:1154
#define CKN_OTP_CHANGED
Definition pkcs11.h:1026
#define CKM_RIPEMD160
Definition pkcs11.h:675
#define CKA_ALWAYS_AUTHENTICATE
Definition pkcs11.h:204
#define CKM_RSA_9796
Definition pkcs11.h:542
#define CKM_SLH_DSA_KEY_PAIR_GEN
Definition pkcs11.h:583
#define CKK_CAST
Definition pkcs11.h:478
#define CKH_HEDGE_PREFERRED
Definition pkcs11.h:461
#define CKM_JUNIPER_WRAP
Definition pkcs11.h:879
#define CKM_EC_MONTGOMERY_KEY_PAIR_GEN
Definition pkcs11.h:991
#define CKA_VALUE_LEN
Definition pkcs11.h:193
#define CKA_CHAR_ROWS
Definition pkcs11.h:229
#define CKM_CAST_ECB
Definition pkcs11.h:713
#define CKM_HASH_SLH_DSA_SHAKE128
Definition pkcs11.h:598
#define CKM_BATON_COUNTER
Definition pkcs11.h:858
#define CKM_CAST3_KEY_GEN
Definition pkcs11.h:718
#define CKM_TLS_PRF
Definition pkcs11.h:756
#define CKM_JUNIPER_CBC128
Definition pkcs11.h:876
#define CKK_RC2
Definition pkcs11.h:473
#define CKM_SHA224_RSA_PKCS
Definition pkcs11.h:606
#define CKM_PBE_SHA1_DES3_EDE_CBC
Definition pkcs11.h:786
#define CKR_USER_ALREADY_LOGGED_IN
Definition pkcs11.h:1152
#define CKM_ML_DSA
Definition pkcs11.h:569
#define CKA_PARAMETER_SET
Definition pkcs11.h:264
#define CKK_SHA384_HMAC
Definition pkcs11.h:500
#define CK_OTP_FORMAT_HEXADECIMAL
Definition pkcs11.h:111
#define CKR_STATE_UNSAVEABLE
Definition pkcs11.h:1170
#define CKM_RIPEMD160_RSA_PKCS
Definition pkcs11.h:548
#define CKK_EC_EDWARDS
Definition pkcs11.h:520
#define CKT_TRUSTED
Definition pkcs11.h:1206
#define CKF_RNG
Definition pkcs11.h:414
#define CKP_PKCS5_PBKD2_HMAC_SHA1
Definition pkcs11.h:1054
#define CKM_AES_CTS
Definition pkcs11.h:892
#define CKA_GOST28147_PARAMS
Definition pkcs11.h:222
#define CKM_X9_42_DH_PARAMETER_GEN
Definition pkcs11.h:928
#define CKF_HKDF_SALT_NULL
Definition pkcs11.h:346
#define CKK_RIPEMD128_HMAC
Definition pkcs11.h:497
#define CKF_SIGN
Definition pkcs11.h:365
#define CKM_JUNIPER_COUNTER
Definition pkcs11.h:877
#define CKA_TRUST_CLIENT_AUTH
Definition pkcs11.h:280
#define CKD_SHA1_KDF_CONCATENATE
Definition pkcs11.h:314
#define CKF_GENERATE
Definition pkcs11.h:369
#define CKM_SHA512_256_HMAC
Definition pkcs11.h:613
#define CKA_VALIDATION_FLAG
Definition pkcs11.h:270
#define CKA_HSS_LMOTS_TYPE
Definition pkcs11.h:260
#define CKM_KIP_WRAP
Definition pkcs11.h:812
#define CKK_POLY1305
Definition pkcs11.h:508
CK_ULONG CK_MECHANISM_TYPE
Definition pkcs11.h:59
CK_ULONG CK_SP800_108_DKM_LENGTH_METHOD
Definition pkcs11.h:78
#define CKK_GENERIC_SECRET
Definition pkcs11.h:472
#define CKM_TLS12_KEY_SAFE_DERIVE
Definition pkcs11.h:805
#define CKM_PBE_SHA1_CAST128_CBC
Definition pkcs11.h:783
#define CKU_CONTEXT_SPECIFIC
Definition pkcs11.h:1214
#define CKD_SHA3_512_KDF_SP800
Definition pkcs11.h:332
#define CKP_PKCS5_PBKD2_HMAC_SHA512_224
Definition pkcs11.h:1060
#define CKM_SHA3_512_RSA_PKCS
Definition pkcs11.h:624
#define CKA_VALUE_BITS
Definition pkcs11.h:192
#define CKM_TLS12_KDF
Definition pkcs11.h:801
#define CKK_SALSA20
Definition pkcs11.h:518
#define CKF_SO_PIN_FINAL_TRY
Definition pkcs11.h:429
#define CKF_EXCLUDE_PIN
Definition pkcs11.h:397
CK_RV C_Decrypt(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKA_COEFFICIENT
Definition pkcs11.h:184
#define CKR_INFORMATION_SENSITIVE
Definition pkcs11.h:1169
#define CKR_NEW_PIN_MODE
Definition pkcs11.h:1175
#define CKM_SHA3_384_KEY_DERIVATION
Definition pkcs11.h:770
#define CKG_GENERATE_COUNTER
Definition pkcs11.h:439
#define CKM_AES_KEY_WRAP_PAD
Definition pkcs11.h:938
#define CKR_OK
Definition pkcs11.h:1088
#define CKM_CONCATENATE_DATA_AND_BASE
Definition pkcs11.h:745
#define CKM_BLAKE2B_512
Definition pkcs11.h:967
#define CKD_SHA3_384_KDF_SP800
Definition pkcs11.h:331
#define CKM_GOSTR3410_KEY_WRAP
Definition pkcs11.h:913
#define CKA_OWNER
Definition pkcs11.h:151
#define CKV_TYPE_SOFTWARE
Definition pkcs11.h:1223
#define CKM_BLAKE2B_160_HMAC_GENERAL
Definition pkcs11.h:954
CK_RV C_DigestInit(CK_SESSION_HANDLE, CK_MECHANISM *)
#define CKM_XOR_BASE_AND_DATA
Definition pkcs11.h:746
CK_RV(* CK_NOTIFY)(CK_SESSION_HANDLE, CK_NOTIFICATION, void *)
Definition pkcs11.h:1258
#define CKA_DESTROYABLE
Definition pkcs11.h:201
#define CKM_ECDSA
Definition pkcs11.h:862
#define CKM_ECDSA_SHA384
Definition pkcs11.h:866
#define CKM_RSA_X9_31
Definition pkcs11.h:551
#define CKM_XMSS_KEY_PAIR_GEN
Definition pkcs11.h:1002
#define CKM_GOST28147_KEY_GEN
Definition pkcs11.h:917
#define CKM_HASH_ML_DSA_SHA224
Definition pkcs11.h:573
#define CKK_CAST3
Definition pkcs11.h:479
#define CKA_SUBPRIME
Definition pkcs11.h:187
#define CKA_DERIVE
Definition pkcs11.h:173
#define CKF_MESSAGE_DECRYPT
Definition pkcs11.h:356
#define CKR_OPERATION_NOT_VALIDATED
Definition pkcs11.h:1189
#define CKK_SHA3_512_HMAC
Definition pkcs11.h:513
#define CKK_SKIPJACK
Definition pkcs11.h:483
#define CKR_ATTRIBUTE_VALUE_INVALID
Definition pkcs11.h:1101
#define CK_SP800_108_DKM_LENGTH_SUM_OF_SEGMENTS
Definition pkcs11.h:136
#define CKA_REQUIRED_CMS_ATTRIBUTES
Definition pkcs11.h:237
#define CKM_GOSTR3411
Definition pkcs11.h:915
#define CKM_DSA_PROBABILISTIC_PARAMETER_GEN
Definition pkcs11.h:929
#define CKP_EXTENDED_PROVIDER
Definition pkcs11.h:1046
#define CK_CERTIFICATE_CATEGORY_AUTHORITY
Definition pkcs11.h:96
CK_RV C_UnwrapKey(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE, CK_BYTE *, CK_ULONG, CK_ATTRIBUTE *, CK_ULONG, CK_OBJECT_HANDLE *)
CK_ULONG CK_VALIDATION_TYPE
Definition pkcs11.h:83
CK_RV C_GetMechanismInfo(CK_SLOT_ID, CK_MECHANISM_TYPE, CK_MECHANISM_INFO *)
#define CKM_PBE_MD2_DES_CBC
Definition pkcs11.h:778
#define CKM_DES_OFB8
Definition pkcs11.h:660
#define CKM_RIPEMD160_HMAC
Definition pkcs11.h:676
#define CKM_HOTP
Definition pkcs11.h:693
#define CKK_HSS
Definition pkcs11.h:526
#define CKA_VALIDATION_TYPE
Definition pkcs11.h:266
#define CKM_KEY_WRAP_SET_OAEP
Definition pkcs11.h:809
#define CKM_KIP_MAC
Definition pkcs11.h:813
CK_RV C_EncapsulateKey(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE, CK_ATTRIBUTE *, CK_ULONG, CK_BYTE *, CK_ULONG *, CK_OBJECT_HANDLE *)
#define CKA_MIME_TYPES
Definition pkcs11.h:235
#define CKP_SLH_DSA_SHAKE_128S
Definition pkcs11.h:1075
#define CKM_CAST3_CBC_PAD
Definition pkcs11.h:723
CK_RV C_Verify(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG)
#define CKM_ECDSA_SHA3_256
Definition pkcs11.h:987
CK_RV C_SeedRandom(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG)
#define CKA_CERTIFICATE_CATEGORY
Definition pkcs11.h:154
#define CKK_VENDOR_DEFINED
Definition pkcs11.h:532
#define CKM_DSA_SHA224
Definition pkcs11.h:559
#define CKD_SHA3_384_KDF
Definition pkcs11.h:322
#define CKA_X2RATCHET_BAG
Definition pkcs11.h:241
#define CKM_TLS_MAC
Definition pkcs11.h:806
#define CKM_CHACHA20_POLY1305
Definition pkcs11.h:973
#define CKR_FUNCTION_NOT_SUPPORTED
Definition pkcs11.h:1113
CK_RV C_Finalize(void *)
CK_RV C_EncryptFinal(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG *)
#define CKF_RESTORE_KEY_NOT_NEEDED
Definition pkcs11.h:418
#define CKD_SHA3_224_KDF_SP800
Definition pkcs11.h:329
CK_RV C_VerifyInit(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE)
#define CK_SP800_108_BYTE_ARRAY
Definition pkcs11.h:131
#define CKA_GOSTR3410_PARAMS
Definition pkcs11.h:220
#define CKD_SHA1_KDF_SP800
Definition pkcs11.h:324
#define CKR_USER_NOT_LOGGED_IN
Definition pkcs11.h:1153
CK_RV C_SetPIN(CK_SESSION_HANDLE, CK_UTF8CHAR *, CK_ULONG, CK_UTF8CHAR *, CK_ULONG)
#define CKA_ALWAYS_SENSITIVE
Definition pkcs11.h:197
#define CKM_DES_CFB64
Definition pkcs11.h:661
#define CKK_HOTP
Definition pkcs11.h:491
CK_RV C_VerifySignatureInit(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE, CK_BYTE *, CK_ULONG)
#define CKM_AES_CFB1
Definition pkcs11.h:936
#define CKM_SHA3_256_HMAC
Definition pkcs11.h:697
#define CKM_DES_ECB_ENCRYPT_DATA
Definition pkcs11.h:904
#define CKM_BLAKE2B_384_KEY_DERIVE
Definition pkcs11.h:965
#define CKM_BLAKE2B_256_HMAC_GENERAL
Definition pkcs11.h:959
#define CKR_DEVICE_REMOVED
Definition pkcs11.h:1107
#define CKK_EC_MONTGOMERY
Definition pkcs11.h:521
#define CKF_UNWRAP
Definition pkcs11.h:372
CK_RV C_GetMechanismList(CK_SLOT_ID, CK_MECHANISM_TYPE *, CK_ULONG *)
#define CKA_VENDOR_DEFINED
Definition pkcs11.h:291
#define CKA_OTP_TIME
Definition pkcs11.h:215
#define CKA_TRUST_TIME_STAMPING
Definition pkcs11.h:284
#define CKM_PBE_SHA1_RC2_40_CBC
Definition pkcs11.h:789
#define CKT_TRUST_ANCHOR
Definition pkcs11.h:1207
#define CKM_GOSTR3410_DERIVE
Definition pkcs11.h:914
#define CKP_INVALID_ID
Definition pkcs11.h:1044
CK_RV C_EncryptMessage(CK_SESSION_HANDLE, void *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKA_END_DATE
Definition pkcs11.h:175
#define CKR_SEED_RANDOM_REQUIRED
Definition pkcs11.h:1188
#define CKG_MGF1_SHA1
Definition pkcs11.h:444
#define CKM_SHAKE_256_KEY_DERIVATION
Definition pkcs11.h:776
#define CKK_SECURID
Definition pkcs11.h:490
#define CKP_PKCS5_PBKD2_HMAC_SHA256
Definition pkcs11.h:1057
#define CKM_SHA256_HMAC_GENERAL
Definition pkcs11.h:680
#define CKA_ATTR_TYPES
Definition pkcs11.h:152
#define CKF_USER_PIN_TO_BE_CHANGED
Definition pkcs11.h:427
#define CKM_AES_ECB_ENCRYPT_DATA
Definition pkcs11.h:908
#define CKM_RIPEMD128_RSA_PKCS
Definition pkcs11.h:547
#define CK_CERTIFICATE_CATEGORY_UNSPECIFIED
Definition pkcs11.h:94
#define CKP_ML_KEM_1024
Definition pkcs11.h:1071
#define CKR_DOMAIN_PARAMS_INVALID
Definition pkcs11.h:1165
#define CKA_CERTIFICATE_TYPE
Definition pkcs11.h:147
#define CKM_ECDSA_SHA256
Definition pkcs11.h:865
CK_RV C_SignEncryptUpdate(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKM_BATON_WRAP
Definition pkcs11.h:860
#define CKF_SO_PIN_LOCKED
Definition pkcs11.h:430
#define CKM_ECDSA_SHA3_512
Definition pkcs11.h:989
CK_ULONG CK_CERTIFICATE_TYPE
Definition pkcs11.h:46
#define CKM_AES_OFB
Definition pkcs11.h:932
#define CKD_SHA3_224_KDF
Definition pkcs11.h:320
#define CKK_ML_KEM
Definition pkcs11.h:529
#define CKR_TOKEN_WRITE_PROTECTED
Definition pkcs11.h:1148
CK_ULONG CK_HEDGE_TYPE
Definition pkcs11.h:51
#define CKA_HASH_OF_ISSUER_PUBLIC_KEY
Definition pkcs11.h:158
#define CKM_HOTP_KEY_GEN
Definition pkcs11.h:692
CK_RV C_FindObjectsFinal(CK_SESSION_HANDLE)
#define CKM_SHA512_T_KEY_GEN
Definition pkcs11.h:950
#define CKK_X2RATCHET
Definition pkcs11.h:519
#define CKM_ML_KEM_KEY_PAIR_GEN
Definition pkcs11.h:555
CK_RV C_VerifySignatureFinal(CK_SESSION_HANDLE)
#define CKA_X2RATCHET_DHP
Definition pkcs11.h:246
#define CKF_DECRYPT
Definition pkcs11.h:363
#define CKH_VENDOR_DEFINED
Definition pkcs11.h:458
#define CKM_TWOFISH_CBC
Definition pkcs11.h:901
#define CKM_SHA512_256_KEY_GEN
Definition pkcs11.h:949
CK_RV C_DecryptDigestUpdate(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKK_CDMF
Definition pkcs11.h:486
#define CKA_MODULUS_BITS
Definition pkcs11.h:177
#define CKV_AUTHORITY_TYPE_COMMON_CRITERIA
Definition pkcs11.h:1219
CK_RV C_DecryptInit(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE)
CK_RV(* CK_CREATEMUTEX)(void **)
Definition pkcs11.h:1259
#define CKM_SHA3_224_RSA_PKCS_PSS
Definition pkcs11.h:629
CK_RV C_SignFinal(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG *)
#define CKM_IKE_PRF_DERIVE
Definition pkcs11.h:997
#define CKM_RIPEMD128_HMAC
Definition pkcs11.h:673
CK_RV C_DigestFinal(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG *)
#define CKM_HASH_ML_DSA_SHA3_224
Definition pkcs11.h:577
#define CKA_LABEL
Definition pkcs11.h:142
#define CKA_EXTRACTABLE
Definition pkcs11.h:194
CK_RV C_OpenSession(CK_SLOT_ID, CK_FLAGS, void *, CK_NOTIFY, CK_SESSION_HANDLE *)
#define CKM_ACTI
Definition pkcs11.h:694
#define CKM_CAST_KEY_GEN
Definition pkcs11.h:712
#define CKM_SHA3_256_KEY_GEN
Definition pkcs11.h:699
#define CKM_ML_DSA_KEY_PAIR_GEN
Definition pkcs11.h:568
#define CKR_TEMPLATE_INCOMPLETE
Definition pkcs11.h:1144
#define CKM_DES3_KEY_GEN
Definition pkcs11.h:645
CK_RV C_VerifySignatureUpdate(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG)
#define CKF_EC_COMPRESS
Definition pkcs11.h:379
#define CKM_DES3_CBC_ENCRYPT_DATA
Definition pkcs11.h:907
#define CKM_CAST128_MAC
Definition pkcs11.h:726
#define CKM_MD5_HMAC
Definition pkcs11.h:667
#define CKF_SO_PIN_COUNT_LOW
Definition pkcs11.h:428
CK_ULONG CK_OBJECT_HANDLE
Definition pkcs11.h:64
#define CKA_ENCODING_METHODS
Definition pkcs11.h:234
#define CKA_HASH_OF_CERTIFICATE
Definition pkcs11.h:288
CK_ULONG CK_HW_FEATURE_TYPE
Definition pkcs11.h:53
#define CKM_DES3_ECB
Definition pkcs11.h:646
#define CKM_AES_CBC
Definition pkcs11.h:885
#define CKM_SEED_MAC
Definition pkcs11.h:834
CK_RV C_SignMessageBegin(CK_SESSION_HANDLE, void *, CK_ULONG)
#define CKM_AES_MAC
Definition pkcs11.h:886
#define CKM_SHA256_RSA_PKCS_PSS
Definition pkcs11.h:603
#define CKR_KEY_NOT_NEEDED
Definition pkcs11.h:1117
#define CKM_SKIPJACK_WRAP
Definition pkcs11.h:847
#define CKR_NO_EVENT
Definition pkcs11.h:1095
#define CKR_VENDOR_DEFINED
Definition pkcs11.h:1192
#define CKM_SKIPJACK_ECB64
Definition pkcs11.h:840
#define CKA_ENCRYPT
Definition pkcs11.h:165
#define CKM_SHA384_KEY_DERIVATION
Definition pkcs11.h:763
#define CKA_SUBPRIME_BITS
Definition pkcs11.h:190
#define CKM_X3DH_INITIALIZE
Definition pkcs11.h:975
CK_RV C_WaitForSlotEvent(CK_FLAGS, CK_SLOT_ID *, void *)
#define CKM_RSA_PKCS_PSS
Definition pkcs11.h:553
#define CKM_SKIPJACK_OFB64
Definition pkcs11.h:842
#define CKM_GOSTR3410_WITH_GOSTR3411
Definition pkcs11.h:912
#define CKM_SHA1_RSA_PKCS_PSS
Definition pkcs11.h:554
#define CKP_SLH_DSA_SHAKE_192S
Definition pkcs11.h:1079
#define CKK_ML_DSA
Definition pkcs11.h:530
#define CKM_DES2_KEY_GEN
Definition pkcs11.h:644
#define CKM_GOSTR3410_KEY_PAIR_GEN
Definition pkcs11.h:910
#define CKA_PIXEL_X
Definition pkcs11.h:226
#define CKA_DEFAULT_CMS_ATTRIBUTES
Definition pkcs11.h:238
#define CKR_HOST_MEMORY
Definition pkcs11.h:1090
#define CKM_SHA512_256_KEY_DERIVATION
Definition pkcs11.h:615
#define CKA_GOSTR3411_PARAMS
Definition pkcs11.h:221
#define CKM_ECDSA_SHA3_384
Definition pkcs11.h:988
#define CKM_SHA384_RSA_PKCS
Definition pkcs11.h:601
CK_RV C_GetAttributeValue(CK_SESSION_HANDLE, CK_OBJECT_HANDLE, CK_ATTRIBUTE *, CK_ULONG)
CK_ULONG CK_ATTRIBUTE_TYPE
Definition pkcs11.h:44
#define CKR_FUNCTION_NOT_PARALLEL
Definition pkcs11.h:1112
#define CKK_GOST28147
Definition pkcs11.h:506
#define CKK_SHA512_256_HMAC
Definition pkcs11.h:524
#define CKA_CHAR_COLUMNS
Definition pkcs11.h:230
#define CKR_SESSION_ASYNC_NOT_SUPPORTED
Definition pkcs11.h:1187
#define CKA_HSS_LEVELS
Definition pkcs11.h:258
CK_RV C_Encrypt(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKA_UNWRAP_TEMPLATE
Definition pkcs11.h:294
#define CKR_SIGNATURE_LEN_RANGE
Definition pkcs11.h:1143
CK_RV C_LoginUser(CK_SESSION_HANDLE, CK_USER_TYPE, CK_UTF8CHAR *, CK_ULONG, CK_UTF8CHAR *, CK_ULONG)
#define CKM_ARIA_MAC
Definition pkcs11.h:826
#define CKR_CURVE_NOT_SUPPORTED
Definition pkcs11.h:1166
#define CKD_BLAKE2B_256_KDF
Definition pkcs11.h:334
#define CKM_SHA224_KEY_DERIVATION
Definition pkcs11.h:765
#define CKA_KEY_GEN_MECHANISM
Definition pkcs11.h:198
#define CKM_HASH_SLH_DSA_SHA3_384
Definition pkcs11.h:596
#define CKR_FIPS_SELF_TEST_FAILED
Definition pkcs11.h:1178
#define CKM_JUNIPER_SHUFFLE
Definition pkcs11.h:878
#define CKM_HASH_ML_DSA_SHAKE256
Definition pkcs11.h:582
CK_ULONG CK_PROFILE_ID
Definition pkcs11.h:69
#define CKK_TWOFISH
Definition pkcs11.h:489
#define CKR_USER_TYPE_INVALID
Definition pkcs11.h:1155
#define CKM_SEED_ECB
Definition pkcs11.h:832
#define CKK_BLAKE2B_512_HMAC
Definition pkcs11.h:517
#define CKM_BLAKE2B_160_HMAC
Definition pkcs11.h:953
#define CKM_CAMELLIA_ECB
Definition pkcs11.h:815
#define CKM_AES_KEY_WRAP_PKCS7
Definition pkcs11.h:940
#define CKM_ECDH_AES_KEY_WRAP
Definition pkcs11.h:872
#define CRYPTOKI_VERSION_MAJOR
Definition pkcs11.h:11
#define CKO_DOMAIN_PARAMETERS
Definition pkcs11.h:1035
#define CKM_PBE_MD5_CAST3_CBC
Definition pkcs11.h:781
#define CKM_RC4
Definition pkcs11.h:637
#define CKT_NOT_TRUSTED
Definition pkcs11.h:1208
#define CKM_RSA_AES_KEY_WRAP
Definition pkcs11.h:873
#define CKF_USER_PIN_LOCKED
Definition pkcs11.h:426
#define CKK_SHA3_224_HMAC
Definition pkcs11.h:510
#define CKM_IKE1_EXTENDED_DERIVE
Definition pkcs11.h:999
#define CKM_PBE_MD5_DES_CBC
Definition pkcs11.h:779
#define CKM_SHA512_T_HMAC
Definition pkcs11.h:617
#define CKM_SHA512_HMAC
Definition pkcs11.h:688
#define CKM_RIPEMD160_HMAC_GENERAL
Definition pkcs11.h:677
CK_ULONG CK_JAVA_MIDP_SECURITY_DOMAIN
Definition pkcs11.h:54
#define CKM_SHA256_RSA_PKCS
Definition pkcs11.h:600
#define CKR_KEY_HANDLE_INVALID
Definition pkcs11.h:1114
#define CKM_CAST_MAC
Definition pkcs11.h:715
#define CKM_RC2_MAC_GENERAL
Definition pkcs11.h:634
#define CKM_RC2_KEY_GEN
Definition pkcs11.h:630
#define CKF_FIND_OBJECTS
Definition pkcs11.h:361
#define CKA_OBJECT_VALIDATION_FLAGS
Definition pkcs11.h:265
#define CKR_MUTEX_BAD
Definition pkcs11.h:1173
#define CKM_CAST128_KEY_GEN
Definition pkcs11.h:724
#define CKF_TOKEN_PRESENT
Definition pkcs11.h:409
#define CKM_AES_XCBC_MAC
Definition pkcs11.h:895
#define CKD_SHA224_KDF
Definition pkcs11.h:315
#define CKA_ENCAPSULATE_TEMPLATE
Definition pkcs11.h:277
#define CKM_BLAKE2B_512_KEY_GEN
Definition pkcs11.h:971
#define CKM_BLAKE2B_512_KEY_DERIVE
Definition pkcs11.h:970
#define CKM_SHA384_RSA_PKCS_PSS
Definition pkcs11.h:604
CK_RV C_VerifyRecover(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
CK_RV(* CK_DESTROYMUTEX)(void *)
Definition pkcs11.h:1260
#define CKM_RSA_PKCS_TPM_1_1
Definition pkcs11.h:941
#define CKP_SLH_DSA_SHAKE_256F
Definition pkcs11.h:1085
#define CKM_SSL3_KEY_AND_MAC_DERIVE
Definition pkcs11.h:750
#define CKV_AUTHORITY_TYPE_NIST_CMVP
Definition pkcs11.h:1218
#define CKM_DES_MAC_GENERAL
Definition pkcs11.h:642
#define CKA_PIXEL_Y
Definition pkcs11.h:227
#define CKK_XMSSMT
Definition pkcs11.h:528
#define CKR_SAVED_STATE_INVALID
Definition pkcs11.h:1168
#define CKM_CAST128_CBC
Definition pkcs11.h:727
#define CKM_AES_ECB
Definition pkcs11.h:884
#define CKF_INTERFACE_FORK_SAFE
Definition pkcs11.h:351
#define CKM_ARIA_ECB_ENCRYPT_DATA
Definition pkcs11.h:829
unsigned char CK_UTF8CHAR
Definition pkcs11.h:19
#define CKK_EC
Definition pkcs11.h:469
#define CKM_X2RATCHET_ENCRYPT
Definition pkcs11.h:979
#define CKA_WRAP_TEMPLATE
Definition pkcs11.h:293
#define CKR_WRAPPED_KEY_LEN_RANGE
Definition pkcs11.h:1159
#define CKM_CHACHA20
Definition pkcs11.h:923
#define CKM_SALSA20
Definition pkcs11.h:972
#define CKK_ARIA
Definition pkcs11.h:494
#define CKF_HW
Definition pkcs11.h:354
#define CKM_X9_42_DH_HYBRID_DERIVE
Definition pkcs11.h:587
#define CKA_PRIME_BITS
Definition pkcs11.h:189
#define CKM_SHA3_224_HMAC
Definition pkcs11.h:701
#define CKF_EXCLUDE_TIME
Definition pkcs11.h:394
#define CKR_EXCEEDED_MAX_ITERATIONS
Definition pkcs11.h:1177
#define CKM_BLOWFISH_KEY_GEN
Definition pkcs11.h:898
#define CKM_GOST28147_MAC
Definition pkcs11.h:920
#define CKM_CAST128_ECB
Definition pkcs11.h:725
#define CKR_KEY_INDIGESTIBLE
Definition pkcs11.h:1120
CK_RV C_GetSlotList(CK_BBOOL, CK_SLOT_ID *, CK_ULONG *)
#define CKK_MD5_HMAC
Definition pkcs11.h:495
#define CKH_USER_INTERFACE
Definition pkcs11.h:457
#define CKK_SHA_1_HMAC
Definition pkcs11.h:496
#define CKA_OTP_COUNTER
Definition pkcs11.h:214
#define CKA_CHAR_SETS
Definition pkcs11.h:233
#define CKA_VALIDATION_VENDOR_URI
Definition pkcs11.h:275
#define CKF_VERIFY_RECOVER
Definition pkcs11.h:368
#define CKA_MECHANISM_TYPE
Definition pkcs11.h:236
CK_ULONG CK_STATE
Definition pkcs11.h:79
#define CKK_AES
Definition pkcs11.h:487
#define CKM_SEED_CBC
Definition pkcs11.h:833
#define CKM_SHA3_224_KEY_DERIVATION
Definition pkcs11.h:768
#define CKA_BASE
Definition pkcs11.h:188
CK_RV C_DecryptMessage(CK_SESSION_HANDLE, void *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG *)
#define CKM_DSA_SHA256
Definition pkcs11.h:560
CK_RV C_GetInterface(CK_UTF8CHAR *, CK_VERSION *, CK_INTERFACE **, CK_FLAGS)
#define CKF_CLOCK_ON_TOKEN
Definition pkcs11.h:419
#define CKS_RW_SO_FUNCTIONS
Definition pkcs11.h:1199
#define CKA_X2RATCHET_RK
Definition pkcs11.h:257
#define CK_SP800_108_DKM_LENGTH
Definition pkcs11.h:130
#define CKM_DES_CFB8
Definition pkcs11.h:662
#define CKA_VALIDATION_CERTIFICATE_IDENTIFIER
Definition pkcs11.h:273
#define CKR_KEY_NEEDED
Definition pkcs11.h:1119
#define CKM_SHA3_512_RSA_PKCS_PSS
Definition pkcs11.h:627
#define CK_OTP_FORMAT_ALPHANUMERIC
Definition pkcs11.h:112
#define CKM_HASH_ML_DSA_SHA3_384
Definition pkcs11.h:579
#define CKM_BLOWFISH_CBC_PAD
Definition pkcs11.h:902
#define CKM_SHA3_224_KEY_GEN
Definition pkcs11.h:703
CK_RV C_GenerateRandom(CK_SESSION_HANDLE, CK_BYTE *, CK_ULONG)
#define CKR_PUBLIC_KEY_INVALID
Definition pkcs11.h:1181
#define CKG_GENERATE_RANDOM
Definition pkcs11.h:440
#define CKR_KEY_TYPE_INCONSISTENT
Definition pkcs11.h:1116
#define CKM_SHA_1
Definition pkcs11.h:669
#define CKA_VALIDATION_VERSION
Definition pkcs11.h:267
CK_RV C_VerifyMessage(CK_SESSION_HANDLE, void *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG)
#define CKM_DSA_SHA1
Definition pkcs11.h:558
#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT
Definition pkcs11.h:1151
#define CK_SECURITY_DOMAIN_UNSPECIFIED
Definition pkcs11.h:121
#define CKO_TRUST
Definition pkcs11.h:1040
#define CKA_X2RATCHET_CKR
Definition pkcs11.h:244
#define CKM_AES_XCBC_MAC_96
Definition pkcs11.h:896
CK_RV C_MessageDecryptInit(CK_SESSION_HANDLE, CK_MECHANISM *, CK_OBJECT_HANDLE)
#define CKK_X9_42_DH
Definition pkcs11.h:470
#define CKM_WTLS_PRF
Definition pkcs11.h:795
#define CKF_MESSAGE_VERIFY
Definition pkcs11.h:358
#define CKF_ERROR_STATE
Definition pkcs11.h:432
#define CKF_WRITE_PROTECTED
Definition pkcs11.h:415
#define CKD_BLAKE2B_160_KDF
Definition pkcs11.h:333
#define CKA_X2RATCHET_DHS
Definition pkcs11.h:248
#define CKA_EC_PARAMS
Definition pkcs11.h:202
#define CKA_X2RATCHET_DHR
Definition pkcs11.h:247
#define CKM_BLAKE2B_256_KEY_DERIVE
Definition pkcs11.h:960
#define CKV_TYPE_HARDWARE
Definition pkcs11.h:1224
#define CK_OTP_OUTPUT_FORMAT
Definition pkcs11.h:107
#define CKM_DES_MAC
Definition pkcs11.h:641
#define CKF_ASYNC_SESSION_SUPPORTED
Definition pkcs11.h:434
#define CKM_RC2_ECB
Definition pkcs11.h:631
#define CKM_TLS12_KEY_AND_MAC_DERIVE
Definition pkcs11.h:803
#define CKA_WRAP
Definition pkcs11.h:167
#define CK_SP800_108_DKM_LENGTH_SUM_OF_KEYS
Definition pkcs11.h:135
CK_RV C_MessageVerifyFinal(CK_SESSION_HANDLE)
CK_RV C_CloseSession(CK_SESSION_HANDLE)
#define CKA_CLASS
Definition pkcs11.h:139
#define CKK_SHA512_HMAC
Definition pkcs11.h:501
#define CKD_SHA3_256_KDF_SP800
Definition pkcs11.h:330
#define CKR_KEY_NOT_WRAPPABLE
Definition pkcs11.h:1122
#define CKM_MD2_HMAC
Definition pkcs11.h:664
#define CKA_DERIVE_TEMPLATE
Definition pkcs11.h:295
#define CKF_MESSAGE_SIGN
Definition pkcs11.h:357
#define CKT_TRUST_UNKNOWN
Definition pkcs11.h:1205
#define CKM_HASH_ML_DSA_SHA512
Definition pkcs11.h:576
#define CKF_NEXT_OTP
Definition pkcs11.h:393
#define CKM_TLS12_MASTER_KEY_DERIVE_DH
Definition pkcs11.h:804
#define CKM_SHA3_256_HMAC_GENERAL
Definition pkcs11.h:698
#define CKA_SEED
Definition pkcs11.h:290
#define CKM_RC5_ECB
Definition pkcs11.h:731
#define CKF_DONT_BLOCK
Definition pkcs11.h:401
#define CKM_SHA224_HMAC_GENERAL
Definition pkcs11.h:683
#define CKM_ECDH_COF_AES_KEY_WRAP
Definition pkcs11.h:1007
#define CK_SECURITY_DOMAIN_OPERATOR
Definition pkcs11.h:123
#define CKM_SHA3_256
Definition pkcs11.h:696
#define CKA_HAS_RESET
Definition pkcs11.h:225
#define CKM_SHA3_256_KEY_DERIVATION
Definition pkcs11.h:766
#define CK_OTP_PARAM_MANDATORY
Definition pkcs11.h:118
#define CKD_SHA224_KDF_SP800
Definition pkcs11.h:325
#define CKA_OTP_SERVICE_LOGO
Definition pkcs11.h:218
#define CKA_SUBJECT
Definition pkcs11.h:162
#define CKM_DES3_MAC
Definition pkcs11.h:648
CK_RV C_VerifyMessageNext(CK_SESSION_HANDLE, void *, CK_ULONG, CK_BYTE *, CK_ULONG, CK_BYTE *, CK_ULONG)
#define CKM_SHA224_KEY_GEN
Definition pkcs11.h:944
#define CKM_SALSA20_POLY1305
Definition pkcs11.h:974