Botan 3.14.1
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 if(label.size() > 32) {
1650 throw Invalid_Argument("PKCS #11 token label must be at most 32 bytes");
1651 }
1652
1653 std::string padded_label(label);
1654 if(label.size() < 32) {
1655 padded_label.insert(padded_label.end(), 32 - label.size(), ' ');
1656 }
1657
1658 return C_InitToken(slot_id,
1659 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(so_pin.data())),
1660 checked_ulong_cast(so_pin.size()),
1661 reinterpret_cast<Utf8Char*>(const_cast<char*>(padded_label.c_str())),
1662 return_value);
1663 }
1664
1665 /**
1666 * C_InitPIN initializes the normal user's PIN.
1667 * @param session the session's handle
1668 * @param pin_ptr the normal user's PIN
1669 * @param pin_len length in bytes of the PIN
1670 * @param return_value default value (`ThrowException`): throw exception on error.
1671 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1672 * At least the following PKCS #11 return values may be returned:
1673 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1674 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1675 * \li GeneralError \li HostMemory \li OK
1676 * \li PinInvalid \li PinLenRange \li SessionClosed
1677 * \li SessionReadOnly \li SessionHandleInvalid \li TokenWriteProtected
1678 * \li UserNotLoggedIn \li ArgumentsBad
1679 * @return true on success, false otherwise
1680 */
1681 bool C_InitPIN(SessionHandle session,
1682 const Utf8Char* pin_ptr,
1683 Ulong pin_len,
1684 ReturnValue* return_value = ThrowException) const;
1685
1686 /**
1687 * C_InitPIN initializes the normal user's PIN.
1688 * @param session the session's handle
1689 * @param pin the normal user's PIN
1690 * @param return_value default value (`ThrowException`): throw exception on error.
1691 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1692 * At least the following PKCS #11 return values may be returned:
1693 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1694 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1695 * \li GeneralError \li HostMemory \li OK
1696 * \li PinInvalid \li PinLenRange \li SessionClosed
1697 * \li SessionReadOnly \li SessionHandleInvalid \li TokenWriteProtected
1698 * \li UserNotLoggedIn \li ArgumentsBad
1699 * @return true on success, false otherwise
1700 */
1701 template <typename TAlloc>
1703 const std::vector<uint8_t, TAlloc>& pin,
1704 ReturnValue* return_value = ThrowException) const {
1705 return C_InitPIN(session,
1706 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(pin.data())),
1707 checked_ulong_cast(pin.size()),
1708 return_value);
1709 }
1710
1711 /**
1712 * C_SetPIN modifies the PIN of the user who is logged in.
1713 * @param session the session's handle
1714 * @param old_pin_ptr the old PIN
1715 * @param old_len length of the old PIN
1716 * @param new_pin_ptr the new PIN
1717 * @param new_len length of the new PIN
1718 * @param return_value default value (`ThrowException`): throw exception on error.
1719 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1720 * At least the following PKCS #11 return values may be returned:
1721 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1722 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1723 * \li GeneralError \li HostMemory \li OK
1724 * \li PinIncorrect \li PinInvalid \li PinLenRange
1725 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1726 * \li SessionReadOnly \li TokenWriteProtected \li ArgumentsBad
1727 * @return true on success, false otherwise
1728 */
1729 bool C_SetPIN(SessionHandle session,
1730 const Utf8Char* old_pin_ptr,
1731 Ulong old_len,
1732 const Utf8Char* new_pin_ptr,
1733 Ulong new_len,
1734 ReturnValue* return_value = ThrowException) const;
1735
1736 /**
1737 * C_SetPIN modifies the PIN of the user who is logged in.
1738 * @param session the session's handle
1739 * @param old_pin the old PIN
1740 * @param new_pin the new PIN
1741 * @param return_value default value (`ThrowException`): throw exception on error.
1742 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1743 * At least the following PKCS #11 return values may be returned:
1744 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1745 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1746 * \li GeneralError \li HostMemory \li OK
1747 * \li PinIncorrect \li PinInvalid \li PinLenRange
1748 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1749 * \li SessionReadOnly \li TokenWriteProtected \li ArgumentsBad
1750 * @return true on success, false otherwise
1751 */
1752 template <typename TAlloc>
1754 const std::vector<uint8_t, TAlloc>& old_pin,
1755 const std::vector<uint8_t, TAlloc>& new_pin,
1756 ReturnValue* return_value = ThrowException) const {
1757 return C_SetPIN(session,
1758 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(old_pin.data())),
1759 checked_ulong_cast(old_pin.size()),
1760 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(new_pin.data())),
1761 checked_ulong_cast(new_pin.size()),
1762 return_value);
1763 }
1764
1765 /****************************** Session management ******************************/
1766
1767 /**
1768 * C_OpenSession opens a session between an application and a token.
1769 * @param slot_id the slot's ID
1770 * @param flags from CK_SESSION_INFO
1771 * @param application passed to callback
1772 * @param notify callback function
1773 * @param session_ptr gets session handle
1774 * @param return_value default value (`ThrowException`): throw exception on error.
1775 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1776 * At least the following PKCS #11 return values may be returned:
1777 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1778 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1779 * \li HostMemory \li OK \li SessionCount
1780 * \li SessionParallelNotSupported \li SessionReadWriteSoExists \li SlotIdInvalid
1781 * \li TokenNotPresent \li TokenNotRecognized \li TokenWriteProtected
1782 * \li ArgumentsBad
1783 * @return true on success, false otherwise
1784 */
1785 bool C_OpenSession(SlotId slot_id,
1786 Flags flags,
1787 void* application,
1788 Notify notify,
1789 SessionHandle* session_ptr,
1790 ReturnValue* return_value = ThrowException) const;
1791
1792 /**
1793 * C_CloseSession closes a session between an application and a token.
1794 * @param session the session's handle
1795 * @param return_value default value (`ThrowException`): throw exception on error.
1796 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1797 * At least the following PKCS #11 return values may be returned:
1798 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1799 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1800 * \li HostMemory \li OK \li SessionClosed
1801 * \li SessionHandleInvalid
1802 * @return true on success, false otherwise
1803 */
1804 bool C_CloseSession(SessionHandle session, ReturnValue* return_value = ThrowException) const;
1805
1806 /**
1807 * C_CloseAllSessions closes all sessions with a token.
1808 * @param slot_id the token's slot
1809 * @param return_value default value (`ThrowException`): throw exception on error.
1810 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1811 * At least the following PKCS #11 return values may be returned:
1812 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1813 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1814 * \li HostMemory \li OK \li SlotIdInvalid
1815 * \li TokenNotPresent
1816 * @return true on success, false otherwise
1817 */
1818 bool C_CloseAllSessions(SlotId slot_id, ReturnValue* return_value = ThrowException) const;
1819
1820 /**
1821 * C_GetSessionInfo obtains information about the session.
1822 * @param session the session's handle
1823 * @param info_ptr receives session info
1824 * @param return_value default value (`ThrowException`): throw exception on error.
1825 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1826 * At least the following PKCS #11 return values may be returned:
1827 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1828 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1829 * \li HostMemory \li OK \li SessionClosed
1830 * \li SessionHandleInvalid \li ArgumentsBad
1831 * @return true on success, false otherwise
1832 */
1833 bool C_GetSessionInfo(SessionHandle session,
1834 SessionInfo* info_ptr,
1835 ReturnValue* return_value = ThrowException) const;
1836
1837 /**
1838 * C_SessionCancel terminates active session based operations.
1839 *
1840 * @param session the session's handle
1841 * @param flags flags control which sessions are cancelled
1842 * @param return_value default value (`ThrowException`): throw exception on error
1843 * @return true on success, false otherwise
1844 */
1845 bool C_SessionCancel(SessionHandle session, Flags flags, ReturnValue* return_value = ThrowException);
1846
1847 /**
1848 * C_GetOperationState obtains the state of the cryptographic operation in a session.
1849 * @param session session's handle
1850 * @param operation_state_ptr gets state
1851 * @param operation_state_len_ptr gets state length
1852 * @param return_value default value (`ThrowException`): throw exception on error.
1853 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1854 * At least the following PKCS #11 return values may be returned:
1855 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
1856 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
1857 * \li GeneralError \li HostMemory \li OK
1858 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
1859 * \li StateUnsaveable \li ArgumentsBad
1860 * @return true on success, false otherwise
1861 */
1863 Byte* operation_state_ptr,
1864 Ulong* operation_state_len_ptr,
1865 ReturnValue* return_value = ThrowException) const;
1866
1867 /**
1868 * C_SetOperationState restores the state of the cryptographic operation in a session.
1869 * @param session session's handle
1870 * @param operation_state_ptr holds state
1871 * @param operation_state_len holds state length
1872 * @param encryption_key en/decryption key
1873 * @param authentication_key sign/verify key
1874 * @param return_value default value (`ThrowException`): throw exception on error.
1875 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1876 * At least the following PKCS #11 return values may be returned:
1877 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1878 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1879 * \li HostMemory \li KeyChanged \li KeyNeeded
1880 * \li KeyNotNeeded \li OK \li SavedStateInvalid
1881 * \li SessionClosed \li SessionHandleInvalid \li ArgumentsBad
1882 * @return true on success, false otherwise
1883 */
1885 const Byte* operation_state_ptr,
1886 Ulong operation_state_len,
1887 ObjectHandle encryption_key,
1888 ObjectHandle authentication_key,
1889 ReturnValue* return_value = ThrowException) const;
1890
1891 /**
1892 * C_Login logs a user into a token.
1893 * @param session the session's handle
1894 * @param user_type the user type
1895 * @param pin_ptr the user's PIN
1896 * @param pin_len the length of the PIN
1897 * @param return_value default value (`ThrowException`): throw exception on error.
1898 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1899 * At least the following PKCS #11 return values may be returned:
1900 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
1901 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
1902 * \li FunctionFailed \li GeneralError \li HostMemory
1903 * \li OK \li OperationNotInitialized \li PinIncorrect
1904 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1905 * \li SessionReadOnlyExists \li UserAlreadyLoggedIn \li UserAnotherAlreadyLoggedIn
1906 * \li UserPinNotInitialized \li UserTooManyTypes \li UserTypeInvalid
1907 * @return true on success, false otherwise
1908 */
1909 bool C_Login(SessionHandle session,
1910 UserType user_type,
1911 const Utf8Char* pin_ptr,
1912 Ulong pin_len,
1913 ReturnValue* return_value = ThrowException) const;
1914
1915 /**
1916 * C_Login logs a user into a token.
1917 * @param session the session's handle
1918 * @param user_type the user type
1919 * @param pin the user or security officer's PIN
1920 * @param return_value default value (`ThrowException`): throw exception on error.
1921 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1922 * At least the following PKCS #11 return values may be returned:
1923 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
1924 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
1925 * \li FunctionFailed \li GeneralError \li HostMemory
1926 * \li OK \li OperationNotInitialized \li PinIncorrect
1927 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1928 * \li SessionReadOnlyExists \li UserAlreadyLoggedIn \li UserAnotherAlreadyLoggedIn
1929 * \li UserPinNotInitialized \li UserTooManyTypes \li UserTypeInvalid
1930 * @return true on success, false otherwise
1931 */
1932 template <typename TAlloc>
1934 UserType user_type,
1935 const std::vector<uint8_t, TAlloc>& pin,
1936 ReturnValue* return_value = ThrowException) const {
1937 return C_Login(session,
1938 user_type,
1939 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(pin.data())),
1940 checked_ulong_cast(pin.size()),
1941 return_value);
1942 }
1943
1944 /**
1945 * C_LoginUser logs a user into a token.
1946 *
1947 * @param session the session's handle
1948 * @param user_type the user type
1949 * @param pin_ptr the user's PIN
1950 * @param pin_len the length of the PIN
1951 * @param username_ptr the user's name
1952 * @param username_len the length of the user's name
1953 * @param return_value default value (`ThrowException`): throw exception on error
1954 * @return true on success, false otherwise
1955 */
1956 bool C_LoginUser(SessionHandle session,
1957 UserType user_type,
1958 const Utf8Char* pin_ptr,
1959 Ulong pin_len,
1960 const Utf8Char* username_ptr,
1961 Ulong username_len,
1962 ReturnValue* return_value = ThrowException);
1963
1964 /**
1965 * C_Logout logs a user out from a token.
1966 * @param session the session's handle
1967 * @param return_value default value (`ThrowException`): throw exception on error.
1968 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1969 * At least the following PKCS #11 return values may be returned:
1970 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1971 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1972 * \li HostMemory \li OK \li SessionClosed
1973 * \li SessionHandleInvalid \li UserNotLoggedIn
1974 * @return true on success, false otherwise
1975 */
1976 bool C_Logout(SessionHandle session, ReturnValue* return_value = ThrowException) const;
1977
1978 /**
1979 * C_GetSessionValidationFlags fetches the requested flags from the session. See
1980 * Validation indicators (section4.15.3.1) for meaning and semantics for these
1981 * flags. Applications are responsible for the appropriate locking to protect
1982 * session to get a meaningful result from this call.
1983 *
1984 * @param session the session's handle
1985 * @param type which state of flags
1986 * @param flags_ptr validation flags
1987 * @param return_value default value (`ThrowException`): throw exception on error
1988 * @return true on success, false otherwise
1989 */
1991 Ulong type,
1992 Flags* flags_ptr,
1993 ReturnValue* return_value = ThrowException);
1994
1995 /****************************** Object management functions ******************************/
1996
1997 /**
1998 * C_CreateObject creates a new object.
1999 * @param session the session's handle
2000 * @param attribute_template_ptr the object's template
2001 * @param count attributes in template
2002 * @param object_ptr gets new object's handle.
2003 * @param return_value default value (`ThrowException`): throw exception on error.
2004 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2005 * At least the following PKCS #11 return values may be returned:
2006 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
2007 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
2008 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2009 * \li DomainParamsInvalid \li FunctionFailed \li GeneralError
2010 * \li HostMemory \li OK \li PinExpired
2011 * \li SessionClosed \li SessionHandleInvalid \li SessionReadOnly
2012 * \li TemplateIncomplete \li TemplateInconsistent \li TokenWriteProtected
2013 * \li UserNotLoggedIn
2014 * @return true on success, false otherwise
2015 */
2016 bool C_CreateObject(SessionHandle session,
2017 Attribute* attribute_template_ptr,
2018 Ulong count,
2019 ObjectHandle* object_ptr,
2020 ReturnValue* return_value = ThrowException) const;
2021
2022 /**
2023 * C_CopyObject copies an object, creating a new object for the copy.
2024 * @param session the session's handle
2025 * @param object the object's handle
2026 * @param attribute_template_ptr template for new object
2027 * @param count attributes in template
2028 * @param new_object_ptr receives handle of copy
2029 * @param return_value default value (`ThrowException`): throw exception on error.
2030 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2031 * At least the following PKCS #11 return values may be returned:
2032 * \li ActionProhibited \li ArgumentsBad \li AttributeReadOnly
2033 * \li AttributeTypeInvalid \li AttributeValueInvalid \li CryptokiNotInitialized
2034 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2035 * \li FunctionFailed \li GeneralError \li HostMemory
2036 * \li ObjectHandleInvalid \li OK \li PinExpired
2037 * \li SessionClosed \li SessionHandleInvalid \li SessionReadOnly
2038 * \li TemplateInconsistent \li TokenWriteProtected \li UserNotLoggedIn
2039 * @return true on success, false otherwise
2040 */
2041 bool C_CopyObject(SessionHandle session,
2042 ObjectHandle object,
2043 Attribute* attribute_template_ptr,
2044 Ulong count,
2045 ObjectHandle* new_object_ptr,
2046 ReturnValue* return_value = ThrowException) const;
2047
2048 /**
2049 * C_DestroyObject destroys an object.
2050 * @param session the session's handle
2051 * @param object the object's handle
2052 * @param return_value default value (`ThrowException`): throw exception on error.
2053 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2054 * At least the following PKCS #11 return values may be returned:
2055 * \li ActionProhibited \li CryptokiNotInitialized \li DeviceError
2056 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2057 * \li GeneralError \li HostMemory \li ObjectHandleInvalid
2058 * \li OK \li PinExpired \li SessionClosed
2059 * \li SessionHandleInvalid \li SessionReadOnly \li TokenWriteProtected
2060 * @return true on success, false otherwise
2061 */
2062 bool C_DestroyObject(SessionHandle session,
2063 ObjectHandle object,
2064 ReturnValue* return_value = ThrowException) const;
2065
2066 /**
2067 * C_GetObjectSize gets the size of an object in bytes.
2068 * @param session the session's handle
2069 * @param object the object's handle
2070 * @param size_ptr receives size of object
2071 * @param return_value default value (`ThrowException`): throw exception on error.
2072 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2073 * At least the following PKCS #11 return values may be returned:
2074 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2075 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2076 * \li GeneralError \li HostMemory \li InformationSensitive
2077 * \li ObjectHandleInvalid \li OK \li SessionClosed
2078 * \li SessionHandleInvalid
2079 * @return true on success, false otherwise
2080 */
2081 bool C_GetObjectSize(SessionHandle session,
2082 ObjectHandle object,
2083 Ulong* size_ptr,
2084 ReturnValue* return_value = ThrowException) const;
2085
2086 /**
2087 * C_GetAttributeValue obtains the value of one or more object attributes.
2088 * @param session the session's handle
2089 * @param object the object's handle
2090 * @param attribute_template_ptr specifies attrs; gets vals
2091 * @param count attributes in template
2092 * @param return_value default value (`ThrowException`): throw exception on error.
2093 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2094 * At least the following PKCS #11 return values may be returned:
2095 * \li ArgumentsBad \li AttributeSensitive \li AttributeTypeInvalid
2096 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
2097 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2098 * \li GeneralError \li HostMemory \li ObjectHandleInvalid
2099 * \li OK \li SessionClosed \li SessionHandleInvalid
2100 * @return true on success, false otherwise
2101 */
2103 ObjectHandle object,
2104 Attribute* attribute_template_ptr,
2105 Ulong count,
2106 ReturnValue* return_value = ThrowException) const;
2107
2108 /**
2109 * C_GetAttributeValue obtains the value of one or more object attributes.
2110 * @param session the session's handle
2111 * @param object the object's handle
2112 * @param attribute_values specifies attrs; gets vals
2113 * @param return_value default value (`ThrowException`): throw exception on error.
2114 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2115 * At least the following PKCS #11 return values may be returned:
2116 * \li ArgumentsBad \li AttributeSensitive \li AttributeTypeInvalid
2117 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
2118 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2119 * \li GeneralError \li HostMemory \li ObjectHandleInvalid
2120 * \li OK \li SessionClosed \li SessionHandleInvalid
2121 * @return true on success, false otherwise
2122 */
2123 template <typename TAlloc>
2125 ObjectHandle object,
2126 std::map<AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
2127 ReturnValue* return_value = ThrowException) const {
2128 std::vector<Attribute> getter_template;
2129
2130 getter_template.reserve(attribute_values.size());
2131 for(const auto& entry : attribute_values) {
2132 getter_template.emplace_back(Attribute{static_cast<CK_ATTRIBUTE_TYPE>(entry.first), nullptr, 0});
2133 }
2134
2135 const bool success = C_GetAttributeValue(session,
2136 object,
2137 const_cast<Attribute*>(getter_template.data()),
2138 checked_ulong_cast(getter_template.size()),
2139 return_value);
2140
2141 if(!success) {
2142 return success;
2143 }
2144
2145 size_t i = 0;
2146 for(auto& entry : attribute_values) {
2147 entry.second.clear();
2148 entry.second.resize(getter_template.at(i).ulValueLen);
2149 getter_template.at(i).pValue = const_cast<uint8_t*>(entry.second.data());
2150 i++;
2151 }
2152
2153 if(!C_GetAttributeValue(session,
2154 object,
2155 const_cast<Attribute*>(getter_template.data()),
2156 checked_ulong_cast(getter_template.size()),
2157 return_value)) {
2158 return false;
2159 }
2160
2161 // The final lengths may be shorter than the ones reported by the sizing call
2162 i = 0;
2163 for(auto& entry : attribute_values) {
2164 const Ulong final_len = getter_template.at(i).ulValueLen;
2165 if(final_len < entry.second.size()) {
2166 entry.second.resize(final_len);
2167 }
2168 i++;
2169 }
2170 return true;
2171 }
2172
2173 /**
2174 * C_SetAttributeValue modifies the value of one or more object attributes.
2175 * @param session the session's handle
2176 * @param object the object's handle
2177 * @param attribute_template_ptr specifies attrs and values
2178 * @param count attributes in template
2179 * @param return_value default value (`ThrowException`): throw exception on error.
2180 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2181 * At least the following PKCS #11 return values may be returned:
2182 * \li ActionProhibited \li ArgumentsBad \li AttributeReadOnly
2183 * \li AttributeTypeInvalid \li AttributeValueInvalid \li CryptokiNotInitialized
2184 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2185 * \li FunctionFailed \li GeneralError \li HostMemory
2186 * \li ObjectHandleInvalid \li OK \li SessionClosed
2187 * \li SessionHandleInvalid \li SessionReadOnly \li TemplateInconsistent
2188 * \li TokenWriteProtected \li UserNotLoggedIn
2189 * @return true on success, false otherwise
2190 */
2192 ObjectHandle object,
2193 Attribute* attribute_template_ptr,
2194 Ulong count,
2195 ReturnValue* return_value = ThrowException) const;
2196
2197 /**
2198 * C_SetAttributeValue modifies the value of one or more object attributes.
2199 * @param session the session's handle
2200 * @param object the object's handle
2201 * @param attribute_values specifies attrs and values
2202 * @param return_value default value (`ThrowException`): throw exception on error.
2203 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2204 * At least the following PKCS #11 return values may be returned:
2205 * \li ActionProhibited \li ArgumentsBad \li AttributeReadOnly
2206 * \li AttributeTypeInvalid \li AttributeValueInvalid \li CryptokiNotInitialized
2207 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2208 * \li FunctionFailed \li GeneralError \li HostMemory
2209 * \li ObjectHandleInvalid \li OK \li SessionClosed
2210 * \li SessionHandleInvalid \li SessionReadOnly \li TemplateInconsistent
2211 * \li TokenWriteProtected \li UserNotLoggedIn
2212 * @return true on success, false otherwise
2213 */
2214 template <typename TAlloc>
2216 ObjectHandle object,
2217 std::map<AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
2218 ReturnValue* return_value = ThrowException) const {
2219 std::vector<Attribute> setter_template;
2220
2221 setter_template.reserve(attribute_values.size());
2222 for(auto& entry : attribute_values) {
2223 setter_template.emplace_back(Attribute{static_cast<CK_ATTRIBUTE_TYPE>(entry.first),
2224 entry.second.data(),
2225 checked_ulong_cast(entry.second.size())});
2226 }
2227
2228 return C_SetAttributeValue(session,
2229 object,
2230 const_cast<Attribute*>(setter_template.data()),
2231 checked_ulong_cast(setter_template.size()),
2232 return_value);
2233 }
2234
2235 /**
2236 * C_FindObjectsInit initializes a search for token and session objects that match a template.
2237 * @param session the session's handle
2238 * @param attribute_template_ptr attribute values to match
2239 * @param count attrs in search template
2240 * @param return_value default value (`ThrowException`): throw exception on error.
2241 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2242 * At least the following PKCS #11 return values may be returned:
2243 * \li ArgumentsBad \li AttributeTypeInvalid \li AttributeValueInvalid
2244 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
2245 * \li DeviceRemoved \li FunctionFailed \li GeneralError
2246 * \li HostMemory \li OK \li OperationActive
2247 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
2248 * @return true on success, false otherwise
2249 */
2250 bool C_FindObjectsInit(SessionHandle session,
2251 Attribute* attribute_template_ptr,
2252 Ulong count,
2253 ReturnValue* return_value = ThrowException) const;
2254
2255 /**
2256 * C_FindObjects continues a search for token and session objects that match a template, obtaining additional object handles.
2257 * @param session session's handle
2258 * @param object_ptr gets obj. handles
2259 * @param max_object_count max handles to get
2260 * @param object_count_ptr actual # returned
2261 * @param return_value default value (`ThrowException`): throw exception on error.
2262 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2263 * At least the following PKCS #11 return values may be returned:
2264 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2265 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2266 * \li GeneralError \li HostMemory \li OK
2267 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2268 * @return true on success, false otherwise
2269 */
2270 bool C_FindObjects(SessionHandle session,
2271 ObjectHandle* object_ptr,
2272 Ulong max_object_count,
2273 Ulong* object_count_ptr,
2274 ReturnValue* return_value = ThrowException) const;
2275
2276 /**
2277 * C_FindObjectsFinal finishes a search for token and session objects.
2278 * @param session the session's handle
2279 * @param return_value default value (`ThrowException`): throw exception on error.
2280 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2281 * At least the following PKCS #11 return values may be returned:
2282 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
2283 * \li DeviceRemoved \li FunctionFailed \li GeneralError
2284 * \li HostMemory \li OK \li OperationNotInitialized
2285 * \li SessionClosed \li SessionHandleInvalid
2286 * @return true on success, false otherwise
2287 */
2288 bool C_FindObjectsFinal(SessionHandle session, ReturnValue* return_value = ThrowException) const;
2289
2290 /****************************** Encryption functions ******************************/
2291
2292 /**
2293 * C_EncryptInit initializes an encryption operation.
2294 * @param session the session's handle
2295 * @param mechanism_ptr the encryption mechanism
2296 * @param key handle of encryption key
2297 * @param return_value default value (`ThrowException`): throw exception on error.
2298 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2299 * At least the following PKCS #11 return values may be returned:
2300 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
2301 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2302 * \li GeneralError \li HostMemory \li KeyFunctionNotPermitted
2303 * \li KeyHandleInvalid \li KeySizeRange \li KeyTypeInconsistent
2304 * \li MechanismInvalid \li MechanismParamInvalid \li OK
2305 * \li OperationActive \li PinExpired \li SessionClosed
2306 * \li SessionHandleInvalid \li UserNotLoggedIn
2307 * @return true on success, false otherwise
2308 */
2309 bool C_EncryptInit(SessionHandle session,
2310 const Mechanism* mechanism_ptr,
2311 ObjectHandle key,
2312 ReturnValue* return_value = ThrowException) const;
2313
2314 /**
2315 * C_Encrypt encrypts single-part data.
2316 * @param session session's handle
2317 * @param data_ptr the plaintext data
2318 * @param data_len size of plaintext data in bytes
2319 * @param encrypted_data gets ciphertext
2320 * @param encrypted_data_len_ptr gets c-text size
2321 * @param return_value default value (`ThrowException`): throw exception on error.
2322 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2323 * At least the following PKCS #11 return values may be returned:
2324 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2325 * \li DataInvalid \li DataLenRange \li DeviceError
2326 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2327 * \li FunctionFailed \li GeneralError \li HostMemory
2328 * \li OK \li OperationNotInitialized \li SessionClosed
2329 * \li SessionHandleInvalid
2330 * @return true on success, false otherwise
2331 */
2332 bool C_Encrypt(SessionHandle session,
2333 const Byte* data_ptr,
2334 Ulong data_len,
2335 Byte* encrypted_data,
2336 Ulong* encrypted_data_len_ptr,
2337 ReturnValue* return_value = ThrowException) const;
2338
2339 /**
2340 * C_Encrypt encrypts single-part data.
2341 * @param session session's handle
2342 * @param plaintext_data the plaintext data
2343 * @param encrypted_data gets ciphertext
2344 * @param return_value default value (`ThrowException`): throw exception on error.
2345 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2346 * At least the following PKCS #11 return values may be returned:
2347 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2348 * \li DataInvalid \li DataLenRange \li DeviceError
2349 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2350 * \li FunctionFailed \li GeneralError \li HostMemory
2351 * \li OK \li OperationNotInitialized \li SessionClosed
2352 * \li SessionHandleInvalid
2353 * @return true on success, false otherwise
2354 */
2355 template <typename TAllocA, typename TAllocB>
2357 const std::vector<uint8_t, TAllocA>& plaintext_data,
2358 std::vector<uint8_t, TAllocB>& encrypted_data,
2359 ReturnValue* return_value = ThrowException) const {
2360 Ulong encrypted_size = 0;
2361 if(!C_Encrypt(session,
2362 const_cast<Byte*>((plaintext_data.data())),
2363 checked_ulong_cast(plaintext_data.size()),
2364 nullptr,
2365 &encrypted_size,
2366 return_value)) {
2367 return false;
2368 }
2369
2370 encrypted_data.resize(encrypted_size);
2371 if(!C_Encrypt(session,
2372 const_cast<Byte*>(plaintext_data.data()),
2373 checked_ulong_cast(plaintext_data.size()),
2374 encrypted_data.data(),
2375 &encrypted_size,
2376 return_value)) {
2377 return false;
2378 }
2379 encrypted_data.resize(encrypted_size);
2380 return true;
2381 }
2382
2383 /**
2384 * C_EncryptUpdate continues a multiple-part encryption operation.
2385 * @param session session's handle
2386 * @param part_ptr the plaintext data
2387 * @param part_len plaintext data len
2388 * @param encrypted_part_ptr gets ciphertext
2389 * @param encrypted_part_len_ptr gets c-text size
2390 * @param return_value default value (`ThrowException`): throw exception on error.
2391 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2392 * At least the following PKCS #11 return values may be returned:
2393 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2394 * \li DataLenRange \li DeviceError \li DeviceMemory
2395 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2396 * \li GeneralError \li HostMemory \li OK
2397 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2398 * @return true on success, false otherwise
2399 */
2400 bool C_EncryptUpdate(SessionHandle session,
2401 const Byte* part_ptr,
2402 Ulong part_len,
2403 Byte* encrypted_part_ptr,
2404 Ulong* encrypted_part_len_ptr,
2405 ReturnValue* return_value = ThrowException) const;
2406
2407 /**
2408 * C_EncryptFinal finishes a multiple-part encryption operation.
2409 * @param session session handle
2410 * @param last_encrypted_part_ptr last c-text
2411 * @param last_encrypted_part_len_ptr gets last size
2412 * @param return_value default value (`ThrowException`): throw exception on error.
2413 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2414 * At least the following PKCS #11 return values may be returned:
2415 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2416 * \li DataLenRange \li DeviceError \li DeviceMemory
2417 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2418 * \li GeneralError \li HostMemory \li OK
2419 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2420 * @return true on success, false otherwise
2421 */
2422 bool C_EncryptFinal(SessionHandle session,
2423 Byte* last_encrypted_part_ptr,
2424 Ulong* last_encrypted_part_len_ptr,
2425 ReturnValue* return_value = ThrowException) const;
2426
2427 /*********************** Message-based encryption functions ***********************/
2428
2429 /**
2430 * C_MessageEncryptInit prepares a session for one or more encryption
2431 * operations that use the same encryption mechanism and
2432 * encryption key.
2433 *
2434 * @param session the session's handle
2435 * @param mechanism_ptr the encryption mechanism
2436 * @param key handle of encryption key
2437 * @param return_value default value (`ThrowException`): throw exception on error
2438 * @return true on success, false otherwise
2439 */
2441 const Mechanism* mechanism_ptr,
2442 ObjectHandle key,
2443 ReturnValue* return_value = ThrowException);
2444
2445 /**
2446 * C_EncryptMessage encrypts a message in a single part.
2447 *
2448 * @param session the session's handle
2449 * @param parameter_ptr message specific parameter
2450 * @param parameter_len length of message specific parameter
2451 * @param associated_data_ptr AEAD Associated data
2452 * @param associated_data_len AEAD Associated data length
2453 * @param plaintext_ptr plain text
2454 * @param plaintext_len plain text length
2455 * @param ciphertext_ptr gets cipher text
2456 * @param ciphertext_len_ptr gets cipher text length
2457 * @param return_value default value (`ThrowException`): throw exception on error
2458 * @return true on success, false otherwise
2459 */
2460 bool C_EncryptMessage(SessionHandle session,
2461 const void* parameter_ptr,
2462 Ulong parameter_len,
2463 const Byte* associated_data_ptr,
2464 Ulong associated_data_len,
2465 const Byte* plaintext_ptr,
2466 Ulong plaintext_len,
2467 Byte* ciphertext_ptr,
2468 Ulong* ciphertext_len_ptr,
2469 ReturnValue* return_value = ThrowException);
2470
2471 /**
2472 * C_EncryptMessageBegin begins a multiple-part message encryption operation.
2473 *
2474 * @param session the session's handle
2475 * @param parameter_ptr message specific parameter
2476 * @param parameter_len length of message specific parameter
2477 * @param associated_data_ptr AEAD Associated data
2478 * @param associated_data_len AEAD Associated data length
2479 * @param return_value default value (`ThrowException`): throw exception on error
2480 * @return true on success, false otherwise
2481 */
2483 const void* parameter_ptr,
2484 Ulong parameter_len,
2485 const Byte* associated_data_ptr,
2486 Ulong associated_data_len,
2487 ReturnValue* return_value = ThrowException);
2488
2489 /**
2490 * C_EncryptMessageNext continues a multiple-part message encryption operation,
2491 * processing another message part.
2492 *
2493 * @param session the session's handle
2494 * @param parameter_ptr message specific parameter
2495 * @param parameter_len length of message specific parameter
2496 * @param plaintext_part_ptr plain text
2497 * @param plaintext_part_len plain text length
2498 * @param ciphertext_ptr gets cipher text
2499 * @param ciphertext_part_len_ptr gets cipher text length
2500 * @param flags multi mode flag
2501 * @param return_value default value (`ThrowException`): throw exception on error
2502 * @return true on success, false otherwise
2503 */
2505 const void* parameter_ptr,
2506 Ulong parameter_len,
2507 const Byte* plaintext_part_ptr,
2508 Ulong plaintext_part_len,
2509 Byte* ciphertext_ptr,
2510 Ulong* ciphertext_part_len_ptr,
2511 Flags flags,
2512 ReturnValue* return_value = ThrowException);
2513
2514 /**
2515 * C_MessageDecryptFinal finishes a message-based decryption process.
2516 *
2517 * @param session the session's handle
2518 * @param return_value default value (`ThrowException`): throw exception on error
2519 * @return true on success, false otherwise
2520 */
2521 bool C_MessageEncryptFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
2522
2523 /****************************** Decryption functions ******************************/
2524
2525 /**
2526 * C_DecryptInit initializes a decryption operation.
2527 * @param session the session's handle
2528 * @param mechanism_ptr the decryption mechanism
2529 * @param key handle of decryption key
2530 * @param return_value default value (`ThrowException`): throw exception on error.
2531 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2532 * At least the following PKCS #11 return values may be returned:
2533 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2534 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2535 * \li FunctionFailed \li GeneralError \li HostMemory
2536 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
2537 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
2538 * \li OK \li OperationActive \li PinExpired
2539 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2540 * @return true on success, false otherwise
2541 */
2542 bool C_DecryptInit(SessionHandle session,
2543 const Mechanism* mechanism_ptr,
2544 ObjectHandle key,
2545 ReturnValue* return_value = ThrowException) const;
2546
2547 /**
2548 * C_Decrypt decrypts encrypted data in a single part.
2549 * @param session session's handle
2550 * @param encrypted_data_ptr ciphertext
2551 * @param encrypted_data_len ciphertext length
2552 * @param data_ptr gets plaintext
2553 * @param data_len_ptr gets p-text size
2554 * @param return_value default value (`ThrowException`): throw exception on error.
2555 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2556 * At least the following PKCS #11 return values may be returned:
2557 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2558 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2559 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2560 * \li FunctionFailed \li GeneralError \li HostMemory
2561 * \li OK \li OperationNotInitialized \li SessionClosed
2562 * \li SessionHandleInvalid \li UserNotLoggedIn
2563 * @return true on success, false otherwise
2564 */
2565 bool C_Decrypt(SessionHandle session,
2566 const Byte* encrypted_data_ptr,
2567 Ulong encrypted_data_len,
2568 Byte* data_ptr,
2569 Ulong* data_len_ptr,
2570 ReturnValue* return_value = ThrowException) const;
2571
2572 /**
2573 * C_Decrypt decrypts encrypted data in a single part.
2574 * @param session session's handle
2575 * @param encrypted_data ciphertext
2576 * @param decrypted_data gets plaintext
2577 * @param return_value default value (`ThrowException`): throw exception on error.
2578 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2579 * At least the following PKCS #11 return values may be returned:
2580 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2581 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2582 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2583 * \li FunctionFailed \li GeneralError \li HostMemory
2584 * \li OK \li OperationNotInitialized \li SessionClosed
2585 * \li SessionHandleInvalid \li UserNotLoggedIn
2586 * @return true on success, false otherwise
2587 */
2588 template <typename TAllocA, typename TAllocB>
2590 const std::vector<uint8_t, TAllocA>& encrypted_data,
2591 std::vector<uint8_t, TAllocB>& decrypted_data,
2592 ReturnValue* return_value = ThrowException) const {
2593 Ulong decrypted_size = 0;
2594 if(!C_Decrypt(session,
2595 const_cast<Byte*>((encrypted_data.data())),
2596 checked_ulong_cast(encrypted_data.size()),
2597 nullptr,
2598 &decrypted_size,
2599 return_value)) {
2600 return false;
2601 }
2602
2603 decrypted_data.resize(decrypted_size);
2604 if(!C_Decrypt(session,
2605 const_cast<Byte*>(encrypted_data.data()),
2606 checked_ulong_cast(encrypted_data.size()),
2607 decrypted_data.data(),
2608 &decrypted_size,
2609 return_value)) {
2610 return false;
2611 }
2612 decrypted_data.resize(decrypted_size);
2613 return true;
2614 }
2615
2616 /**
2617 * C_DecryptUpdate continues a multiple-part decryption operation.
2618 * @param session session's handle
2619 * @param encrypted_part_ptr encrypted data
2620 * @param encrypted_part_len input length
2621 * @param part_ptr gets plaintext
2622 * @param part_len_ptr p-text size
2623 * @param return_value default value (`ThrowException`): throw exception on error.
2624 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2625 * At least the following PKCS #11 return values may be returned:
2626 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2627 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2628 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2629 * \li FunctionFailed \li GeneralError \li HostMemory
2630 * \li OK \li OperationNotInitialized \li SessionClosed
2631 * \li SessionHandleInvalid \li UserNotLoggedIn
2632 * @return true on success, false otherwise
2633 */
2634 bool C_DecryptUpdate(SessionHandle session,
2635 const Byte* encrypted_part_ptr,
2636 Ulong encrypted_part_len,
2637 Byte* part_ptr,
2638 Ulong* part_len_ptr,
2639 ReturnValue* return_value = ThrowException) const;
2640
2641 /**
2642 * C_DecryptFinal finishes a multiple-part decryption operation.
2643 * @param session the session's handle
2644 * @param last_part_ptr gets plaintext
2645 * @param last_part_len_ptr p-text size
2646 * @param return_value default value (`ThrowException`): throw exception on error.
2647 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2648 * At least the following PKCS #11 return values may be returned:
2649 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2650 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2651 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2652 * \li FunctionFailed \li GeneralError \li HostMemory
2653 * \li OK \li OperationNotInitialized \li SessionClosed
2654 * \li SessionHandleInvalid \li UserNotLoggedIn
2655 * @return true on success, false otherwise
2656 */
2657 bool C_DecryptFinal(SessionHandle session,
2658 Byte* last_part_ptr,
2659 Ulong* last_part_len_ptr,
2660 ReturnValue* return_value = ThrowException) const;
2661
2662 /*********************** Message-based decryption functions ***********************/
2663
2664 /**
2665 * C_MessageDecryptInit initializes a message-based decryption process,
2666 * preparing a session for one or more decryption operations that use the
2667 * same decryption mechanism and decryption key.
2668 *
2669 * @param session the session's handle
2670 * @param mechanism_ptr the decryption mechanism
2671 * @param key handle of decryption key
2672 * @param return_value default value (`ThrowException`): throw exception on error
2673 * @return true on success, false otherwise
2674 */
2676 const Mechanism* mechanism_ptr,
2677 ObjectHandle key,
2678 ReturnValue* return_value = ThrowException);
2679
2680 /**
2681 * C_DecryptMessage decrypts an encrypted message in a single part.
2682 *
2683 * @param session the session's handle
2684 * @param parameter_ptr message specific parameter
2685 * @param parameter_len length of message specific parameter
2686 * @param associated_data_ptr AEAD Associated data
2687 * @param associated_data_len AEAD Associated data length
2688 * @param ciphertext_ptr cipher text
2689 * @param ciphertext_len cipher text length
2690 * @param plaintext_ptr gets plain text
2691 * @param plaintext_len_ptr gets plain text length
2692 * @param return_value default value (`ThrowException`): throw exception on error
2693 * @return true on success, false otherwise
2694 */
2695 bool C_DecryptMessage(SessionHandle session,
2696 const void* parameter_ptr,
2697 Ulong parameter_len,
2698 const Byte* associated_data_ptr,
2699 Ulong associated_data_len,
2700 const Byte* ciphertext_ptr,
2701 Ulong ciphertext_len,
2702 Byte* plaintext_ptr,
2703 Ulong* plaintext_len_ptr,
2704 ReturnValue* return_value = ThrowException);
2705
2706 /**
2707 * C_DecryptMessageBegin begins a multiple-part message decryption operation.
2708 *
2709 * @param session the session's handle
2710 * @param parameter_ptr message specific parameter
2711 * @param parameter_len length of message specific parameter
2712 * @param associated_data_ptr AEAD Associated data
2713 * @param associated_data_len AEAD Associated data length
2714 * @param return_value default value (`ThrowException`): throw exception on error
2715 * @return true on success, false otherwise
2716 */
2718 const void* parameter_ptr,
2719 Ulong parameter_len,
2720 const Byte* associated_data_ptr,
2721 Ulong associated_data_len,
2722 ReturnValue* return_value = ThrowException);
2723
2724 /**
2725 * C_DecryptMessageNext continues a multiple-part message decryption operation,
2726 * processing another encrypted message part.
2727 *
2728 * @param session the session's handle
2729 * @param parameter_ptr message specific parameter
2730 * @param parameter_len length of message specific parameter
2731 * @param ciphertext_part_ptr cipher text
2732 * @param ciphertext_part_len cipher text length
2733 * @param plaintext_ptr gets plain text
2734 * @param plaintext_part_len_ptr gets plain text length
2735 * @param flags multi mode flag
2736 * @param return_value default value (`ThrowException`): throw exception on error
2737 * @return true on success, false otherwise
2738 */
2740 const void* parameter_ptr,
2741 Ulong parameter_len,
2742 const Byte* ciphertext_part_ptr,
2743 Ulong ciphertext_part_len,
2744 Byte* plaintext_ptr,
2745 Ulong* plaintext_part_len_ptr,
2746 Flags flags,
2747 ReturnValue* return_value = ThrowException);
2748
2749 /**
2750 * C_MessageDecryptFinal finishes a message-based decryption process.
2751 *
2752 * @param session the session's handle
2753 * @param return_value default value (`ThrowException`): throw exception on error
2754 * @return true on success, false otherwise
2755 */
2756 bool C_MessageDecryptFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
2757
2758 /****************************** Message digesting functions ******************************/
2759
2760 /**
2761 * C_DigestInit initializes a message-digesting operation.
2762 * @param session the session's handle
2763 * @param mechanism_ptr the digesting mechanism
2764 * @param return_value default value (`ThrowException`): throw exception on error.
2765 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2766 * At least the following PKCS #11 return values may be returned:
2767 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2768 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2769 * \li FunctionFailed \li GeneralError \li HostMemory
2770 * \li MechanismInvalid \li MechanismParamInvalid \li OK
2771 * \li OperationActive \li PinExpired \li SessionClosed
2772 * \li SessionHandleInvalid \li UserNotLoggedIn
2773 * @return true on success, false otherwise
2774 */
2775 bool C_DigestInit(SessionHandle session,
2776 const Mechanism* mechanism_ptr,
2777 ReturnValue* return_value = ThrowException) const;
2778
2779 /**
2780 * C_Digest digests data in a single part.
2781 * @param session the session's handle
2782 * @param data_ptr data to be digested
2783 * @param data_len bytes of data to digest
2784 * @param digest_ptr gets the message digest
2785 * @param digest_len_ptr gets digest length
2786 * @param return_value default value (`ThrowException`): throw exception on error.
2787 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2788 * At least the following PKCS #11 return values may be returned:
2789 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2790 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2791 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2792 * \li HostMemory \li OK \li OperationNotInitialized
2793 * \li SessionClosed \li SessionHandleInvalid
2794 * @return true on success, false otherwise
2795 */
2796 bool C_Digest(SessionHandle session,
2797 const Byte* data_ptr,
2798 Ulong data_len,
2799 Byte* digest_ptr,
2800 Ulong* digest_len_ptr,
2801 ReturnValue* return_value = ThrowException) const;
2802
2803 /**
2804 * C_DigestUpdate continues a multiple-part message-digesting operation.
2805 * @param session the session's handle
2806 * @param part_ptr data to be digested
2807 * @param part_len bytes of data to be digested
2808 * @param return_value default value (`ThrowException`): throw exception on error.
2809 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2810 * At least the following PKCS #11 return values may be returned:
2811 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2812 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2813 * \li FunctionFailed \li GeneralError \li HostMemory
2814 * \li OK \li OperationNotInitialized \li SessionClosed
2815 * \li SessionHandleInvalid
2816 * @return true on success, false otherwise
2817 */
2818 bool C_DigestUpdate(SessionHandle session,
2819 const Byte* part_ptr,
2820 Ulong part_len,
2821 ReturnValue* return_value = ThrowException) const;
2822
2823 /**
2824 * C_DigestKey continues a multi-part message-digesting operation, by digesting the value of a secret key as part of the data already digested.
2825 * @param session the session's handle
2826 * @param key secret key to 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 CryptokiNotInitialized \li DeviceError \li DeviceMemory
2831 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2832 * \li GeneralError \li HostMemory \li KeyHandleInvalid
2833 * \li KeyIndigestible \li KeySizeRange \li OK
2834 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2835 * @return true on success, false otherwise
2836 */
2837 bool C_DigestKey(SessionHandle session, ObjectHandle key, ReturnValue* return_value = ThrowException) const;
2838
2839 /**
2840 * C_DigestFinal finishes a multiple-part message-digesting operation.
2841 * @param session the session's handle
2842 * @param digest_ptr gets the message digest
2843 * @param digest_len_ptr gets uint8_t count of digest
2844 * @param return_value default value (`ThrowException`): throw exception on error.
2845 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2846 * At least the following PKCS #11 return values may be returned:
2847 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2848 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2849 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2850 * \li HostMemory \li OK \li OperationNotInitialized
2851 * \li SessionClosed \li SessionHandleInvalid
2852 * @return true on success, false otherwise
2853 */
2854 bool C_DigestFinal(SessionHandle session,
2855 Byte* digest_ptr,
2856 Ulong* digest_len_ptr,
2857 ReturnValue* return_value = ThrowException) const;
2858
2859 /****************************** Signing and MACing functions ******************************/
2860
2861 /**
2862 * 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.
2863 * @param session the session's handle
2864 * @param mechanism_ptr the signature mechanism
2865 * @param key handle of signature key
2866 * @param return_value default value (`ThrowException`): throw exception on error.
2867 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2868 * At least the following PKCS #11 return values may be returned:
2869 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2870 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2871 * \li FunctionFailed \li GeneralError \li HostMemory
2872 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
2873 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
2874 * \li OK \li OperationActive \li PinExpired
2875 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2876 * @return true on success, false otherwise
2877 */
2878 bool C_SignInit(SessionHandle session,
2879 const Mechanism* mechanism_ptr,
2880 ObjectHandle key,
2881 ReturnValue* return_value = ThrowException) const;
2882
2883 /**
2884 * 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.
2885 * @param session the session's handle
2886 * @param data_ptr the data to sign
2887 * @param data_len count of bytes to sign
2888 * @param signature_ptr gets the signature
2889 * @param signature_len_ptr gets signature length
2890 * @param return_value default value (`ThrowException`): throw exception on error.
2891 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2892 * At least the following PKCS #11 return values may be returned:
2893 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2894 * \li DataInvalid \li DataLenRange \li DeviceError
2895 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2896 * \li FunctionFailed \li GeneralError \li HostMemory
2897 * \li OK \li OperationNotInitialized \li SessionClosed
2898 * \li SessionHandleInvalid \li UserNotLoggedIn \li FunctionRejected
2899 * @return true on success, false otherwise
2900 */
2901 bool C_Sign(SessionHandle session,
2902 const Byte* data_ptr,
2903 Ulong data_len,
2904 Byte* signature_ptr,
2905 Ulong* signature_len_ptr,
2906 ReturnValue* return_value = ThrowException) const;
2907
2908 /**
2909 * 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.
2910 * @param session the session's handle
2911 * @param data the data to sign
2912 * @param signature gets the signature
2913 * @param return_value default value (`ThrowException`): throw exception on error.
2914 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2915 * At least the following PKCS #11 return values may be returned:
2916 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2917 * \li DataInvalid \li DataLenRange \li DeviceError
2918 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2919 * \li FunctionFailed \li GeneralError \li HostMemory
2920 * \li OK \li OperationNotInitialized \li SessionClosed
2921 * \li SessionHandleInvalid \li UserNotLoggedIn \li FunctionRejected
2922 * @return true on success, false otherwise
2923 */
2924 template <typename TAllocA, typename TAllocB>
2925 bool C_Sign(SessionHandle session,
2926 const std::vector<uint8_t, TAllocA>& data,
2927 std::vector<uint8_t, TAllocB>& signature,
2928 ReturnValue* return_value = ThrowException) const {
2929 Ulong signature_size = 0;
2930 if(!C_Sign(session, data.data(), checked_ulong_cast(data.size()), nullptr, &signature_size, return_value)) {
2931 return false;
2932 }
2933
2934 signature.resize(signature_size);
2935 if(!C_Sign(session,
2936 data.data(),
2937 checked_ulong_cast(data.size()),
2938 signature.data(),
2939 &signature_size,
2940 return_value)) {
2941 return false;
2942 }
2943 signature.resize(signature_size);
2944 return true;
2945 }
2946
2947 /**
2948 * 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.
2949 * @param session the session's handle
2950 * @param part_ptr the data to sign
2951 * @param part_len count of bytes to sign
2952 * @param return_value default value (`ThrowException`): throw exception on error.
2953 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2954 * At least the following PKCS #11 return values may be returned:
2955 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
2956 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2957 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2958 * \li HostMemory \li OK \li OperationNotInitialized
2959 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2960 * @return true on success, false otherwise
2961 */
2962 bool C_SignUpdate(SessionHandle session,
2963 const Byte* part_ptr,
2964 Ulong part_len,
2965 ReturnValue* return_value = ThrowException) const;
2966
2967 /**
2968 * 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.
2969 * @param session the session's handle
2970 * @param part the data to sign
2971 * @param return_value default value (`ThrowException`): throw exception on error.
2972 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2973 * At least the following PKCS #11 return values may be returned:
2974 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
2975 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2976 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2977 * \li HostMemory \li OK \li OperationNotInitialized
2978 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2979 * @return true on success, false otherwise
2980 */
2981 template <typename TAlloc>
2983 const std::vector<uint8_t, TAlloc>& part,
2984 ReturnValue* return_value = ThrowException) const {
2985 return C_SignUpdate(session, part.data(), checked_ulong_cast(part.size()), return_value);
2986 }
2987
2988 /**
2989 * C_SignFinal finishes a multiple-part signature operation, returning the signature.
2990 * @param session the session's handle
2991 * @param signature_ptr gets the signature
2992 * @param signature_len_ptr gets signature length
2993 * @param return_value default value (`ThrowException`): throw exception on error.
2994 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2995 * At least the following PKCS #11 return values may be returned:
2996 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2997 * \li DataLenRange \li DeviceError \li DeviceMemory
2998 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2999 * \li GeneralError \li HostMemory \li OK
3000 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3001 * \li UserNotLoggedIn \li FunctionRejected
3002 * @return true on success, false otherwise
3003 */
3004 bool C_SignFinal(SessionHandle session,
3005 Byte* signature_ptr,
3006 Ulong* signature_len_ptr,
3007 ReturnValue* return_value = ThrowException) const;
3008
3009 /**
3010 * C_SignFinal finishes a multiple-part signature operation, returning the signature.
3011 * @param session the session's handle
3012 * @param signature gets the signature
3013 * @param return_value default value (`ThrowException`): throw exception on error.
3014 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3015 * At least the following PKCS #11 return values may be returned:
3016 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3017 * \li DataLenRange \li DeviceError \li DeviceMemory
3018 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3019 * \li GeneralError \li HostMemory \li OK
3020 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3021 * \li UserNotLoggedIn \li FunctionRejected
3022 * @return true on success, false otherwise
3023 */
3024 template <typename TAlloc>
3026 std::vector<uint8_t, TAlloc>& signature,
3027 ReturnValue* return_value = ThrowException) const {
3028 Ulong signature_size = 0;
3029 if(!C_SignFinal(session, nullptr, &signature_size, return_value)) {
3030 return false;
3031 }
3032
3033 signature.resize(signature_size);
3034 if(!C_SignFinal(session, signature.data(), &signature_size, return_value)) {
3035 return false;
3036 }
3037 signature.resize(signature_size);
3038 return true;
3039 }
3040
3041 /**
3042 * C_SignRecoverInit initializes a signature operation, where the data can be recovered from the signature.
3043 * @param session the session's handle
3044 * @param mechanism_ptr the signature mechanism
3045 * @param key handle of the signature key
3046 * @param return_value default value (`ThrowException`): throw exception on error.
3047 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3048 * At least the following PKCS #11 return values may be returned:
3049 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3050 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3051 * \li FunctionFailed \li GeneralError \li HostMemory
3052 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
3053 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
3054 * \li OK \li OperationActive \li PinExpired
3055 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3056 * @return true on success, false otherwise
3057 */
3058 bool C_SignRecoverInit(SessionHandle session,
3059 const Mechanism* mechanism_ptr,
3060 ObjectHandle key,
3061 ReturnValue* return_value = ThrowException) const;
3062
3063 /**
3064 * C_SignRecover signs data in a single operation, where the data can be recovered from the signature.
3065 * @param session the session's handle
3066 * @param data_ptr the data to sign
3067 * @param data_len count of bytes to sign
3068 * @param signature_ptr gets the signature
3069 * @param signature_len_ptr gets signature length
3070 * @param return_value default value (`ThrowException`): throw exception on error.
3071 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3072 * At least the following PKCS #11 return values may be returned:
3073 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3074 * \li DataInvalid \li DataLenRange \li DeviceError
3075 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3076 * \li FunctionFailed \li GeneralError \li HostMemory
3077 * \li OK \li OperationNotInitialized \li SessionClosed
3078 * \li SessionHandleInvalid \li UserNotLoggedIn
3079 * @return true on success, false otherwise
3080 */
3081 bool C_SignRecover(SessionHandle session,
3082 const Byte* data_ptr,
3083 Ulong data_len,
3084 Byte* signature_ptr,
3085 Ulong* signature_len_ptr,
3086 ReturnValue* return_value = ThrowException) const;
3087
3088 /******************* Message-based signing and MACing functions *******************/
3089
3090 /**
3091 * C_MessageSignInit initializes a message-based signature process, preparing a
3092 * session for one or more signature operations (where the signature is an
3093 * appendix to the data) that use the same signature mechanism and
3094 * signature key.
3095 *
3096 * @param session the session's handle
3097 * @param mechanism_ptr the signing mechanism
3098 * @param key handle of signing key
3099 * @param return_value default value (`ThrowException`): throw exception on error
3100 * @return true on success, false otherwise
3101 */
3102 bool C_MessageSignInit(SessionHandle session,
3103 const Mechanism* mechanism_ptr,
3104 ObjectHandle key,
3105 ReturnValue* return_value = ThrowException);
3106
3107 /**
3108 * C_SignMessage signs a message in a single part, where the signature is an
3109 * appendix to the message. C_MessageSignInit must previously been called
3110 * on the session.
3111 *
3112 * @param session the session's handle
3113 * @param parameter_ptr message specific parameter
3114 * @param parameter_len length of message specific parameter
3115 * @param data_ptr data to sign
3116 * @param data_len data to sign length
3117 * @param signature_ptr gets signature
3118 * @param signature_len_ptr gets signature length
3119 * @param return_value default value (`ThrowException`): throw exception on error
3120 * @return true on success, false otherwise
3121 */
3122 bool C_SignMessage(SessionHandle session,
3123 const void* parameter_ptr,
3124 Ulong parameter_len,
3125 const Byte* data_ptr,
3126 Ulong data_len,
3127 Byte* signature_ptr,
3128 Ulong* signature_len_ptr,
3129 ReturnValue* return_value = ThrowException);
3130
3131 /**
3132 * C_SignMessageBegin begins a multiple-part message signature operation, where
3133 * the signature is an appendix to the message. C_MessageSignInit must
3134 * previously been called on the session.
3135 *
3136 * @param session the session's handle
3137 * @param parameter_ptr message specific parameter
3138 * @param parameter_len length of message specific parameter
3139 * @param return_value default value (`ThrowException`): throw exception on error
3140 * @return true on success, false otherwise
3141 */
3142 bool C_SignMessageBegin(SessionHandle session,
3143 const void* parameter_ptr,
3144 Ulong parameter_len,
3145 ReturnValue* return_value = ThrowException);
3146
3147 /**
3148 * C_SignMessageNext continues a multiple-part message signature operation,
3149 * processing another data part, or finishes a multiple-part message
3150 * signature operation, returning the signature.
3151 *
3152 * @param session the session's handle
3153 * @param parameter_ptr message specific parameter
3154 * @param parameter_len length of message specific parameter
3155 * @param data_ptr data to sign
3156 * @param data_len data to sign length
3157 * @param signature_ptr gets signature
3158 * @param signature_len_ptr gets signature length
3159 * @param return_value default value (`ThrowException`): throw exception on error
3160 * @return true on success, false otherwise
3161 */
3162 bool C_SignMessageNext(SessionHandle session,
3163 const void* parameter_ptr,
3164 Ulong parameter_len,
3165 const Byte* data_ptr,
3166 Ulong data_len,
3167 Byte* signature_ptr,
3168 Ulong* signature_len_ptr,
3169 ReturnValue* return_value = ThrowException);
3170
3171 /**
3172 * C_MessageSignFinal finishes a message-based signing process.
3173 *
3174 * @param session the session's handle
3175 * @param return_value default value (`ThrowException`): throw exception on error
3176 * @return true on success, false otherwise
3177 */
3178 bool C_MessageSignFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
3179
3180 /****************************** Functions for verifying signatures and MACs ******************************/
3181
3182 /**
3183 * 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).
3184 * @param session the session's handle
3185 * @param mechanism_ptr the verification mechanism
3186 * @param key verification key
3187 * @param return_value default value (`ThrowException`): throw exception on error.
3188 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3189 * At least the following PKCS #11 return values may be returned:
3190 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3191 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3192 * \li FunctionFailed \li GeneralError \li HostMemory
3193 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
3194 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
3195 * \li OK \li OperationActive \li PinExpired
3196 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3197 * @return true on success, false otherwise
3198 */
3199 bool C_VerifyInit(SessionHandle session,
3200 const Mechanism* mechanism_ptr,
3201 ObjectHandle key,
3202 ReturnValue* return_value = ThrowException) const;
3203
3204 /**
3205 * 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.
3206 * @param session the session's handle
3207 * @param data_ptr signed data
3208 * @param data_len length of signed data
3209 * @param signature_ptr signature
3210 * @param signature_len signature length
3211 * @param return_value default value (`ThrowException`): throw exception on error.
3212 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3213 * At least the following PKCS #11 return values may be returned:
3214 * \li ArgumentsBad \li CryptokiNotInitialized \li DataInvalid
3215 * \li DataLenRange \li DeviceError \li DeviceMemory
3216 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3217 * \li GeneralError \li HostMemory \li OK
3218 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3219 * \li SignatureInvalid \li SignatureLenRange
3220 * @return true on success, false otherwise
3221 */
3222 bool C_Verify(SessionHandle session,
3223 const Byte* data_ptr,
3224 Ulong data_len,
3225 const Byte* signature_ptr,
3226 Ulong signature_len,
3227 ReturnValue* return_value = ThrowException) const;
3228
3229 /**
3230 * 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.
3231 * @param session the session's handle
3232 * @param data signed data
3233 * @param signature signature
3234 * @param return_value default value (`ThrowException`): throw exception on error.
3235 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3236 * At least the following PKCS #11 return values may be returned:
3237 * \li ArgumentsBad \li CryptokiNotInitialized \li DataInvalid
3238 * \li DataLenRange \li DeviceError \li DeviceMemory
3239 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3240 * \li GeneralError \li HostMemory \li OK
3241 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3242 * \li SignatureInvalid \li SignatureLenRange
3243 * @return true on success, false otherwise
3244 */
3245 template <typename TAllocA, typename TAllocB>
3247 const std::vector<uint8_t, TAllocA>& data,
3248 std::vector<uint8_t, TAllocB>& signature,
3249 ReturnValue* return_value = ThrowException) const {
3250 return C_Verify(session,
3251 data.data(),
3252 checked_ulong_cast(data.size()),
3253 signature.data(),
3254 checked_ulong_cast(signature.size()),
3255 return_value);
3256 }
3257
3258 /**
3259 * 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.
3260 * @param session the session's handle
3261 * @param part_ptr signed data
3262 * @param part_len length of signed data
3263 * @param return_value default value (`ThrowException`): throw exception on error.
3264 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3265 * At least the following PKCS #11 return values may be returned:
3266 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
3267 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3268 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3269 * \li HostMemory \li OK \li OperationNotInitialized
3270 * \li SessionClosed \li SessionHandleInvalid
3271 * @return true on success, false otherwise
3272 */
3273 bool C_VerifyUpdate(SessionHandle session,
3274 const Byte* part_ptr,
3275 Ulong part_len,
3276 ReturnValue* return_value = ThrowException) const;
3277
3278 /**
3279 * 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.
3280 * @param session the session's handle
3281 * @param part signed data
3282 * @param return_value default value (`ThrowException`): throw exception on error.
3283 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3284 * At least the following PKCS #11 return values may be returned:
3285 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
3286 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3287 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3288 * \li HostMemory \li OK \li OperationNotInitialized
3289 * \li SessionClosed \li SessionHandleInvalid
3290 * @return true on success, false otherwise
3291 */
3292 template <typename TAlloc>
3294 std::vector<uint8_t, TAlloc> part,
3295 ReturnValue* return_value = ThrowException) const {
3296 return C_VerifyUpdate(session, part.data(), checked_ulong_cast(part.size()), return_value);
3297 }
3298
3299 /**
3300 * C_VerifyFinal finishes a multiple-part verification operation, checking the signature.
3301 * @param session the session's handle
3302 * @param signature_ptr signature to verify
3303 * @param signature_len signature length
3304 * @param return_value default value (`ThrowException`): throw exception on error.
3305 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3306 * At least the following PKCS #11 return values may be returned:
3307 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
3308 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3309 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3310 * \li HostMemory \li OK \li OperationNotInitialized
3311 * \li SessionClosed \li SessionHandleInvalid \li SignatureInvalid
3312 * \li SignatureLenRange
3313 * @return true on success, false otherwise
3314 */
3315 bool C_VerifyFinal(SessionHandle session,
3316 const Byte* signature_ptr,
3317 Ulong signature_len,
3318 ReturnValue* return_value = ThrowException) const;
3319
3320 /**
3321 * C_VerifyRecoverInit initializes a signature verification operation, where the data is recovered from the signature.
3322 * @param session the session's handle
3323 * @param mechanism_ptr the verification mechanism
3324 * @param key verification key
3325 * @param return_value default value (`ThrowException`): throw exception on error.
3326 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3327 * At least the following PKCS #11 return values may be returned:
3328 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3329 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3330 * \li FunctionFailed \li GeneralError \li HostMemory
3331 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
3332 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
3333 * \li OK \li OperationActive \li PinExpired
3334 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3335 * @return true on success, false otherwise
3336 */
3338 const Mechanism* mechanism_ptr,
3339 ObjectHandle key,
3340 ReturnValue* return_value = ThrowException) const;
3341
3342 /**
3343 * C_VerifyRecover verifies a signature in a single-part operation, where the data is recovered from the signature.
3344 * @param session the session's handle
3345 * @param signature_ptr signature to verify
3346 * @param signature_len signature length
3347 * @param data_ptr gets signed data
3348 * @param data_len_ptr gets signed data len
3349 * @param return_value default value (`ThrowException`): throw exception on error.
3350 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3351 * At least the following PKCS #11 return values may be returned:
3352 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3353 * \li DataInvalid \li DataLenRange \li DeviceError
3354 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3355 * \li FunctionFailed \li GeneralError \li HostMemory
3356 * \li OK \li OperationNotInitialized \li SessionClosed
3357 * \li SessionHandleInvalid \li SignatureLenRange \li SignatureInvalid
3358 * @return true on success, false otherwise
3359 */
3360 bool C_VerifyRecover(SessionHandle session,
3361 const Byte* signature_ptr,
3362 Ulong signature_len,
3363 Byte* data_ptr,
3364 Ulong* data_len_ptr,
3365 ReturnValue* return_value = ThrowException) const;
3366
3367 /**
3368 * C_VerifySignatureInit initializes a verification operation, where the
3369 * signature is included as part of the initialization.
3370 *
3371 * @param session the session's handle
3372 * @param mechanism_ptr the verification mechanism
3373 * @param key verification key
3374 * @param signature_ptr signature
3375 * @param signature_len signature length
3376 * @param return_value default value (`ThrowException`): throw exception on error
3377 * @return true on success, false otherwise
3378 */
3380 const Mechanism* mechanism_ptr,
3381 ObjectHandle key,
3382 const Byte* signature_ptr,
3383 Ulong signature_len,
3384 ReturnValue* return_value = ThrowException);
3385
3386 /**
3387 * C_VerifySignature verifies a signature in a single-part operation, where the
3388 * signature is an appendix to the data.
3389 *
3390 * @param session the session's handle
3391 * @param data_ptr signed data
3392 * @param data_len length of signed data
3393 * @param return_value default value (`ThrowException`): throw exception on error
3394 * @return true on success, false otherwise
3395 */
3396 bool C_VerifySignature(SessionHandle session,
3397 const Byte* data_ptr,
3398 Ulong data_len,
3399 ReturnValue* return_value = ThrowException);
3400
3401 /**
3402 * C_VerifySignatureUpdate continues a multiple-part verification operation,
3403 * processing another data part.
3404 *
3405 * @param session the session's handle
3406 * @param part_ptr signed data
3407 * @param part_len length of signed data
3408 * @param return_value default value (`ThrowException`): throw exception on error
3409 * @return true on success, false otherwise
3410 */
3412 const Byte* part_ptr,
3413 Ulong part_len,
3414 ReturnValue* return_value = ThrowException);
3415
3416 /**
3417 * C_VerifySignatureFinal finishes a multiple-part verification operation,
3418 * checking the signature.
3419 *
3420 * @param session the session's handle
3421 * @param return_value default value (`ThrowException`): throw exception on error
3422 * @return true on success, false otherwise
3423 */
3424 bool C_VerifySignatureFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
3425
3426 /*********** Message-based functions for verifying signatures and MACs ************/
3427
3428 /**
3429 * C_MessageVerifyInit initializes a message-based verification process,
3430 * preparing a session for one or more verification operations (where the
3431 * signature is an appendix to the data) that use the same verification
3432 * mechanism and verification key.
3433 *
3434 * @param session the session's handle
3435 * @param mechanism_ptr the signing mechanism
3436 * @param key handle of signing key
3437 * @param return_value default value (`ThrowException`): throw exception on error
3438 * @return true on success, false otherwise
3439 */
3441 const Mechanism* mechanism_ptr,
3442 ObjectHandle key,
3443 ReturnValue* return_value = ThrowException);
3444
3445 /**
3446 * C_VerifyMessage verifies a signature on a message in a single part operation,
3447 * where the signature is an appendix to the data. C_MessageVerifyInit must
3448 * previously been called on the session.
3449 *
3450 * @param session the session's handle
3451 * @param parameter_ptr message specific parameter
3452 * @param parameter_len length of message specific parameter
3453 * @param data_ptr data to sign
3454 * @param data_len data to sign length
3455 * @param signature_ptr signature
3456 * @param signature_len signature length
3457 * @param return_value default value (`ThrowException`): throw exception on error
3458 * @return true on success, false otherwise
3459 */
3460 bool C_VerifyMessage(SessionHandle session,
3461 const void* parameter_ptr,
3462 Ulong parameter_len,
3463 const Byte* data_ptr,
3464 Ulong data_len,
3465 const Byte* signature_ptr,
3466 Ulong signature_len,
3467 ReturnValue* return_value = ThrowException);
3468
3469 /**
3470 * C_VerifyMessageBegin begins a multiple-part message verification operation,
3471 * where the signature is an appendix to the message. C_MessageVerifyInit
3472 * must previously been called on the session.
3473 *
3474 * @param session the session's handle
3475 * @param parameter_ptr message specific parameter
3476 * @param parameter_len length of message specific parameter
3477 * @param return_value default value (`ThrowException`): throw exception on error
3478 * @return true on success, false otherwise
3479 */
3481 const void* parameter_ptr,
3482 Ulong parameter_len,
3483 ReturnValue* return_value = ThrowException);
3484
3485 /**
3486 * C_VerifyMessageNext continues a multiple-part message verification operation,
3487 * processing another data part, or finishes a multiple-part message
3488 * verification operation, checking the signature.
3489 *
3490 * @param session the session's handle
3491 * @param parameter_ptr message specific parameter
3492 * @param parameter_len length of message specific parameter
3493 * @param data_ptr data to sign
3494 * @param data_len data to sign length
3495 * @param signature_ptr signature
3496 * @param signature_len signature length
3497 * @param return_value default value (`ThrowException`): throw exception on error
3498 * @return true on success, false otherwise
3499 */
3501 const void* parameter_ptr,
3502 Ulong parameter_len,
3503 const Byte* data_ptr,
3504 Ulong data_len,
3505 const Byte* signature_ptr,
3506 Ulong signature_len,
3507 ReturnValue* return_value = ThrowException);
3508
3509 /**
3510 * C_MessageVerifyFinal finishes a message-based verification process.
3511 *
3512 * @param session the session's handle
3513 * @param return_value default value (`ThrowException`): throw exception on error
3514 * @return true on success, false otherwise
3515 */
3516 bool C_MessageVerifyFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
3517
3518 /****************************** Dual-purpose cryptographic functions ******************************/
3519
3520 /**
3521 * C_DigestEncryptUpdate continues a multiple-part digesting and encryption operation.
3522 * @param session session's handle
3523 * @param part_ptr the plaintext data
3524 * @param part_len plaintext length
3525 * @param encrypted_part_ptr gets ciphertext
3526 * @param encrypted_part_len_ptr gets c-text length
3527 * @param return_value default value (`ThrowException`): throw exception on error.
3528 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3529 * At least the following PKCS #11 return values may be returned:
3530 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3531 * \li DataLenRange \li DeviceError \li DeviceMemory
3532 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3533 * \li GeneralError \li HostMemory \li OK
3534 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3535 * @return true on success, false otherwise
3536 */
3538 const Byte* part_ptr,
3539 Ulong part_len,
3540 Byte* encrypted_part_ptr,
3541 Ulong* encrypted_part_len_ptr,
3542 ReturnValue* return_value = ThrowException) const;
3543
3544 /**
3545 * C_DecryptDigestUpdate continues a multiple-part decryption and digesting operation.
3546 * @param session session's handle
3547 * @param encrypted_part_ptr ciphertext
3548 * @param encrypted_part_len ciphertext length
3549 * @param part_ptr gets plaintext
3550 * @param part_len_ptr gets plaintext len
3551 * @param return_value default value (`ThrowException`): throw exception on error.
3552 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3553 * At least the following PKCS #11 return values may be returned:
3554 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3555 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3556 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
3557 * \li FunctionFailed \li GeneralError \li HostMemory
3558 * \li OK \li OperationNotInitialized \li SessionClosed
3559 * \li SessionHandleInvalid
3560 * @return true on success, false otherwise
3561 */
3563 const Byte* encrypted_part_ptr,
3564 Ulong encrypted_part_len,
3565 Byte* part_ptr,
3566 Ulong* part_len_ptr,
3567 ReturnValue* return_value = ThrowException) const;
3568
3569 /**
3570 * C_SignEncryptUpdate continues a multiple-part signing and encryption operation.
3571 * @param session session's handle
3572 * @param part_ptr the plaintext data
3573 * @param part_len plaintext length
3574 * @param encrypted_part_ptr gets ciphertext
3575 * @param encrypted_part_len_ptr gets c-text length
3576 * @param return_value default value (`ThrowException`): throw exception on error.
3577 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3578 * At least the following PKCS #11 return values may be returned:
3579 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3580 * \li DataLenRange \li DeviceError \li DeviceMemory
3581 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3582 * \li GeneralError \li HostMemory \li OK
3583 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3584 * \li UserNotLoggedIn
3585 * @return true on success, false otherwise
3586 */
3588 const Byte* part_ptr,
3589 Ulong part_len,
3590 Byte* encrypted_part_ptr,
3591 Ulong* encrypted_part_len_ptr,
3592 ReturnValue* return_value = ThrowException) const;
3593
3594 /**
3595 * C_DecryptVerifyUpdate continues a multiple-part decryption and verify operation.
3596 * @param session session's handle
3597 * @param encrypted_part_ptr ciphertext
3598 * @param encrypted_part_len ciphertext length
3599 * @param part_ptr gets plaintext
3600 * @param part_len_ptr gets p-text length
3601 * @param return_value default value (`ThrowException`): throw exception on error.
3602 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3603 * At least the following PKCS #11 return values may be returned:
3604 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3605 * \li DataLenRange \li DeviceError \li DeviceMemory
3606 * \li DeviceRemoved \li EncryptedDataInvalid \li EncryptedDataLenRange
3607 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3608 * \li HostMemory \li OK \li OperationNotInitialized
3609 * \li SessionClosed \li SessionHandleInvalid
3610 * @return true on success, false otherwise
3611 */
3613 const Byte* encrypted_part_ptr,
3614 Ulong encrypted_part_len,
3615 Byte* part_ptr,
3616 Ulong* part_len_ptr,
3617 ReturnValue* return_value = ThrowException) const;
3618
3619 /****************************** Key management functions ******************************/
3620
3621 /**
3622 * C_GenerateKey generates a secret key, creating a new key object.
3623 * @param session the session's handle
3624 * @param mechanism_ptr key generation mech.
3625 * @param attribute_template_ptr template for new key
3626 * @param count # of attrs in template
3627 * @param key_ptr gets handle of new key
3628 * @param return_value default value (`ThrowException`): throw exception on error.
3629 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3630 * At least the following PKCS #11 return values may be returned:
3631 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3632 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
3633 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3634 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3635 * \li HostMemory \li MechanismInvalid \li MechanismParamInvalid
3636 * \li OK \li OperationActive \li PinExpired
3637 * \li SessionClosed \li SessionHandleInvalid \li SessionReadOnly
3638 * \li TemplateIncomplete \li TemplateInconsistent \li TokenWriteProtected
3639 * \li UserNotLoggedIn
3640 * @return true on success, false otherwise
3641 */
3642 bool C_GenerateKey(SessionHandle session,
3643 const Mechanism* mechanism_ptr,
3644 Attribute* attribute_template_ptr,
3645 Ulong count,
3646 ObjectHandle* key_ptr,
3647 ReturnValue* return_value = ThrowException) const;
3648
3649 /**
3650 * C_GenerateKeyPair generates a public-key/private-key pair, creating new key objects.
3651 * @param session session handle
3652 * @param mechanism_ptr key-gen mech.
3653 * @param public_key_template_ptr template for pub. key
3654 * @param public_key_attribute_count # pub. attrs.
3655 * @param private_key_template_ptr template for priv. key
3656 * @param private_key_attribute_count # priv. attrs.
3657 * @param public_key_ptr gets pub. key handle
3658 * @param private_key_ptr gets priv. key handle
3659 * @param return_value default value (`ThrowException`): throw exception on error.
3660 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3661 * At least the following PKCS #11 return values may be returned:
3662 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3663 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
3664 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3665 * \li DomainParamsInvalid \li FunctionCanceled \li FunctionFailed
3666 * \li GeneralError \li HostMemory \li MechanismInvalid
3667 * \li MechanismParamInvalid \li OK \li OperationActive
3668 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
3669 * \li SessionReadOnly \li TemplateIncomplete \li TemplateInconsistent
3670 * \li TokenWriteProtected \li UserNotLoggedIn
3671 * @return true on success, false otherwise
3672 */
3673 bool C_GenerateKeyPair(SessionHandle session,
3674 const Mechanism* mechanism_ptr,
3675 Attribute* public_key_template_ptr,
3676 Ulong public_key_attribute_count,
3677 Attribute* private_key_template_ptr,
3678 Ulong private_key_attribute_count,
3679 ObjectHandle* public_key_ptr,
3680 ObjectHandle* private_key_ptr,
3681 ReturnValue* return_value = ThrowException) const;
3682
3683 /**
3684 * C_WrapKey wraps (i.e., encrypts) a key.
3685 * @param session the session's handle
3686 * @param mechanism_ptr the wrapping mechanism
3687 * @param wrapping_key wrapping key
3688 * @param key key to be wrapped
3689 * @param wrapped_key_ptr gets wrapped key
3690 * @param wrapped_key_len_ptr gets wrapped key size
3691 * @param return_value default value (`ThrowException`): throw exception on error.
3692 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3693 * At least the following PKCS #11 return values may be returned:
3694 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3695 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3696 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3697 * \li HostMemory \li KeyHandleInvalid \li KeyNotWrappable
3698 * \li KeySizeRange \li KeyUnextractable \li MechanismInvalid
3699 * \li MechanismParamInvalid \li OK \li OperationActive
3700 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
3701 * \li UserNotLoggedIn \li WrappingKeyHandleInvalid \li WrappingKeySizeRange
3702 * \li WrappingKeyTypeInconsistent
3703 * @return true on success, false otherwise
3704 */
3705 bool C_WrapKey(SessionHandle session,
3706 const Mechanism* mechanism_ptr,
3707 ObjectHandle wrapping_key,
3708 ObjectHandle key,
3709 Byte* wrapped_key_ptr,
3710 Ulong* wrapped_key_len_ptr,
3711 ReturnValue* return_value = ThrowException) const;
3712
3713 /**
3714 * C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new key object.
3715 * @param session session's handle
3716 * @param mechanism_ptr unwrapping mech.
3717 * @param unwrapping_key unwrapping key
3718 * @param wrapped_key_ptr the wrapped key
3719 * @param wrapped_key_len wrapped key len
3720 * @param attribute_template_ptr new key template
3721 * @param attribute_count template length
3722 * @param key_ptr gets new handle
3723 * @param return_value default value (`ThrowException`): throw exception on error.
3724 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3725 * At least the following PKCS #11 return values may be returned:
3726 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3727 * \li AttributeValueInvalid \li BufferTooSmall \li CryptokiNotInitialized
3728 * \li CurveNotSupported \li DeviceError \li DeviceMemory
3729 * \li DeviceRemoved \li DomainParamsInvalid \li FunctionCanceled
3730 * \li FunctionFailed \li GeneralError \li HostMemory
3731 * \li MechanismInvalid \li MechanismParamInvalid \li OK
3732 * \li OperationActive \li PinExpired \li SessionClosed
3733 * \li SessionHandleInvalid \li SessionReadOnly \li TemplateIncomplete
3734 * \li TemplateInconsistent \li TokenWriteProtected \li UnwrappingKeyHandleInvalid
3735 * \li UnwrappingKeySizeRange \li UnwrappingKeyTypeInconsistent \li UserNotLoggedIn
3736 * \li WrappedKeyInvalid \li WrappedKeyLenRange
3737 * @return true on success, false otherwise
3738 */
3739 bool C_UnwrapKey(SessionHandle session,
3740 const Mechanism* mechanism_ptr,
3741 ObjectHandle unwrapping_key,
3742 const Byte* wrapped_key_ptr,
3743 Ulong wrapped_key_len,
3744 Attribute* attribute_template_ptr,
3745 Ulong attribute_count,
3746 ObjectHandle* key_ptr,
3747 ReturnValue* return_value = ThrowException) const;
3748
3749 /**
3750 * C_DeriveKey derives a key from a base key, creating a new key object.
3751 * @param session session's handle
3752 * @param mechanism_ptr key deriv. mech.
3753 * @param base_key base key
3754 * @param attribute_template_ptr new key template
3755 * @param attribute_count template length
3756 * @param key_ptr gets new handle
3757 * @param return_value default value (`ThrowException`): throw exception on error.
3758 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3759 * At least the following PKCS #11 return values may be returned:
3760 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3761 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
3762 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3763 * \li DomainParamsInvalid \li FunctionCanceled \li FunctionFailed
3764 * \li GeneralError \li HostMemory \li KeyHandleInvalid
3765 * \li KeySizeRange \li KeyTypeInconsistent \li MechanismInvalid
3766 * \li MechanismParamInvalid \li OK \li OperationActive
3767 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
3768 * \li SessionReadOnly \li TemplateIncomplete \li TemplateInconsistent
3769 * \li TokenWriteProtected \li UserNotLoggedIn
3770 * @return true on success, false otherwise
3771 */
3772 bool C_DeriveKey(SessionHandle session,
3773 const Mechanism* mechanism_ptr,
3774 ObjectHandle base_key,
3775 Attribute* attribute_template_ptr,
3776 Ulong attribute_count,
3777 ObjectHandle* key_ptr,
3778 ReturnValue* return_value = ThrowException) const;
3779
3780 /**
3781 * C_WrapKeyAuthenticated wraps (i.e. encrypts) a private or secret key.
3782 *
3783 * @param session session's handle
3784 * @param mechanism_ptr wrapping mechanism
3785 * @param wrapping_key wrapping key
3786 * @param key key to be wrapped
3787 * @param associated_data_ptr associated data for an AEAD mechanism
3788 * @param associated_data_len length of the associated data
3789 * @param wrapped_key_ptr gets the wrapped key
3790 * @param wrapped_key_len_ptr gets the length of the wrapped key
3791 * @param return_value default value (`ThrowException`): throw exception on error
3792 * @return true on success, false otherwise
3793 */
3795 const Mechanism* mechanism_ptr,
3796 ObjectHandle wrapping_key,
3797 ObjectHandle key,
3798 const Byte* associated_data_ptr,
3799 Ulong associated_data_len,
3800 Byte* wrapped_key_ptr,
3801 Ulong* wrapped_key_len_ptr,
3802 ReturnValue* return_value = ThrowException) const;
3803
3804 /**
3805 * C_UnwrapKeyAuthenticated unwraps (i.e. decrypts) a wrapped key,
3806 * creating a new private key or secret key object.
3807 *
3808 * @param session session's handle
3809 * @param mechanism_ptr unwrapping mechanism
3810 * @param unwrapping_key unwrapping key
3811 * @param wrapped_key_ptr wrapped key
3812 * @param wrapped_key_len length of the wrapped key
3813 * @param attribute_template_ptr new key template
3814 * @param attribute_count template length
3815 * @param associated_data_ptr associated data for an AEAD mechanism
3816 * @param associated_data_len length of the associated data
3817 * @param key_ptr gets new key handle
3818 * @param return_value default value (`ThrowException`): throw exception on error
3819 * @return true on success, false otherwise
3820 */
3822 const Mechanism* mechanism_ptr,
3823 ObjectHandle unwrapping_key,
3824 const Byte* wrapped_key_ptr,
3825 Ulong wrapped_key_len,
3826 Attribute* attribute_template_ptr,
3827 Ulong attribute_count,
3828 const Byte* associated_data_ptr,
3829 Ulong associated_data_len,
3830 ObjectHandle* key_ptr,
3831 ReturnValue* return_value = ThrowException) const;
3832
3833 /**
3834 * C_EncapulateKey creates a new secret key object from a public key using a
3835 * KEM.
3836 *
3837 * @param session the session's handle
3838 * @param mechanism_ptr the encapsulation mechanism
3839 * @param public_key the encapsulating key
3840 * @param template_ptr new key template
3841 * @param attribute_count template length
3842 * @param ciphertext_ptr the wrapped key
3843 * @param ciphertext_len_ptr the wrapped key size
3844 * @param key_ptr the encapsulated key
3845 * @param return_value default value (`ThrowException`): throw exception on error
3846 * @return true on success, false otherwise
3847 */
3848 bool C_EncapsulateKey(SessionHandle session,
3849 const Mechanism* mechanism_ptr,
3850 ObjectHandle public_key,
3851 Attribute* template_ptr,
3852 Ulong attribute_count,
3853 Byte* ciphertext_ptr,
3854 Ulong* ciphertext_len_ptr,
3855 ObjectHandle* key_ptr,
3856 ReturnValue* return_value = ThrowException);
3857
3858 /**
3859 * C_DecapsulateKey creates a new secret key object based on the private key and
3860 * ciphertext generated by a prior encapsulate operation. This new key
3861 * (called a 'shared key' in most KEM documentation) is identical to the
3862 * key returned by C_EncapsulateKey when it was called with the matching public
3863 * key and returned the same cipher text. This function is a KEM style
3864 * function.
3865 *
3866 * @param session the session's handle
3867 * @param mechanism_ptr the decapsulation mechanism
3868 * @param private_key the decapsulating key
3869 * @param template_ptr new key template
3870 * @param attribute_count template length
3871 * @param ciphertext_ptr the wrapped key
3872 * @param ciphertext_len the wrapped key size
3873 * @param key_ptr the decapsulated key
3874 * @param return_value default value (`ThrowException`): throw exception on error
3875 * @return true on success, false otherwise
3876 */
3877 bool C_DecapsulateKey(SessionHandle session,
3878 const Mechanism* mechanism_ptr,
3879 ObjectHandle private_key,
3880 Attribute* template_ptr,
3881 Ulong attribute_count,
3882 const Byte* ciphertext_ptr,
3883 Ulong ciphertext_len,
3884 ObjectHandle* key_ptr,
3885 ReturnValue* return_value = ThrowException);
3886
3887 /****************************** Random number generation functions ******************************/
3888
3889 /**
3890 * C_SeedRandom mixes additional seed material into the token's random number generator.
3891 * @param session the session's handle
3892 * @param seed_ptr the seed material
3893 * @param seed_len length of seed material
3894 * @param return_value default value (`ThrowException`): throw exception on error.
3895 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3896 * At least the following PKCS #11 return values may be returned:
3897 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3898 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3899 * \li FunctionFailed \li GeneralError \li HostMemory
3900 * \li OK \li OperationActive \li RandomSeedNotSupported
3901 * \li RandomNoRng \li SessionClosed \li SessionHandleInvalid
3902 * \li UserNotLoggedIn
3903 * @return true on success, false otherwise
3904 */
3905 bool C_SeedRandom(SessionHandle session,
3906 const Byte* seed_ptr,
3907 Ulong seed_len,
3908 ReturnValue* return_value = ThrowException) const;
3909
3910 /**
3911 * C_GenerateRandom generates random data.
3912 * @param session the session's handle
3913 * @param random_data_ptr receives the random data
3914 * @param random_len # of bytes to generate
3915 * @param return_value default value (`ThrowException`): throw exception on error.
3916 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3917 * At least the following PKCS #11 return values may be returned:
3918 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3919 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3920 * \li FunctionFailed \li GeneralError \li HostMemory
3921 * \li OK \li OperationActive \li RandomNoRng
3922 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3923 * @return true on success, false otherwise
3924 */
3925 bool C_GenerateRandom(SessionHandle session,
3926 Byte* random_data_ptr,
3927 Ulong random_len,
3928 ReturnValue* return_value = ThrowException) const;
3929
3930 /****************************** Parallel function management functions ******************************/
3931
3932 /**
3933 * C_GetFunctionStatus is a legacy function; it obtains an updated status of a function running in parallel with an application.
3934 * @param session the session's handle
3935 * @param return_value default value (`ThrowException`): throw exception on error.
3936 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3937 * At least the following PKCS #11 return values may be returned:
3938 * \li CryptokiNotInitialized \li FunctionFailed \li FunctionNotParallel
3939 * \li GeneralError \li HostMemory \li SessionHandleInvalid
3940 * \li SessionClosed
3941 * @return true on success, false otherwise
3942 */
3943 bool C_GetFunctionStatus(SessionHandle session, ReturnValue* return_value = ThrowException) const;
3944
3945 /**
3946 * C_CancelFunction is a legacy function; it cancels a function running in parallel.
3947 * @param session the session's handle
3948 * @param return_value default value (`ThrowException`): throw exception on error.
3949 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3950 * At least the following PKCS #11 return values may be returned:
3951 * \li CryptokiNotInitialized \li FunctionFailed \li FunctionNotParallel
3952 * \li GeneralError \li HostMemory \li SessionHandleInvalid
3953 * \li SessionClosed
3954 * @return true on success, false otherwise
3955 */
3956 bool C_CancelFunction(SessionHandle session, ReturnValue* return_value = ThrowException) const;
3957
3958 /******************* Asynchronous function management functions *******************/
3959
3960 /**
3961 * C_AsyncComplete checks if the function identified by function_name_ptr has
3962 * completed an asynchronous operation and, if so, returns the associated
3963 * result(s).
3964 *
3965 * @param session the session's handle
3966 * @param function_name_ptr pkcs11 function name
3967 * @param result_ptr operation result
3968 * @param return_value default value (`ThrowException`): throw exception on error
3969 * @return true on success, false otherwise
3970 */
3971 bool C_AsyncComplete(SessionHandle session,
3972 const Utf8Char* function_name_ptr,
3973 AsyncData* result_ptr,
3974 ReturnValue* return_value = ThrowException);
3975
3976 /**
3977 * C_AsyncGetID is used to persist an operation past a C_Finalize call and allow
3978 * another instance of the client to reconnect after a call to
3979 * C_Initialize. C_AsyncGetID places a module dependent identifier for
3980 * the asynchronous operation being performed by the function identified by
3981 * function_name_ptr.
3982 *
3983 * @param session the session's handle
3984 * @param function_name_ptr pkcs11 function name
3985 * @param id_ptr persistent operation id
3986 * @param return_value default value (`ThrowException`): throw exception on error
3987 * @return true on success, false otherwise
3988 */
3989 bool C_AsyncGetID(SessionHandle session,
3990 const Utf8Char* function_name_ptr,
3991 Ulong* id_ptr,
3992 ReturnValue* return_value = ThrowException);
3993
3994 /**
3995 * C_AsyncJoin checks if the function identified by function_name_ptr and id is a
3996 * valid asynchronous operation and, if so, reconnects the client application to
3997 * the module using the buffer specified by data_ptr and data_len in place of those
3998 * passed into the original call to function_name_ptr.
3999 *
4000 * @param session the session's handle
4001 * @param function_name_ptr pkcs11 function name
4002 * @param id persistent operation id
4003 * @param data_ptr location for the data
4004 * @param data_len data length
4005 * @param return_value default value (`ThrowException`): throw exception on error
4006 * @return true on success, false otherwise
4007 */
4008 bool C_AsyncJoin(SessionHandle session,
4009 const Utf8Char* function_name_ptr,
4010 Ulong id,
4011 Byte* data_ptr,
4012 Ulong data_len,
4013 ReturnValue* return_value = ThrowException);
4014
4015 /**
4016 * Return the PKCS11 function list that this LowLevel class contains.
4017 *
4018 * This is primarily useful when invoking vendor specific extension
4019 * functions which are not supported directly by LowLevel or the higher
4020 * level PKCS11 API.
4021 */
4022 BOTAN_DEPRECATED("Use get_interface().func_2_40()") FunctionList* get_functions() const;
4023
4024 const InterfaceWrapper& get_interface() { return m_interface_wrapper; }
4025
4026 protected:
4027 /**
4028 * it is possible for an application to inherit from LowLevel in order to
4029 * implement wrappers for vendor specific extensions using the same error
4030 * handling mechanisms as the rest of the library.
4031 */
4032 static bool handle_return_value(CK_RV function_result, ReturnValue* return_value);
4033
4034 private:
4035 InterfaceWrapper m_interface_wrapper;
4036};
4037
4039 public:
4040 explicit PKCS11_Error(std::string_view what) : Exception("PKCS11 error", what) {}
4041
4042 ErrorType error_type() const noexcept override { return ErrorType::Pkcs11Error; }
4043};
4044
4046 public:
4047 explicit PKCS11_ReturnError(ReturnValue return_val);
4048
4049 inline ReturnValue get_return_value() const { return m_return_val; }
4050
4051 int error_code() const noexcept override { return static_cast<int>(m_return_val); }
4052
4053 private:
4054 const ReturnValue m_return_val;
4055};
4056
4057} // namespace PKCS11
4058
4059} // namespace Botan
4060
4061#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:1702
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:2215
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:2925
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:1753
bool C_SignUpdate(SessionHandle session, const std::vector< uint8_t, TAlloc > &part, ReturnValue *return_value=ThrowException) const
Definition p11.h:2982
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:1933
LowLevel(FunctionList *ptr)
Definition p11.cpp:81
const InterfaceWrapper & get_interface()
Definition p11.h:4024
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:2356
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:3246
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:2589
bool C_VerifyUpdate(SessionHandle session, std::vector< uint8_t, TAlloc > part, ReturnValue *return_value=ThrowException) const
Definition p11.h:3293
bool C_SignFinal(SessionHandle session, std::vector< uint8_t, TAlloc > &signature, ReturnValue *return_value=ThrowException) const
Definition p11.h:3025
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:2124
ErrorType error_type() const noexcept override
Definition p11.h:4042
PKCS11_Error(std::string_view what)
Definition p11.h:4040
int error_code() const noexcept override
Definition p11.h:4051
ReturnValue get_return_value() const
Definition p11.h:4049
PKCS11_ReturnError(ReturnValue return_val)
const char * name
Definition ffi_tls.h:59
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:22
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:63
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:69
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:75
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:58
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