Botan 3.11.0
Crypto and TLS for C&
p11.h
Go to the documentation of this file.
1/*
2* PKCS #11
3* (C) 2016 Daniel Neus, Sirrix AG
4* (C) 2016 Philipp Weber, Sirrix AG
5* (C) 2025 Fabian Albert, Rohde & Schwarz Cybersecurity GmbH
6*
7* Botan is released under the Simplified BSD License (see license.txt)
8*/
9
10#ifndef BOTAN_P11_H_
11#define BOTAN_P11_H_
12
13#include <botan/exceptn.h>
14#include <botan/secmem.h>
15
16#include <map>
17#include <string>
18#include <vector>
19
20#if defined(_MSC_VER)
21 // PKCS #11 v3.2, section 2.1 - Structure packing
22 // Cryptoki structures are packed to occupy as little space as is possible.
23 // Cryptoki structures SHALL be packed with 1-byte alignment.
24 // (Also recommended in official pkcs11 header comments)
25 #pragma pack(push, cryptoki, 1)
26#endif
27
28#define PKCS11_DEPRECATED // also use deprecated PKCS #11 symbols
29#include <pkcs11.h>
30
31#if defined(_MSC_VER)
32 #pragma pack(pop, cryptoki)
33#endif
34
35static_assert(
37 "The Botan PKCS #11 module was implemented against PKCS #11 v3.2. Please use the correct PKCS #11 headers.");
38
39namespace Botan {
40
41class Dynamically_Loaded_Library;
42
43namespace PKCS11 {
44
46
47// NOLINTBEGIN(*-enum-size)
48
113 EcdsaParams = CKA_ECDSA_PARAMS,
116 SecondaryAuth = CKA_SECONDARY_AUTH,
117 AuthPinFlags = CKA_AUTH_PIN_FLAGS,
210};
211
218
219/// Indicates if a stored certificate is a user certificate for which the corresponding private key is available
220/// on the token ("token user"), a CA certificate ("authority"), or another end-entity certificate ("other entity").
227
238
245
251
258
266
271
300
301enum class Flag : CK_FLAGS {
302 None = 0,
354 EcNamedcurve = CKF_EC_NAMEDCURVE,
375};
376
377inline Flag operator|(Flag a, Flag b) {
378 // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
379 return static_cast<Flag>(static_cast<CK_FLAGS>(a) | static_cast<CK_FLAGS>(b));
380}
381
389
402
409
415
416enum class KeyType : CK_KEY_TYPE {
420 Ecdsa = CKK_ECDSA,
432 Cast5 = CKK_CAST5,
486};
487
643 Cast5KeyGen = CKM_CAST5_KEY_GEN,
645 Cast5Ecb = CKM_CAST5_ECB,
647 Cast5Cbc = CKM_CAST5_CBC,
649 Cast5Mac = CKM_CAST5_MAC,
651 Cast5MacGeneral = CKM_CAST5_MAC_GENERAL,
653 Cast5CbcPad = CKM_CAST5_CBC_PAD,
701 PbeMd5Cast5Cbc = CKM_PBE_MD5_CAST5_CBC,
703 PbeSha1Cast5Cbc = CKM_PBE_SHA1_CAST5_CBC,
782 EcdsaKeyPairGen = CKM_ECDSA_KEY_PAIR_GEN,
851 DsaProbablisticParameterGen = CKM_DSA_PROBABLISTIC_PARAMETER_GEN, // TODO(Botan4) remove this typo
963};
964
969
985
996
1007
1013
1028
1034
1042
1046
1054
1055enum class ReturnValue : CK_RV {
1161};
1162
1168
1174
1182
1183enum class PublicPointEncoding : uint32_t { Raw, Der };
1184
1185// NOLINTEND(*-enum-size)
1186
1220
1221// NOLINTNEXTLINE(*-avoid-non-const-global-variables) TODO can this be made const?
1223
1226
1228 return static_cast<Flags>(flags);
1229}
1230
1231class Slot;
1232
1233/**
1234* Initializes a token
1235* @param slot The slot with the attached token that should be initialized
1236* @param label The token label
1237* @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
1238* @param pin The user PIN that will be set
1239*/
1240BOTAN_PUBLIC_API(2, 0)
1241void initialize_token(Slot& slot, std::string_view label, const secure_string& so_pin, const secure_string& pin);
1242
1243/**
1244* Change PIN with old PIN to new PIN
1245* @param slot The slot with the attached token
1246* @param old_pin The old user PIN
1247* @param new_pin The new user PIN
1248*/
1249
1250BOTAN_PUBLIC_API(2, 0) void change_pin(Slot& slot, const secure_string& old_pin, const secure_string& new_pin);
1251
1252/**
1253* Change SO_PIN with old SO_PIN to new SO_PIN
1254* @param slot The slot with the attached token
1255* @param old_so_pin The old SO_PIN
1256* @param new_so_pin The new SO_PIN
1257*/
1258BOTAN_PUBLIC_API(2, 0) void change_so_pin(Slot& slot, const secure_string& old_so_pin, const secure_string& new_so_pin);
1259
1260/**
1261* Sets user PIN with SO_PIN
1262* @param slot The slot with the attached token
1263* @param so_pin PIN of the security officer
1264* @param pin The user PIN that should be set
1265*/
1266BOTAN_PUBLIC_API(2, 0) void set_pin(Slot& slot, const secure_string& so_pin, const secure_string& pin);
1267
1268/**
1269 * @brief Wraps a PKCS #11 Interface object.
1270 *
1271 * This class provides an interface to access PKCS #11 functions of various versions.
1272 * For example func_3_0() returns the PKCS #11 v3.0 function list for a loaded interface.
1273 * Only the official "PKCS 11" named interfaces are supported.
1274 */
1276 private:
1277 Interface m_interface;
1278
1279 public:
1280 /// Basic constructor using an interface.
1282
1288
1289 /// Access the underlying interface object
1290 const Interface& raw_interface() const { return m_interface; }
1291
1292 /// Access the version of the interface
1293 Version version() const;
1294
1295 /// Access the name of the interface
1296 std::span<const Utf8Char> name() const;
1297
1298 /// Access a function list that contains all methods since PKCS #11 v.2.40
1299 const FunctionList& func_2_40() const;
1300
1301 /// Access a function list that contains all methods since PKCS #11 v.3.0
1302 const FunctionList30& func_3_0() const;
1303
1304 /// Access a function list that contains all methods since PKCS #11 v.3.2
1305 const FunctionList32& func_3_2() const;
1306
1307 /// Find the latest supported "PKCS 11" interface. Fork safe interfaces
1308 /// are preferred over non fork safe ones of the same version.
1309 static InterfaceWrapper latest_p11_interface(Dynamically_Loaded_Library& library);
1310
1311 /**
1312 * Returns an immortal pointer to the Utf8Char string "PKCS 11".
1313 * Used to define an interface object.
1314 *
1315 * @warning Unfortunately, the interface object requires a non constant
1316 * pointer. However, this string MUST NOT be modified!
1317 */
1318 static Utf8Char* p11_interface_name_ptr();
1319};
1320
1321/// Provides access to all PKCS #11 functions
1323 public:
1324 /// @param ptr the function list pointer to use. Can be retrieved via `LowLevel::C_GetFunctionList`
1325 BOTAN_DEPRECATED("Use LowLevel(InterfaceWrapper::latest_p11_interface(module.library()))")
1326 explicit LowLevel(FunctionList* ptr);
1327
1328 explicit LowLevel(InterfaceWrapper interface_wrapper);
1329
1330 /****************************** General purpose functions ******************************/
1331
1332 /**
1333 * C_Initialize initializes the Cryptoki library.
1334 * @param init_args if this is not nullptr, it gets cast to (`C_InitializeArgs`) and dereferenced
1335 * @param return_value default value (`ThrowException`): throw exception on error.
1336 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1337 * At least the following PKCS #11 return values may be returned:
1338 * \li ArgumentsBad \li CantLock \li CryptokiAlreadyInitialized
1339 * \li FunctionFailed \li GeneralError \li HostMemory
1340 * \li NeedToCreateThreads \li OK
1341 * @return true on success, false otherwise
1342 */
1343 bool C_Initialize(const void* init_args, ReturnValue* return_value = ThrowException) const;
1344
1345 /**
1346 * C_Finalize indicates that an application is done with the Cryptoki library.
1347 * @param reserved reserved. Should be nullptr
1348 * @param return_value default value (`ThrowException`): throw exception on error.
1349 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1350 * At least the following PKCS #11 return values may be returned:
1351 * \li ArgumentsBad \li CryptokiNotInitialized \li FunctionFailed
1352 * \li GeneralError \li HostMemory \li OK
1353 * @return true on success, false otherwise
1354 */
1355 bool C_Finalize(void* reserved, ReturnValue* return_value = ThrowException) const;
1356
1357 /**
1358 * C_GetInfo returns general information about Cryptoki.
1359 * @param info_ptr location that receives information
1360 * @param return_value default value (`ThrowException`): throw exception on error.
1361 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1362 * At least the following PKCS #11 return values may be returned:
1363 * \li ArgumentsBad \li CryptokiNotInitialized \li FunctionFailed
1364 * \li GeneralError \li HostMemory \li OK
1365 * @return true on success, false otherwise
1366 */
1367 bool C_GetInfo(Info* info_ptr, ReturnValue* return_value = ThrowException) const;
1368
1369 /**
1370 * C_GetFunctionList returns the function list.
1371 * @param pkcs11_module The PKCS #11 module
1372 * @param function_list_ptr_ptr receives pointer to function list
1373 * @param return_value default value (`ThrowException`): throw exception on error.
1374 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1375 * At least the following PKCS #11 return values may be returned:
1376 * \li ArgumentsBad \li FunctionFailed \li GeneralError
1377 * \li HostMemory \li OK
1378 * @return true on success, false otherwise
1379 */
1380 static bool C_GetFunctionList(const Dynamically_Loaded_Library& pkcs11_module,
1381 FunctionList** function_list_ptr_ptr,
1382 ReturnValue* return_value = ThrowException);
1383
1384 /**
1385 * C_GetInterfaceList is used to obtain a list of interfaces supported by
1386 * a Cryptoki library. count_ptr points to the location that receives the
1387 * number of interfaces. There are two ways for an application to call
1388 * C_GetInterfaceList:
1389 * 1. If interface_list_ptr is nullptr, then all that C_GetInterfaceList
1390 * does is return (in *count_ptr) the number of interfaces, without
1391 * actually returning a list of interfaces. The contents of *count_ptr
1392 * on entry to C_GetInterfaceList have no meaning in this case, and the
1393 * call returns the value CKR_OK.
1394 * 2. If pIntrerfaceList is not nullptr, then *count_ptr MUST contain the
1395 * size (in terms of CK_INTERFACE elements) of the buffer pointed to
1396 * by interface_list_ptr. If that buffer is large enough to hold the
1397 * list of interfaces, then the list is returned in it, and CKR_OK is
1398 * returned. If not, then the call to C_GetInterfaceList returns the
1399 * value CKR_BUFFER_TOO_SMALL. In either case, the value *count_ptr is
1400 * set to hold the number of interfaces.
1401 *
1402 * Because C_GetInterfaceList does not allocate any space of its own, an
1403 * application will often call C_GetInterfaceList twice. However, this
1404 * behavior is by no means required. C_GetInterfaceList obtains
1405 * (in *pFunctionList of each interface) a pointer to the Cryptoki
1406 * library’s list of function pointers. The pointer thus obtained may
1407 * point into memory which is owned by the Cryptoki library, and which
1408 * may or may not be writable. Whether or not this is the case, no attempt
1409 * should be made to write to this memory. The same caveat applies to
1410 * the interface names returned.
1411 *
1412 * @param pkcs11_module The PKCS #11 module
1413 * @param interface_list_ptr returned interfaces
1414 * @param count_ptr number of interfaces returned
1415 * @param return_value default value (`ThrowException`): throw exception on error.
1416 * @return true on success, false otherwise
1417 */
1418 static bool C_GetInterfaceList(const Dynamically_Loaded_Library& pkcs11_module,
1419 Interface* interface_list_ptr,
1420 Ulong* count_ptr,
1421 ReturnValue* return_value = ThrowException);
1422
1423 /**
1424 * C_GetInterface is used to obtain an interface supported by a Cryptoki
1425 * library. pInterfaceName specifies the name of the interface, pVersion
1426 * specifies the interface version, ppInterface points to the location
1427 * that receives the interface, flags specifies the required interface
1428 * flags. There are multiple ways for an application to specify a
1429 * particular interface when calling C_GetInterface:
1430 * 1. If pInterfaceName is not nullptr, the name of the interface
1431 * returned must match. If pInterfaceName is nullptr, the cryptoki
1432 * library can return a default interface of its choice
1433 * 2. If pVersion is not nullptr, the version of the interface returned
1434 * must match. If pVersion is nullptr, the cryptoki library can
1435 * return an interface of any version
1436 * 3. If flags is non-zero, the interface returned must match all of the
1437 * supplied flag values (but may include additional flags not
1438 * specified). If flags is 0, the cryptoki library can return an
1439 * interface with any flags
1440 *
1441 * @param pkcs11_module The PKCS #11 module
1442 * @param interface_name_ptr name of the interface
1443 * @param version_ptr version of the interface
1444 * @param interface_ptr_ptr returned interface
1445 * @param flags flags controlling the semantics of the interface
1446 * @param return_value default value (`ThrowException`): throw exception on error.
1447 * @return true on success, false otherwise
1448 */
1449 static bool C_GetInterface(const Dynamically_Loaded_Library& pkcs11_module,
1450 const Utf8Char* interface_name_ptr,
1451 const Version* version_ptr,
1452 Interface* interface_ptr_ptr,
1453 Flags flags,
1454 ReturnValue* return_value = ThrowException);
1455
1456 /****************************** Slot and token management functions ******************************/
1457
1458 /**
1459 * C_GetSlotList obtains a list of slots in the system.
1460 * @param token_present only slots with tokens
1461 * @param slot_list_ptr receives array of slot IDs
1462 * @param count_ptr receives number of slots
1463 * @param return_value default value (`ThrowException`): throw exception on error.
1464 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1465 * At least the following PKCS #11 return values may be returned:
1466 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
1467 * \li FunctionFailed \li GeneralError \li HostMemory
1468 * \li OK
1469 * @return true on success, false otherwise
1470 */
1471 bool C_GetSlotList(Bbool token_present,
1472 SlotId* slot_list_ptr,
1473 Ulong* count_ptr,
1474 ReturnValue* return_value = ThrowException) const;
1475
1476 /**
1477 * C_GetSlotList obtains a list of slots in the system.
1478 * @param token_present only slots with tokens
1479 * @param slot_ids receives vector of slot IDs
1480 * @param return_value default value (`ThrowException`): throw exception on error.
1481 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1482 * At least the following PKCS #11 return values may be returned:
1483 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
1484 * \li FunctionFailed \li GeneralError \li HostMemory
1485 * \li OK
1486 * @return true on success, false otherwise
1487 */
1488 bool C_GetSlotList(bool token_present,
1489 std::vector<SlotId>& slot_ids,
1490 ReturnValue* return_value = ThrowException) const;
1491
1492 /**
1493 * C_GetSlotInfo obtains information about a particular slot in the system.
1494 * @param slot_id the ID of the slot
1495 * @param info_ptr receives the slot information
1496 * @param return_value default value (`ThrowException`): throw exception on error.
1497 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1498 * At least the following PKCS #11 return values may be returned:
1499 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
1500 * \li FunctionFailed \li GeneralError \li HostMemory
1501 * \li OK \li SlotIdInvalid
1502 * @return true on success, false otherwise
1503 */
1504 bool C_GetSlotInfo(SlotId slot_id, SlotInfo* info_ptr, ReturnValue* return_value = ThrowException) const;
1505
1506 /**
1507 * C_GetTokenInfo obtains information about a particular token in the system.
1508 * @param slot_id ID of the token's slot
1509 * @param info_ptr receives the token information
1510 * @param return_value default value (`ThrowException`): throw exception on error.
1511 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1512 * At least the following PKCS #11 return values may be returned:
1513 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1514 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1515 * \li HostMemory \li OK \li SlotIdInvalid
1516 * \li TokenNotPresent \li TokenNotRecognized \li ArgumentsBad
1517 * @return true on success, false otherwise
1518 */
1519 bool C_GetTokenInfo(SlotId slot_id, TokenInfo* info_ptr, ReturnValue* return_value = ThrowException) const;
1520
1521 /**
1522 * C_WaitForSlotEvent waits for a slot event (token insertion, removal, etc.) to occur.
1523 * @param flags blocking/nonblocking flag
1524 * @param slot_ptr location that receives the slot ID
1525 * @param reserved reserved. Should be nullptr
1526 * @param return_value default value (`ThrowException`): throw exception on error.
1527 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1528 * At least the following PKCS #11 return values may be returned:
1529 * \li ArgumentsBad \li CryptokiNotInitialized \li FunctionFailed
1530 * \li GeneralError \li HostMemory \li NoEvent
1531 * \li OK
1532 * @return true on success, false otherwise
1533 */
1535 SlotId* slot_ptr,
1536 void* reserved,
1537 ReturnValue* return_value = ThrowException) const;
1538
1539 /**
1540 * C_GetMechanismList obtains a list of mechanism types supported by a token.
1541 * @param slot_id ID of token's slot
1542 * @param mechanism_list_ptr gets mech. array
1543 * @param count_ptr gets # of mechs.
1544 * @param return_value default value (`ThrowException`): throw exception on error.
1545 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1546 * At least the following PKCS #11 return values may be returned:
1547 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
1548 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
1549 * \li GeneralError \li HostMemory \li OK
1550 * \li SlotIdInvalid \li TokenNotPresent \li TokenNotRecognized
1551 * \li ArgumentsBad
1552 * @return true on success, false otherwise
1553 */
1554 bool C_GetMechanismList(SlotId slot_id,
1555 MechanismType* mechanism_list_ptr,
1556 Ulong* count_ptr,
1557 ReturnValue* return_value = ThrowException) const;
1558
1559 /**
1560 * C_GetMechanismList obtains a list of mechanism types supported by a token.
1561 * @param slot_id ID of token's slot
1562 * @param mechanisms receives vector of supported mechanisms
1563 * @param return_value default value (`ThrowException`): throw exception on error.
1564 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1565 * At least the following PKCS #11 return values may be returned:
1566 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
1567 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
1568 * \li GeneralError \li HostMemory \li OK
1569 * \li SlotIdInvalid \li TokenNotPresent \li TokenNotRecognized
1570 * \li ArgumentsBad
1571 * @return true on success, false otherwise
1572 */
1573 bool C_GetMechanismList(SlotId slot_id,
1574 std::vector<MechanismType>& mechanisms,
1575 ReturnValue* return_value = ThrowException) const;
1576
1577 /**
1578 * C_GetMechanismInfo obtains information about a particular mechanism possibly supported by a token.
1579 * @param slot_id ID of the token's slot
1580 * @param type type of mechanism
1581 * @param info_ptr receives mechanism info
1582 * @param return_value default value (`ThrowException`): throw exception on error.
1583 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1584 * At least the following PKCS #11 return values may be returned:
1585 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1586 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1587 * \li HostMemory \li MechanismInvalid \li OK
1588 * \li SlotIdInvalid \li TokenNotPresent \li TokenNotRecognized
1589 * \li ArgumentsBad
1590 * @return true on success, false otherwise
1591 */
1592 bool C_GetMechanismInfo(SlotId slot_id,
1593 MechanismType type,
1594 MechanismInfo* info_ptr,
1595 ReturnValue* return_value = ThrowException) const;
1596
1597 /**
1598 * C_InitToken initializes a token.
1599 * @param slot_id ID of the token's slot
1600 * @param so_pin_ptr the SO's initial PIN
1601 * @param so_pin_len length in bytes of the SO_PIN
1602 * @param label_ptr 32-byte token label (blank padded)
1603 * @param return_value default value (`ThrowException`): throw exception on error.
1604 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1605 * At least the following PKCS #11 return values may be returned:
1606 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1607 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1608 * \li GeneralError \li HostMemory \li OK
1609 * \li PinIncorrect \li PinLocked \li SessionExists
1610 * \li SlotIdInvalid \li TokenNotPresent \li TokenNotRecognized
1611 * \li TokenWriteProtected \li ArgumentsBad
1612 * @return true on success, false otherwise
1613 */
1614 bool C_InitToken(SlotId slot_id,
1615 const Utf8Char* so_pin_ptr,
1616 Ulong so_pin_len,
1617 const Utf8Char* label_ptr,
1618 ReturnValue* return_value = ThrowException) const;
1619
1620 /**
1621 * C_InitToken initializes a token.
1622 * @param slot_id ID of the token's slot
1623 * @param so_pin the SO's initial PIN
1624 * @param label token label (at max 32 bytes long)
1625 * @param return_value default value (`ThrowException`): throw exception on error.
1626 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1627 * At least the following PKCS #11 return values may be returned:
1628 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1629 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1630 * \li GeneralError \li HostMemory \li OK
1631 * \li PinIncorrect \li PinLocked \li SessionExists
1632 * \li SlotIdInvalid \li TokenNotPresent \li TokenNotRecognized
1633 * \li TokenWriteProtected \li ArgumentsBad
1634 * @return true on success, false otherwise
1635 */
1636 template <typename TAlloc>
1637 bool C_InitToken(SlotId slot_id,
1638 const std::vector<uint8_t, TAlloc>& so_pin,
1639 std::string_view label,
1640 ReturnValue* return_value = ThrowException) const {
1641 std::string padded_label(label);
1642 if(label.size() < 32) {
1643 padded_label.insert(padded_label.end(), 32 - label.size(), ' ');
1644 }
1645
1646 return C_InitToken(slot_id,
1647 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(so_pin.data())),
1648 static_cast<Ulong>(so_pin.size()),
1649 reinterpret_cast<Utf8Char*>(const_cast<char*>(padded_label.c_str())),
1650 return_value);
1651 }
1652
1653 /**
1654 * C_InitPIN initializes the normal user's PIN.
1655 * @param session the session's handle
1656 * @param pin_ptr the normal user's PIN
1657 * @param pin_len length in bytes of the PIN
1658 * @param return_value default value (`ThrowException`): throw exception on error.
1659 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1660 * At least the following PKCS #11 return values may be returned:
1661 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1662 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1663 * \li GeneralError \li HostMemory \li OK
1664 * \li PinInvalid \li PinLenRange \li SessionClosed
1665 * \li SessionReadOnly \li SessionHandleInvalid \li TokenWriteProtected
1666 * \li UserNotLoggedIn \li ArgumentsBad
1667 * @return true on success, false otherwise
1668 */
1669 bool C_InitPIN(SessionHandle session,
1670 const Utf8Char* pin_ptr,
1671 Ulong pin_len,
1672 ReturnValue* return_value = ThrowException) const;
1673
1674 /**
1675 * C_InitPIN initializes the normal user's PIN.
1676 * @param session the session's handle
1677 * @param pin the normal user's PIN
1678 * @param return_value default value (`ThrowException`): throw exception on error.
1679 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1680 * At least the following PKCS #11 return values may be returned:
1681 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1682 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1683 * \li GeneralError \li HostMemory \li OK
1684 * \li PinInvalid \li PinLenRange \li SessionClosed
1685 * \li SessionReadOnly \li SessionHandleInvalid \li TokenWriteProtected
1686 * \li UserNotLoggedIn \li ArgumentsBad
1687 * @return true on success, false otherwise
1688 */
1689 template <typename TAlloc>
1691 const std::vector<uint8_t, TAlloc>& pin,
1692 ReturnValue* return_value = ThrowException) const {
1693 return C_InitPIN(session,
1694 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(pin.data())),
1695 static_cast<Ulong>(pin.size()),
1696 return_value);
1697 }
1698
1699 /**
1700 * C_SetPIN modifies the PIN of the user who is logged in.
1701 * @param session the session's handle
1702 * @param old_pin_ptr the old PIN
1703 * @param old_len length of the old PIN
1704 * @param new_pin_ptr the new PIN
1705 * @param new_len length of the new PIN
1706 * @param return_value default value (`ThrowException`): throw exception on error.
1707 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1708 * At least the following PKCS #11 return values may be returned:
1709 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1710 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1711 * \li GeneralError \li HostMemory \li OK
1712 * \li PinIncorrect \li PinInvalid \li PinLenRange
1713 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1714 * \li SessionReadOnly \li TokenWriteProtected \li ArgumentsBad
1715 * @return true on success, false otherwise
1716 */
1717 bool C_SetPIN(SessionHandle session,
1718 const Utf8Char* old_pin_ptr,
1719 Ulong old_len,
1720 const Utf8Char* new_pin_ptr,
1721 Ulong new_len,
1722 ReturnValue* return_value = ThrowException) const;
1723
1724 /**
1725 * C_SetPIN modifies the PIN of the user who is logged in.
1726 * @param session the session's handle
1727 * @param old_pin the old PIN
1728 * @param new_pin the new PIN
1729 * @param return_value default value (`ThrowException`): throw exception on error.
1730 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1731 * At least the following PKCS #11 return values may be returned:
1732 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1733 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
1734 * \li GeneralError \li HostMemory \li OK
1735 * \li PinIncorrect \li PinInvalid \li PinLenRange
1736 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1737 * \li SessionReadOnly \li TokenWriteProtected \li ArgumentsBad
1738 * @return true on success, false otherwise
1739 */
1740 template <typename TAlloc>
1742 const std::vector<uint8_t, TAlloc>& old_pin,
1743 const std::vector<uint8_t, TAlloc>& new_pin,
1744 ReturnValue* return_value = ThrowException) const {
1745 return C_SetPIN(session,
1746 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(old_pin.data())),
1747 static_cast<Ulong>(old_pin.size()),
1748 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(new_pin.data())),
1749 static_cast<Ulong>(new_pin.size()),
1750 return_value);
1751 }
1752
1753 /****************************** Session management ******************************/
1754
1755 /**
1756 * C_OpenSession opens a session between an application and a token.
1757 * @param slot_id the slot's ID
1758 * @param flags from CK_SESSION_INFO
1759 * @param application passed to callback
1760 * @param notify callback function
1761 * @param session_ptr gets session handle
1762 * @param return_value default value (`ThrowException`): throw exception on error.
1763 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1764 * At least the following PKCS #11 return values may be returned:
1765 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1766 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1767 * \li HostMemory \li OK \li SessionCount
1768 * \li SessionParallelNotSupported \li SessionReadWriteSoExists \li SlotIdInvalid
1769 * \li TokenNotPresent \li TokenNotRecognized \li TokenWriteProtected
1770 * \li ArgumentsBad
1771 * @return true on success, false otherwise
1772 */
1773 bool C_OpenSession(SlotId slot_id,
1774 Flags flags,
1775 void* application,
1776 Notify notify,
1777 SessionHandle* session_ptr,
1778 ReturnValue* return_value = ThrowException) const;
1779
1780 /**
1781 * C_CloseSession closes a session between an application and a token.
1782 * @param session the session's handle
1783 * @param return_value default value (`ThrowException`): throw exception on error.
1784 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1785 * At least the following PKCS #11 return values may be returned:
1786 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1787 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1788 * \li HostMemory \li OK \li SessionClosed
1789 * \li SessionHandleInvalid
1790 * @return true on success, false otherwise
1791 */
1792 bool C_CloseSession(SessionHandle session, ReturnValue* return_value = ThrowException) const;
1793
1794 /**
1795 * C_CloseAllSessions closes all sessions with a token.
1796 * @param slot_id the token's slot
1797 * @param return_value default value (`ThrowException`): throw exception on error.
1798 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1799 * At least the following PKCS #11 return values may be returned:
1800 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1801 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1802 * \li HostMemory \li OK \li SlotIdInvalid
1803 * \li TokenNotPresent
1804 * @return true on success, false otherwise
1805 */
1806 bool C_CloseAllSessions(SlotId slot_id, ReturnValue* return_value = ThrowException) const;
1807
1808 /**
1809 * C_GetSessionInfo obtains information about the session.
1810 * @param session the session's handle
1811 * @param info_ptr receives session info
1812 * @param return_value default value (`ThrowException`): throw exception on error.
1813 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1814 * At least the following PKCS #11 return values may be returned:
1815 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1816 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1817 * \li HostMemory \li OK \li SessionClosed
1818 * \li SessionHandleInvalid \li ArgumentsBad
1819 * @return true on success, false otherwise
1820 */
1821 bool C_GetSessionInfo(SessionHandle session,
1822 SessionInfo* info_ptr,
1823 ReturnValue* return_value = ThrowException) const;
1824
1825 /**
1826 * C_SessionCancel terminates active session based operations.
1827 *
1828 * @param session the session's handle
1829 * @param flags flags control which sessions are cancelled
1830 * @param return_value default value (`ThrowException`): throw exception on error
1831 * @return true on success, false otherwise
1832 */
1833 bool C_SessionCancel(SessionHandle session, Flags flags, ReturnValue* return_value = ThrowException);
1834
1835 /**
1836 * C_GetOperationState obtains the state of the cryptographic operation in a session.
1837 * @param session session's handle
1838 * @param operation_state_ptr gets state
1839 * @param operation_state_len_ptr gets state length
1840 * @param return_value default value (`ThrowException`): throw exception on error.
1841 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1842 * At least the following PKCS #11 return values may be returned:
1843 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
1844 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
1845 * \li GeneralError \li HostMemory \li OK
1846 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
1847 * \li StateUnsaveable \li ArgumentsBad
1848 * @return true on success, false otherwise
1849 */
1851 Byte* operation_state_ptr,
1852 Ulong* operation_state_len_ptr,
1853 ReturnValue* return_value = ThrowException) const;
1854
1855 /**
1856 * C_SetOperationState restores the state of the cryptographic operation in a session.
1857 * @param session session's handle
1858 * @param operation_state_ptr holds state
1859 * @param operation_state_len holds state length
1860 * @param encryption_key en/decryption key
1861 * @param authentication_key sign/verify key
1862 * @param return_value default value (`ThrowException`): throw exception on error.
1863 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1864 * At least the following PKCS #11 return values may be returned:
1865 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1866 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1867 * \li HostMemory \li KeyChanged \li KeyNeeded
1868 * \li KeyNotNeeded \li OK \li SavedStateInvalid
1869 * \li SessionClosed \li SessionHandleInvalid \li ArgumentsBad
1870 * @return true on success, false otherwise
1871 */
1873 const Byte* operation_state_ptr,
1874 Ulong operation_state_len,
1875 ObjectHandle encryption_key,
1876 ObjectHandle authentication_key,
1877 ReturnValue* return_value = ThrowException) const;
1878
1879 /**
1880 * C_Login logs a user into a token.
1881 * @param session the session's handle
1882 * @param user_type the user type
1883 * @param pin_ptr the user's PIN
1884 * @param pin_len the length of the PIN
1885 * @param return_value default value (`ThrowException`): throw exception on error.
1886 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1887 * At least the following PKCS #11 return values may be returned:
1888 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
1889 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
1890 * \li FunctionFailed \li GeneralError \li HostMemory
1891 * \li OK \li OperationNotInitialized \li PinIncorrect
1892 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1893 * \li SessionReadOnlyExists \li UserAlreadyLoggedIn \li UserAnotherAlreadyLoggedIn
1894 * \li UserPinNotInitialized \li UserTooManyTypes \li UserTypeInvalid
1895 * @return true on success, false otherwise
1896 */
1897 bool C_Login(SessionHandle session,
1898 UserType user_type,
1899 const Utf8Char* pin_ptr,
1900 Ulong pin_len,
1901 ReturnValue* return_value = ThrowException) const;
1902
1903 /**
1904 * C_Login logs a user into a token.
1905 * @param session the session's handle
1906 * @param user_type the user type
1907 * @param pin the user or security officer's PIN
1908 * @param return_value default value (`ThrowException`): throw exception on error.
1909 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1910 * At least the following PKCS #11 return values may be returned:
1911 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
1912 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
1913 * \li FunctionFailed \li GeneralError \li HostMemory
1914 * \li OK \li OperationNotInitialized \li PinIncorrect
1915 * \li PinLocked \li SessionClosed \li SessionHandleInvalid
1916 * \li SessionReadOnlyExists \li UserAlreadyLoggedIn \li UserAnotherAlreadyLoggedIn
1917 * \li UserPinNotInitialized \li UserTooManyTypes \li UserTypeInvalid
1918 * @return true on success, false otherwise
1919 */
1920 template <typename TAlloc>
1922 UserType user_type,
1923 const std::vector<uint8_t, TAlloc>& pin,
1924 ReturnValue* return_value = ThrowException) const {
1925 return C_Login(session,
1926 user_type,
1927 reinterpret_cast<Utf8Char*>(const_cast<uint8_t*>(pin.data())),
1928 static_cast<Ulong>(pin.size()),
1929 return_value);
1930 }
1931
1932 /**
1933 * C_LoginUser logs a user into a token.
1934 *
1935 * @param session the session's handle
1936 * @param user_type the user type
1937 * @param pin_ptr the user's PIN
1938 * @param pin_len the length of the PIN
1939 * @param username_ptr the user's name
1940 * @param username_len the length of the user's name
1941 * @param return_value default value (`ThrowException`): throw exception on error
1942 * @return true on success, false otherwise
1943 */
1944 bool C_LoginUser(SessionHandle session,
1945 UserType user_type,
1946 const Utf8Char* pin_ptr,
1947 Ulong pin_len,
1948 const Utf8Char* username_ptr,
1949 Ulong username_len,
1950 ReturnValue* return_value = ThrowException);
1951
1952 /**
1953 * C_Logout logs a user out from a token.
1954 * @param session the session's handle
1955 * @param return_value default value (`ThrowException`): throw exception on error.
1956 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1957 * At least the following PKCS #11 return values may be returned:
1958 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
1959 * \li DeviceRemoved \li FunctionFailed \li GeneralError
1960 * \li HostMemory \li OK \li SessionClosed
1961 * \li SessionHandleInvalid \li UserNotLoggedIn
1962 * @return true on success, false otherwise
1963 */
1964 bool C_Logout(SessionHandle session, ReturnValue* return_value = ThrowException) const;
1965
1966 /**
1967 * C_GetSessionValidationFlags fetches the requested flags from the session. See
1968 * Validation indicators (section4.15.3.1) for meaning and semantics for these
1969 * flags. Applications are responsible for the appropriate locking to protect
1970 * session to get a meaningful result from this call.
1971 *
1972 * @param session the session's handle
1973 * @param type which state of flags
1974 * @param flags_ptr validation flags
1975 * @param return_value default value (`ThrowException`): throw exception on error
1976 * @return true on success, false otherwise
1977 */
1979 Ulong type,
1980 Flags* flags_ptr,
1981 ReturnValue* return_value = ThrowException);
1982
1983 /****************************** Object management functions ******************************/
1984
1985 /**
1986 * C_CreateObject creates a new object.
1987 * @param session the session's handle
1988 * @param attribute_template_ptr the object's template
1989 * @param count attributes in template
1990 * @param object_ptr gets new object's handle.
1991 * @param return_value default value (`ThrowException`): throw exception on error.
1992 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
1993 * At least the following PKCS #11 return values may be returned:
1994 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
1995 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
1996 * \li DeviceError \li DeviceMemory \li DeviceRemoved
1997 * \li DomainParamsInvalid \li FunctionFailed \li GeneralError
1998 * \li HostMemory \li OK \li PinExpired
1999 * \li SessionClosed \li SessionHandleInvalid \li SessionReadOnly
2000 * \li TemplateIncomplete \li TemplateInconsistent \li TokenWriteProtected
2001 * \li UserNotLoggedIn
2002 * @return true on success, false otherwise
2003 */
2004 bool C_CreateObject(SessionHandle session,
2005 Attribute* attribute_template_ptr,
2006 Ulong count,
2007 ObjectHandle* object_ptr,
2008 ReturnValue* return_value = ThrowException) const;
2009
2010 /**
2011 * C_CopyObject copies an object, creating a new object for the copy.
2012 * @param session the session's handle
2013 * @param object the object's handle
2014 * @param attribute_template_ptr template for new object
2015 * @param count attributes in template
2016 * @param new_object_ptr receives handle of copy
2017 * @param return_value default value (`ThrowException`): throw exception on error.
2018 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2019 * At least the following PKCS #11 return values may be returned:
2020 * \li ActionProhibited \li ArgumentsBad \li AttributeReadOnly
2021 * \li AttributeTypeInvalid \li AttributeValueInvalid \li CryptokiNotInitialized
2022 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2023 * \li FunctionFailed \li GeneralError \li HostMemory
2024 * \li ObjectHandleInvalid \li OK \li PinExpired
2025 * \li SessionClosed \li SessionHandleInvalid \li SessionReadOnly
2026 * \li TemplateInconsistent \li TokenWriteProtected \li UserNotLoggedIn
2027 * @return true on success, false otherwise
2028 */
2029 bool C_CopyObject(SessionHandle session,
2030 ObjectHandle object,
2031 Attribute* attribute_template_ptr,
2032 Ulong count,
2033 ObjectHandle* new_object_ptr,
2034 ReturnValue* return_value = ThrowException) const;
2035
2036 /**
2037 * C_DestroyObject destroys an object.
2038 * @param session the session's handle
2039 * @param object the object's handle
2040 * @param return_value default value (`ThrowException`): throw exception on error.
2041 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2042 * At least the following PKCS #11 return values may be returned:
2043 * \li ActionProhibited \li CryptokiNotInitialized \li DeviceError
2044 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2045 * \li GeneralError \li HostMemory \li ObjectHandleInvalid
2046 * \li OK \li PinExpired \li SessionClosed
2047 * \li SessionHandleInvalid \li SessionReadOnly \li TokenWriteProtected
2048 * @return true on success, false otherwise
2049 */
2050 bool C_DestroyObject(SessionHandle session,
2051 ObjectHandle object,
2052 ReturnValue* return_value = ThrowException) const;
2053
2054 /**
2055 * C_GetObjectSize gets the size of an object in bytes.
2056 * @param session the session's handle
2057 * @param object the object's handle
2058 * @param size_ptr receives size of object
2059 * @param return_value default value (`ThrowException`): throw exception on error.
2060 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2061 * At least the following PKCS #11 return values may be returned:
2062 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2063 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2064 * \li GeneralError \li HostMemory \li InformationSensitive
2065 * \li ObjectHandleInvalid \li OK \li SessionClosed
2066 * \li SessionHandleInvalid
2067 * @return true on success, false otherwise
2068 */
2069 bool C_GetObjectSize(SessionHandle session,
2070 ObjectHandle object,
2071 Ulong* size_ptr,
2072 ReturnValue* return_value = ThrowException) const;
2073
2074 /**
2075 * C_GetAttributeValue obtains the value of one or more object attributes.
2076 * @param session the session's handle
2077 * @param object the object's handle
2078 * @param attribute_template_ptr specifies attrs; gets vals
2079 * @param count attributes in template
2080 * @param return_value default value (`ThrowException`): throw exception on error.
2081 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2082 * At least the following PKCS #11 return values may be returned:
2083 * \li ArgumentsBad \li AttributeSensitive \li AttributeTypeInvalid
2084 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
2085 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2086 * \li GeneralError \li HostMemory \li ObjectHandleInvalid
2087 * \li OK \li SessionClosed \li SessionHandleInvalid
2088 * @return true on success, false otherwise
2089 */
2091 ObjectHandle object,
2092 Attribute* attribute_template_ptr,
2093 Ulong count,
2094 ReturnValue* return_value = ThrowException) const;
2095
2096 /**
2097 * C_GetAttributeValue obtains the value of one or more object attributes.
2098 * @param session the session's handle
2099 * @param object the object's handle
2100 * @param attribute_values specifies attrs; gets vals
2101 * @param return_value default value (`ThrowException`): throw exception on error.
2102 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2103 * At least the following PKCS #11 return values may be returned:
2104 * \li ArgumentsBad \li AttributeSensitive \li AttributeTypeInvalid
2105 * \li BufferTooSmall \li CryptokiNotInitialized \li DeviceError
2106 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2107 * \li GeneralError \li HostMemory \li ObjectHandleInvalid
2108 * \li OK \li SessionClosed \li SessionHandleInvalid
2109 * @return true on success, false otherwise
2110 */
2111 template <typename TAlloc>
2113 ObjectHandle object,
2114 std::map<AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
2115 ReturnValue* return_value = ThrowException) const {
2116 std::vector<Attribute> getter_template;
2117
2118 getter_template.reserve(attribute_values.size());
2119 for(const auto& entry : attribute_values) {
2120 getter_template.emplace_back(Attribute{static_cast<CK_ATTRIBUTE_TYPE>(entry.first), nullptr, 0});
2121 }
2122
2123 const bool success = C_GetAttributeValue(session,
2124 object,
2125 const_cast<Attribute*>(getter_template.data()),
2126 static_cast<Ulong>(getter_template.size()),
2127 return_value);
2128
2129 if(!success) {
2130 return success;
2131 }
2132
2133 size_t i = 0;
2134 for(auto& entry : attribute_values) {
2135 entry.second.clear();
2136 entry.second.resize(getter_template.at(i).ulValueLen);
2137 getter_template.at(i).pValue = const_cast<uint8_t*>(entry.second.data());
2138 i++;
2139 }
2140
2141 return C_GetAttributeValue(session,
2142 object,
2143 const_cast<Attribute*>(getter_template.data()),
2144 static_cast<Ulong>(getter_template.size()),
2145 return_value);
2146 }
2147
2148 /**
2149 * C_SetAttributeValue modifies the value of one or more object attributes.
2150 * @param session the session's handle
2151 * @param object the object's handle
2152 * @param attribute_template_ptr specifies attrs and values
2153 * @param count attributes in template
2154 * @param return_value default value (`ThrowException`): throw exception on error.
2155 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2156 * At least the following PKCS #11 return values may be returned:
2157 * \li ActionProhibited \li ArgumentsBad \li AttributeReadOnly
2158 * \li AttributeTypeInvalid \li AttributeValueInvalid \li CryptokiNotInitialized
2159 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2160 * \li FunctionFailed \li GeneralError \li HostMemory
2161 * \li ObjectHandleInvalid \li OK \li SessionClosed
2162 * \li SessionHandleInvalid \li SessionReadOnly \li TemplateInconsistent
2163 * \li TokenWriteProtected \li UserNotLoggedIn
2164 * @return true on success, false otherwise
2165 */
2167 ObjectHandle object,
2168 Attribute* attribute_template_ptr,
2169 Ulong count,
2170 ReturnValue* return_value = ThrowException) const;
2171
2172 /**
2173 * C_SetAttributeValue modifies the value of one or more object attributes.
2174 * @param session the session's handle
2175 * @param object the object's handle
2176 * @param attribute_values specifies attrs and values
2177 * @param return_value default value (`ThrowException`): throw exception on error.
2178 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2179 * At least the following PKCS #11 return values may be returned:
2180 * \li ActionProhibited \li ArgumentsBad \li AttributeReadOnly
2181 * \li AttributeTypeInvalid \li AttributeValueInvalid \li CryptokiNotInitialized
2182 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2183 * \li FunctionFailed \li GeneralError \li HostMemory
2184 * \li ObjectHandleInvalid \li OK \li SessionClosed
2185 * \li SessionHandleInvalid \li SessionReadOnly \li TemplateInconsistent
2186 * \li TokenWriteProtected \li UserNotLoggedIn
2187 * @return true on success, false otherwise
2188 */
2189 template <typename TAlloc>
2191 ObjectHandle object,
2192 std::map<AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
2193 ReturnValue* return_value = ThrowException) const {
2194 std::vector<Attribute> setter_template;
2195
2196 setter_template.reserve(attribute_values.size());
2197 for(auto& entry : attribute_values) {
2198 setter_template.emplace_back(Attribute{static_cast<CK_ATTRIBUTE_TYPE>(entry.first),
2199 entry.second.data(),
2200 static_cast<CK_ULONG>(entry.second.size())});
2201 }
2202
2203 return C_SetAttributeValue(session,
2204 object,
2205 const_cast<Attribute*>(setter_template.data()),
2206 static_cast<Ulong>(setter_template.size()),
2207 return_value);
2208 }
2209
2210 /**
2211 * C_FindObjectsInit initializes a search for token and session objects that match a template.
2212 * @param session the session's handle
2213 * @param attribute_template_ptr attribute values to match
2214 * @param count attrs in search template
2215 * @param return_value default value (`ThrowException`): throw exception on error.
2216 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2217 * At least the following PKCS #11 return values may be returned:
2218 * \li ArgumentsBad \li AttributeTypeInvalid \li AttributeValueInvalid
2219 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
2220 * \li DeviceRemoved \li FunctionFailed \li GeneralError
2221 * \li HostMemory \li OK \li OperationActive
2222 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
2223 * @return true on success, false otherwise
2224 */
2225 bool C_FindObjectsInit(SessionHandle session,
2226 Attribute* attribute_template_ptr,
2227 Ulong count,
2228 ReturnValue* return_value = ThrowException) const;
2229
2230 /**
2231 * C_FindObjects continues a search for token and session objects that match a template, obtaining additional object handles.
2232 * @param session session's handle
2233 * @param object_ptr gets obj. handles
2234 * @param max_object_count max handles to get
2235 * @param object_count_ptr actual # returned
2236 * @param return_value default value (`ThrowException`): throw exception on error.
2237 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2238 * At least the following PKCS #11 return values may be returned:
2239 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2240 * \li DeviceMemory \li DeviceRemoved \li FunctionFailed
2241 * \li GeneralError \li HostMemory \li OK
2242 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2243 * @return true on success, false otherwise
2244 */
2245 bool C_FindObjects(SessionHandle session,
2246 ObjectHandle* object_ptr,
2247 Ulong max_object_count,
2248 Ulong* object_count_ptr,
2249 ReturnValue* return_value = ThrowException) const;
2250
2251 /**
2252 * C_FindObjectsFinal finishes a search for token and session objects.
2253 * @param session the session's handle
2254 * @param return_value default value (`ThrowException`): throw exception on error.
2255 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2256 * At least the following PKCS #11 return values may be returned:
2257 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
2258 * \li DeviceRemoved \li FunctionFailed \li GeneralError
2259 * \li HostMemory \li OK \li OperationNotInitialized
2260 * \li SessionClosed \li SessionHandleInvalid
2261 * @return true on success, false otherwise
2262 */
2263 bool C_FindObjectsFinal(SessionHandle session, ReturnValue* return_value = ThrowException) const;
2264
2265 /****************************** Encryption functions ******************************/
2266
2267 /**
2268 * C_EncryptInit initializes an encryption operation.
2269 * @param session the session's handle
2270 * @param mechanism_ptr the encryption mechanism
2271 * @param key handle of encryption key
2272 * @param return_value default value (`ThrowException`): throw exception on error.
2273 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2274 * At least the following PKCS #11 return values may be returned:
2275 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
2276 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2277 * \li GeneralError \li HostMemory \li KeyFunctionNotPermitted
2278 * \li KeyHandleInvalid \li KeySizeRange \li KeyTypeInconsistent
2279 * \li MechanismInvalid \li MechanismParamInvalid \li OK
2280 * \li OperationActive \li PinExpired \li SessionClosed
2281 * \li SessionHandleInvalid \li UserNotLoggedIn
2282 * @return true on success, false otherwise
2283 */
2284 bool C_EncryptInit(SessionHandle session,
2285 const Mechanism* mechanism_ptr,
2286 ObjectHandle key,
2287 ReturnValue* return_value = ThrowException) const;
2288
2289 /**
2290 * C_Encrypt encrypts single-part data.
2291 * @param session session's handle
2292 * @param data_ptr the plaintext data
2293 * @param data_len size of plaintext data in bytes
2294 * @param encrypted_data gets ciphertext
2295 * @param encrypted_data_len_ptr gets c-text size
2296 * @param return_value default value (`ThrowException`): throw exception on error.
2297 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2298 * At least the following PKCS #11 return values may be returned:
2299 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2300 * \li DataInvalid \li DataLenRange \li DeviceError
2301 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2302 * \li FunctionFailed \li GeneralError \li HostMemory
2303 * \li OK \li OperationNotInitialized \li SessionClosed
2304 * \li SessionHandleInvalid
2305 * @return true on success, false otherwise
2306 */
2307 bool C_Encrypt(SessionHandle session,
2308 const Byte* data_ptr,
2309 Ulong data_len,
2310 Byte* encrypted_data,
2311 Ulong* encrypted_data_len_ptr,
2312 ReturnValue* return_value = ThrowException) const;
2313
2314 /**
2315 * C_Encrypt encrypts single-part data.
2316 * @param session session's handle
2317 * @param plaintext_data the plaintext data
2318 * @param encrypted_data gets ciphertext
2319 * @param return_value default value (`ThrowException`): throw exception on error.
2320 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2321 * At least the following PKCS #11 return values may be returned:
2322 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2323 * \li DataInvalid \li DataLenRange \li DeviceError
2324 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2325 * \li FunctionFailed \li GeneralError \li HostMemory
2326 * \li OK \li OperationNotInitialized \li SessionClosed
2327 * \li SessionHandleInvalid
2328 * @return true on success, false otherwise
2329 */
2330 template <typename TAllocA, typename TAllocB>
2332 const std::vector<uint8_t, TAllocA>& plaintext_data,
2333 std::vector<uint8_t, TAllocB>& encrypted_data,
2334 ReturnValue* return_value = ThrowException) const {
2335 Ulong encrypted_size = 0;
2336 if(!C_Encrypt(session,
2337 const_cast<Byte*>((plaintext_data.data())),
2338 static_cast<Ulong>(plaintext_data.size()),
2339 nullptr,
2340 &encrypted_size,
2341 return_value)) {
2342 return false;
2343 }
2344
2345 encrypted_data.resize(encrypted_size);
2346 if(!C_Encrypt(session,
2347 const_cast<Byte*>(plaintext_data.data()),
2348 static_cast<Ulong>(plaintext_data.size()),
2349 encrypted_data.data(),
2350 &encrypted_size,
2351 return_value)) {
2352 return false;
2353 }
2354 encrypted_data.resize(encrypted_size);
2355 return true;
2356 }
2357
2358 /**
2359 * C_EncryptUpdate continues a multiple-part encryption operation.
2360 * @param session session's handle
2361 * @param part_ptr the plaintext data
2362 * @param part_len plaintext data len
2363 * @param encrypted_part_ptr gets ciphertext
2364 * @param encrypted_part_len_ptr gets c-text size
2365 * @param return_value default value (`ThrowException`): throw exception on error.
2366 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2367 * At least the following PKCS #11 return values may be returned:
2368 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2369 * \li DataLenRange \li DeviceError \li DeviceMemory
2370 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2371 * \li GeneralError \li HostMemory \li OK
2372 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2373 * @return true on success, false otherwise
2374 */
2375 bool C_EncryptUpdate(SessionHandle session,
2376 const Byte* part_ptr,
2377 Ulong part_len,
2378 Byte* encrypted_part_ptr,
2379 Ulong* encrypted_part_len_ptr,
2380 ReturnValue* return_value = ThrowException) const;
2381
2382 /**
2383 * C_EncryptFinal finishes a multiple-part encryption operation.
2384 * @param session session handle
2385 * @param last_encrypted_part_ptr last c-text
2386 * @param last_encrypted_part_len_ptr gets last size
2387 * @param return_value default value (`ThrowException`): throw exception on error.
2388 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2389 * At least the following PKCS #11 return values may be returned:
2390 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2391 * \li DataLenRange \li DeviceError \li DeviceMemory
2392 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2393 * \li GeneralError \li HostMemory \li OK
2394 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2395 * @return true on success, false otherwise
2396 */
2397 bool C_EncryptFinal(SessionHandle session,
2398 Byte* last_encrypted_part_ptr,
2399 Ulong* last_encrypted_part_len_ptr,
2400 ReturnValue* return_value = ThrowException) const;
2401
2402 /*********************** Message-based encryption functions ***********************/
2403
2404 /**
2405 * C_MessageEncryptInit prepares a session for one or more encryption
2406 * operations that use the same encryption mechanism and
2407 * encryption key.
2408 *
2409 * @param session the session's handle
2410 * @param mechanism_ptr the encryption mechanism
2411 * @param key handle of encryption key
2412 * @param return_value default value (`ThrowException`): throw exception on error
2413 * @return true on success, false otherwise
2414 */
2416 const Mechanism* mechanism_ptr,
2417 ObjectHandle key,
2418 ReturnValue* return_value = ThrowException);
2419
2420 /**
2421 * C_EncryptMessage encrypts a message in a single part.
2422 *
2423 * @param session the session's handle
2424 * @param parameter_ptr message specific parameter
2425 * @param parameter_len length of message specific parameter
2426 * @param associated_data_ptr AEAD Associated data
2427 * @param associated_data_len AEAD Associated data length
2428 * @param plaintext_ptr plain text
2429 * @param plaintext_len plain text length
2430 * @param ciphertext_ptr gets cipher text
2431 * @param ciphertext_len_ptr gets cipher text length
2432 * @param return_value default value (`ThrowException`): throw exception on error
2433 * @return true on success, false otherwise
2434 */
2435 bool C_EncryptMessage(SessionHandle session,
2436 const void* parameter_ptr,
2437 Ulong parameter_len,
2438 const Byte* associated_data_ptr,
2439 Ulong associated_data_len,
2440 const Byte* plaintext_ptr,
2441 Ulong plaintext_len,
2442 Byte* ciphertext_ptr,
2443 Ulong* ciphertext_len_ptr,
2444 ReturnValue* return_value = ThrowException);
2445
2446 /**
2447 * C_EncryptMessageBegin begins a multiple-part message encryption operation.
2448 *
2449 * @param session the session's handle
2450 * @param parameter_ptr message specific parameter
2451 * @param parameter_len length of message specific parameter
2452 * @param associated_data_ptr AEAD Associated data
2453 * @param associated_data_len AEAD Associated data length
2454 * @param return_value default value (`ThrowException`): throw exception on error
2455 * @return true on success, false otherwise
2456 */
2458 const void* parameter_ptr,
2459 Ulong parameter_len,
2460 const Byte* associated_data_ptr,
2461 Ulong associated_data_len,
2462 ReturnValue* return_value = ThrowException);
2463
2464 /**
2465 * C_EncryptMessageNext continues a multiple-part message encryption operation,
2466 * processing another message part.
2467 *
2468 * @param session the session's handle
2469 * @param parameter_ptr message specific parameter
2470 * @param parameter_len length of message specific parameter
2471 * @param plaintext_part_ptr plain text
2472 * @param plaintext_part_len plain text length
2473 * @param ciphertext_ptr gets cipher text
2474 * @param ciphertext_part_len_ptr gets cipher text length
2475 * @param flags multi mode flag
2476 * @param return_value default value (`ThrowException`): throw exception on error
2477 * @return true on success, false otherwise
2478 */
2480 const void* parameter_ptr,
2481 Ulong parameter_len,
2482 const Byte* plaintext_part_ptr,
2483 Ulong plaintext_part_len,
2484 Byte* ciphertext_ptr,
2485 Ulong* ciphertext_part_len_ptr,
2486 Flags flags,
2487 ReturnValue* return_value = ThrowException);
2488
2489 /**
2490 * C_MessageDecryptFinal finishes a message-based decryption process.
2491 *
2492 * @param session the session's handle
2493 * @param return_value default value (`ThrowException`): throw exception on error
2494 * @return true on success, false otherwise
2495 */
2496 bool C_MessageEncryptFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
2497
2498 /****************************** Decryption functions ******************************/
2499
2500 /**
2501 * C_DecryptInit initializes a decryption operation.
2502 * @param session the session's handle
2503 * @param mechanism_ptr the decryption mechanism
2504 * @param key handle of decryption key
2505 * @param return_value default value (`ThrowException`): throw exception on error.
2506 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2507 * At least the following PKCS #11 return values may be returned:
2508 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2509 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2510 * \li FunctionFailed \li GeneralError \li HostMemory
2511 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
2512 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
2513 * \li OK \li OperationActive \li PinExpired
2514 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2515 * @return true on success, false otherwise
2516 */
2517 bool C_DecryptInit(SessionHandle session,
2518 const Mechanism* mechanism_ptr,
2519 ObjectHandle key,
2520 ReturnValue* return_value = ThrowException) const;
2521
2522 /**
2523 * C_Decrypt decrypts encrypted data in a single part.
2524 * @param session session's handle
2525 * @param encrypted_data_ptr ciphertext
2526 * @param encrypted_data_len ciphertext length
2527 * @param data_ptr gets plaintext
2528 * @param data_len_ptr gets p-text size
2529 * @param return_value default value (`ThrowException`): throw exception on error.
2530 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2531 * At least the following PKCS #11 return values may be returned:
2532 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2533 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2534 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2535 * \li FunctionFailed \li GeneralError \li HostMemory
2536 * \li OK \li OperationNotInitialized \li SessionClosed
2537 * \li SessionHandleInvalid \li UserNotLoggedIn
2538 * @return true on success, false otherwise
2539 */
2540 bool C_Decrypt(SessionHandle session,
2541 const Byte* encrypted_data_ptr,
2542 Ulong encrypted_data_len,
2543 Byte* data_ptr,
2544 Ulong* data_len_ptr,
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 ciphertext
2551 * @param decrypted_data gets plaintext
2552 * @param return_value default value (`ThrowException`): throw exception on error.
2553 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2554 * At least the following PKCS #11 return values may be returned:
2555 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2556 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2557 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2558 * \li FunctionFailed \li GeneralError \li HostMemory
2559 * \li OK \li OperationNotInitialized \li SessionClosed
2560 * \li SessionHandleInvalid \li UserNotLoggedIn
2561 * @return true on success, false otherwise
2562 */
2563 template <typename TAllocA, typename TAllocB>
2565 const std::vector<uint8_t, TAllocA>& encrypted_data,
2566 std::vector<uint8_t, TAllocB>& decrypted_data,
2567 ReturnValue* return_value = ThrowException) const {
2568 Ulong decrypted_size = 0;
2569 if(!C_Decrypt(session,
2570 const_cast<Byte*>((encrypted_data.data())),
2571 static_cast<Ulong>(encrypted_data.size()),
2572 nullptr,
2573 &decrypted_size,
2574 return_value)) {
2575 return false;
2576 }
2577
2578 decrypted_data.resize(decrypted_size);
2579 if(!C_Decrypt(session,
2580 const_cast<Byte*>(encrypted_data.data()),
2581 static_cast<Ulong>(encrypted_data.size()),
2582 decrypted_data.data(),
2583 &decrypted_size,
2584 return_value)) {
2585 return false;
2586 }
2587 decrypted_data.resize(decrypted_size);
2588 return true;
2589 }
2590
2591 /**
2592 * C_DecryptUpdate continues a multiple-part decryption operation.
2593 * @param session session's handle
2594 * @param encrypted_part_ptr encrypted data
2595 * @param encrypted_part_len input length
2596 * @param part_ptr gets plaintext
2597 * @param part_len_ptr p-text size
2598 * @param return_value default value (`ThrowException`): throw exception on error.
2599 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2600 * At least the following PKCS #11 return values may be returned:
2601 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2602 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2603 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2604 * \li FunctionFailed \li GeneralError \li HostMemory
2605 * \li OK \li OperationNotInitialized \li SessionClosed
2606 * \li SessionHandleInvalid \li UserNotLoggedIn
2607 * @return true on success, false otherwise
2608 */
2609 bool C_DecryptUpdate(SessionHandle session,
2610 const Byte* encrypted_part_ptr,
2611 Ulong encrypted_part_len,
2612 Byte* part_ptr,
2613 Ulong* part_len_ptr,
2614 ReturnValue* return_value = ThrowException) const;
2615
2616 /**
2617 * C_DecryptFinal finishes a multiple-part decryption operation.
2618 * @param session the session's handle
2619 * @param last_part_ptr gets plaintext
2620 * @param last_part_len_ptr p-text size
2621 * @param return_value default value (`ThrowException`): throw exception on error.
2622 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2623 * At least the following PKCS #11 return values may be returned:
2624 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2625 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2626 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
2627 * \li FunctionFailed \li GeneralError \li HostMemory
2628 * \li OK \li OperationNotInitialized \li SessionClosed
2629 * \li SessionHandleInvalid \li UserNotLoggedIn
2630 * @return true on success, false otherwise
2631 */
2632 bool C_DecryptFinal(SessionHandle session,
2633 Byte* last_part_ptr,
2634 Ulong* last_part_len_ptr,
2635 ReturnValue* return_value = ThrowException) const;
2636
2637 /*********************** Message-based decryption functions ***********************/
2638
2639 /**
2640 * C_MessageDecryptInit initializes a message-based decryption process,
2641 * preparing a session for one or more decryption operations that use the
2642 * same decryption mechanism and decryption key.
2643 *
2644 * @param session the session's handle
2645 * @param mechanism_ptr the decryption mechanism
2646 * @param key handle of decryption key
2647 * @param return_value default value (`ThrowException`): throw exception on error
2648 * @return true on success, false otherwise
2649 */
2651 const Mechanism* mechanism_ptr,
2652 ObjectHandle key,
2653 ReturnValue* return_value = ThrowException);
2654
2655 /**
2656 * C_DecryptMessage decrypts an encrypted message in a single part.
2657 *
2658 * @param session the session's handle
2659 * @param parameter_ptr message specific parameter
2660 * @param parameter_len length of message specific parameter
2661 * @param associated_data_ptr AEAD Associated data
2662 * @param associated_data_len AEAD Associated data length
2663 * @param ciphertext_ptr cipher text
2664 * @param ciphertext_len cipher text length
2665 * @param plaintext_ptr gets plain text
2666 * @param plaintext_len_ptr gets plain text length
2667 * @param return_value default value (`ThrowException`): throw exception on error
2668 * @return true on success, false otherwise
2669 */
2670 bool C_DecryptMessage(SessionHandle session,
2671 const void* parameter_ptr,
2672 Ulong parameter_len,
2673 const Byte* associated_data_ptr,
2674 Ulong associated_data_len,
2675 const Byte* ciphertext_ptr,
2676 Ulong ciphertext_len,
2677 Byte* plaintext_ptr,
2678 Ulong* plaintext_len_ptr,
2679 ReturnValue* return_value = ThrowException);
2680
2681 /**
2682 * C_DecryptMessageBegin begins a multiple-part message decryption operation.
2683 *
2684 * @param session the session's handle
2685 * @param parameter_ptr message specific parameter
2686 * @param parameter_len length of message specific parameter
2687 * @param associated_data_ptr AEAD Associated data
2688 * @param associated_data_len AEAD Associated data length
2689 * @param return_value default value (`ThrowException`): throw exception on error
2690 * @return true on success, false otherwise
2691 */
2693 const void* parameter_ptr,
2694 Ulong parameter_len,
2695 const Byte* associated_data_ptr,
2696 Ulong associated_data_len,
2697 ReturnValue* return_value = ThrowException);
2698
2699 /**
2700 * C_DecryptMessageNext continues a multiple-part message decryption operation,
2701 * processing another encrypted message part.
2702 *
2703 * @param session the session's handle
2704 * @param parameter_ptr message specific parameter
2705 * @param parameter_len length of message specific parameter
2706 * @param ciphertext_part_ptr cipher text
2707 * @param ciphertext_part_len cipher text length
2708 * @param plaintext_ptr gets plain text
2709 * @param plaintext_part_len_ptr gets plain text length
2710 * @param flags multi mode flag
2711 * @param return_value default value (`ThrowException`): throw exception on error
2712 * @return true on success, false otherwise
2713 */
2715 const void* parameter_ptr,
2716 Ulong parameter_len,
2717 const Byte* ciphertext_part_ptr,
2718 Ulong ciphertext_part_len,
2719 Byte* plaintext_ptr,
2720 Ulong* plaintext_part_len_ptr,
2721 Flags flags,
2722 ReturnValue* return_value = ThrowException);
2723
2724 /**
2725 * C_MessageDecryptFinal finishes a message-based decryption process.
2726 *
2727 * @param session the session's handle
2728 * @param return_value default value (`ThrowException`): throw exception on error
2729 * @return true on success, false otherwise
2730 */
2731 bool C_MessageDecryptFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
2732
2733 /****************************** Message digesting functions ******************************/
2734
2735 /**
2736 * C_DigestInit initializes a message-digesting operation.
2737 * @param session the session's handle
2738 * @param mechanism_ptr the digesting mechanism
2739 * @param return_value default value (`ThrowException`): throw exception on error.
2740 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2741 * At least the following PKCS #11 return values may be returned:
2742 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2743 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2744 * \li FunctionFailed \li GeneralError \li HostMemory
2745 * \li MechanismInvalid \li MechanismParamInvalid \li OK
2746 * \li OperationActive \li PinExpired \li SessionClosed
2747 * \li SessionHandleInvalid \li UserNotLoggedIn
2748 * @return true on success, false otherwise
2749 */
2750 bool C_DigestInit(SessionHandle session,
2751 const Mechanism* mechanism_ptr,
2752 ReturnValue* return_value = ThrowException) const;
2753
2754 /**
2755 * C_Digest digests data in a single part.
2756 * @param session the session's handle
2757 * @param data_ptr data to be digested
2758 * @param data_len bytes of data to digest
2759 * @param digest_ptr gets the message digest
2760 * @param digest_len_ptr gets digest length
2761 * @param return_value default value (`ThrowException`): throw exception on error.
2762 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2763 * At least the following PKCS #11 return values may be returned:
2764 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2765 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2766 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2767 * \li HostMemory \li OK \li OperationNotInitialized
2768 * \li SessionClosed \li SessionHandleInvalid
2769 * @return true on success, false otherwise
2770 */
2771 bool C_Digest(SessionHandle session,
2772 const Byte* data_ptr,
2773 Ulong data_len,
2774 Byte* digest_ptr,
2775 Ulong* digest_len_ptr,
2776 ReturnValue* return_value = ThrowException) const;
2777
2778 /**
2779 * C_DigestUpdate continues a multiple-part message-digesting operation.
2780 * @param session the session's handle
2781 * @param part_ptr data to be digested
2782 * @param part_len bytes of data to be digested
2783 * @param return_value default value (`ThrowException`): throw exception on error.
2784 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2785 * At least the following PKCS #11 return values may be returned:
2786 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2787 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2788 * \li FunctionFailed \li GeneralError \li HostMemory
2789 * \li OK \li OperationNotInitialized \li SessionClosed
2790 * \li SessionHandleInvalid
2791 * @return true on success, false otherwise
2792 */
2793 bool C_DigestUpdate(SessionHandle session,
2794 const Byte* part_ptr,
2795 Ulong part_len,
2796 ReturnValue* return_value = ThrowException) const;
2797
2798 /**
2799 * C_DigestKey continues a multi-part message-digesting operation, by digesting the value of a secret key as part of the data already digested.
2800 * @param session the session's handle
2801 * @param key secret key to digest
2802 * @param return_value default value (`ThrowException`): throw exception on error.
2803 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2804 * At least the following PKCS #11 return values may be returned:
2805 * \li CryptokiNotInitialized \li DeviceError \li DeviceMemory
2806 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2807 * \li GeneralError \li HostMemory \li KeyHandleInvalid
2808 * \li KeyIndigestible \li KeySizeRange \li OK
2809 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2810 * @return true on success, false otherwise
2811 */
2812 bool C_DigestKey(SessionHandle session, ObjectHandle key, ReturnValue* return_value = ThrowException) const;
2813
2814 /**
2815 * C_DigestFinal finishes a multiple-part message-digesting operation.
2816 * @param session the session's handle
2817 * @param digest_ptr gets the message digest
2818 * @param digest_len_ptr gets uint8_t count of digest
2819 * @param return_value default value (`ThrowException`): throw exception on error.
2820 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2821 * At least the following PKCS #11 return values may be returned:
2822 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2823 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2824 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2825 * \li HostMemory \li OK \li OperationNotInitialized
2826 * \li SessionClosed \li SessionHandleInvalid
2827 * @return true on success, false otherwise
2828 */
2829 bool C_DigestFinal(SessionHandle session,
2830 Byte* digest_ptr,
2831 Ulong* digest_len_ptr,
2832 ReturnValue* return_value = ThrowException) const;
2833
2834 /****************************** Signing and MACing functions ******************************/
2835
2836 /**
2837 * 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.
2838 * @param session the session's handle
2839 * @param mechanism_ptr the signature mechanism
2840 * @param key handle of signature key
2841 * @param return_value default value (`ThrowException`): throw exception on error.
2842 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2843 * At least the following PKCS #11 return values may be returned:
2844 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
2845 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2846 * \li FunctionFailed \li GeneralError \li HostMemory
2847 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
2848 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
2849 * \li OK \li OperationActive \li PinExpired
2850 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2851 * @return true on success, false otherwise
2852 */
2853 bool C_SignInit(SessionHandle session,
2854 const Mechanism* mechanism_ptr,
2855 ObjectHandle key,
2856 ReturnValue* return_value = ThrowException) const;
2857
2858 /**
2859 * 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.
2860 * @param session the session's handle
2861 * @param data_ptr the data to sign
2862 * @param data_len count of bytes to sign
2863 * @param signature_ptr gets the signature
2864 * @param signature_len_ptr gets signature length
2865 * @param return_value default value (`ThrowException`): throw exception on error.
2866 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2867 * At least the following PKCS #11 return values may be returned:
2868 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2869 * \li DataInvalid \li DataLenRange \li DeviceError
2870 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2871 * \li FunctionFailed \li GeneralError \li HostMemory
2872 * \li OK \li OperationNotInitialized \li SessionClosed
2873 * \li SessionHandleInvalid \li UserNotLoggedIn \li FunctionRejected
2874 * @return true on success, false otherwise
2875 */
2876 bool C_Sign(SessionHandle session,
2877 const Byte* data_ptr,
2878 Ulong data_len,
2879 Byte* signature_ptr,
2880 Ulong* signature_len_ptr,
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 the data to sign
2887 * @param signature gets the signature
2888 * @param return_value default value (`ThrowException`): throw exception on error.
2889 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2890 * At least the following PKCS #11 return values may be returned:
2891 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2892 * \li DataInvalid \li DataLenRange \li DeviceError
2893 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
2894 * \li FunctionFailed \li GeneralError \li HostMemory
2895 * \li OK \li OperationNotInitialized \li SessionClosed
2896 * \li SessionHandleInvalid \li UserNotLoggedIn \li FunctionRejected
2897 * @return true on success, false otherwise
2898 */
2899 template <typename TAllocA, typename TAllocB>
2900 bool C_Sign(SessionHandle session,
2901 const std::vector<uint8_t, TAllocA>& data,
2902 std::vector<uint8_t, TAllocB>& signature,
2903 ReturnValue* return_value = ThrowException) const {
2904 Ulong signature_size = 0;
2905 if(!C_Sign(session, data.data(), static_cast<Ulong>(data.size()), nullptr, &signature_size, return_value)) {
2906 return false;
2907 }
2908
2909 signature.resize(signature_size);
2910 if(!C_Sign(session,
2911 data.data(),
2912 static_cast<Ulong>(data.size()),
2913 signature.data(),
2914 &signature_size,
2915 return_value)) {
2916 return false;
2917 }
2918 signature.resize(signature_size);
2919 return true;
2920 }
2921
2922 /**
2923 * 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.
2924 * @param session the session's handle
2925 * @param part_ptr the data to sign
2926 * @param part_len count of bytes to sign
2927 * @param return_value default value (`ThrowException`): throw exception on error.
2928 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2929 * At least the following PKCS #11 return values may be returned:
2930 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
2931 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2932 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2933 * \li HostMemory \li OK \li OperationNotInitialized
2934 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2935 * @return true on success, false otherwise
2936 */
2937 bool C_SignUpdate(SessionHandle session,
2938 const Byte* part_ptr,
2939 Ulong part_len,
2940 ReturnValue* return_value = ThrowException) const;
2941
2942 /**
2943 * 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.
2944 * @param session the session's handle
2945 * @param part the data to sign
2946 * @param return_value default value (`ThrowException`): throw exception on error.
2947 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2948 * At least the following PKCS #11 return values may be returned:
2949 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
2950 * \li DeviceError \li DeviceMemory \li DeviceRemoved
2951 * \li FunctionCanceled \li FunctionFailed \li GeneralError
2952 * \li HostMemory \li OK \li OperationNotInitialized
2953 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
2954 * @return true on success, false otherwise
2955 */
2956 template <typename TAlloc>
2958 const std::vector<uint8_t, TAlloc>& part,
2959 ReturnValue* return_value = ThrowException) const {
2960 return C_SignUpdate(session, part.data(), static_cast<Ulong>(part.size()), return_value);
2961 }
2962
2963 /**
2964 * C_SignFinal finishes a multiple-part signature operation, returning the signature.
2965 * @param session the session's handle
2966 * @param signature_ptr gets the signature
2967 * @param signature_len_ptr gets signature length
2968 * @param return_value default value (`ThrowException`): throw exception on error.
2969 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2970 * At least the following PKCS #11 return values may be returned:
2971 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2972 * \li DataLenRange \li DeviceError \li DeviceMemory
2973 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2974 * \li GeneralError \li HostMemory \li OK
2975 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2976 * \li UserNotLoggedIn \li FunctionRejected
2977 * @return true on success, false otherwise
2978 */
2979 bool C_SignFinal(SessionHandle session,
2980 Byte* signature_ptr,
2981 Ulong* signature_len_ptr,
2982 ReturnValue* return_value = ThrowException) const;
2983
2984 /**
2985 * C_SignFinal finishes a multiple-part signature operation, returning the signature.
2986 * @param session the session's handle
2987 * @param signature gets the signature
2988 * @param return_value default value (`ThrowException`): throw exception on error.
2989 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
2990 * At least the following PKCS #11 return values may be returned:
2991 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
2992 * \li DataLenRange \li DeviceError \li DeviceMemory
2993 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
2994 * \li GeneralError \li HostMemory \li OK
2995 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
2996 * \li UserNotLoggedIn \li FunctionRejected
2997 * @return true on success, false otherwise
2998 */
2999 template <typename TAlloc>
3001 std::vector<uint8_t, TAlloc>& signature,
3002 ReturnValue* return_value = ThrowException) const {
3003 Ulong signature_size = 0;
3004 if(!C_SignFinal(session, nullptr, &signature_size, return_value)) {
3005 return false;
3006 }
3007
3008 signature.resize(signature_size);
3009 if(!C_SignFinal(session, signature.data(), &signature_size, return_value)) {
3010 return false;
3011 }
3012 signature.resize(signature_size);
3013 return true;
3014 }
3015
3016 /**
3017 * C_SignRecoverInit initializes a signature operation, where the data can be recovered from the signature.
3018 * @param session the session's handle
3019 * @param mechanism_ptr the signature mechanism
3020 * @param key handle of the signature key
3021 * @param return_value default value (`ThrowException`): throw exception on error.
3022 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3023 * At least the following PKCS #11 return values may be returned:
3024 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3025 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3026 * \li FunctionFailed \li GeneralError \li HostMemory
3027 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
3028 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
3029 * \li OK \li OperationActive \li PinExpired
3030 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3031 * @return true on success, false otherwise
3032 */
3033 bool C_SignRecoverInit(SessionHandle session,
3034 const Mechanism* mechanism_ptr,
3035 ObjectHandle key,
3036 ReturnValue* return_value = ThrowException) const;
3037
3038 /**
3039 * C_SignRecover signs data in a single operation, where the data can be recovered from the signature.
3040 * @param session the session's handle
3041 * @param data_ptr the data to sign
3042 * @param data_len count of bytes to sign
3043 * @param signature_ptr gets the signature
3044 * @param signature_len_ptr gets signature length
3045 * @param return_value default value (`ThrowException`): throw exception on error.
3046 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3047 * At least the following PKCS #11 return values may be returned:
3048 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3049 * \li DataInvalid \li DataLenRange \li DeviceError
3050 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3051 * \li FunctionFailed \li GeneralError \li HostMemory
3052 * \li OK \li OperationNotInitialized \li SessionClosed
3053 * \li SessionHandleInvalid \li UserNotLoggedIn
3054 * @return true on success, false otherwise
3055 */
3056 bool C_SignRecover(SessionHandle session,
3057 const Byte* data_ptr,
3058 Ulong data_len,
3059 Byte* signature_ptr,
3060 Ulong* signature_len_ptr,
3061 ReturnValue* return_value = ThrowException) const;
3062
3063 /******************* Message-based signing and MACing functions *******************/
3064
3065 /**
3066 * C_MessageSignInit initializes a message-based signature process, preparing a
3067 * session for one or more signature operations (where the signature is an
3068 * appendix to the data) that use the same signature mechanism and
3069 * signature key.
3070 *
3071 * @param session the session's handle
3072 * @param mechanism_ptr the signing mechanism
3073 * @param key handle of signing key
3074 * @param return_value default value (`ThrowException`): throw exception on error
3075 * @return true on success, false otherwise
3076 */
3077 bool C_MessageSignInit(SessionHandle session,
3078 const Mechanism* mechanism_ptr,
3079 ObjectHandle key,
3080 ReturnValue* return_value = ThrowException);
3081
3082 /**
3083 * C_SignMessage signs a message in a single part, where the signature is an
3084 * appendix to the message. C_MessageSignInit must previously been called
3085 * on the session.
3086 *
3087 * @param session the session's handle
3088 * @param parameter_ptr message specific parameter
3089 * @param parameter_len length of message specific parameter
3090 * @param data_ptr data to sign
3091 * @param data_len data to sign length
3092 * @param signature_ptr gets signature
3093 * @param signature_len_ptr gets signature length
3094 * @param return_value default value (`ThrowException`): throw exception on error
3095 * @return true on success, false otherwise
3096 */
3097 bool C_SignMessage(SessionHandle session,
3098 const void* parameter_ptr,
3099 Ulong parameter_len,
3100 const Byte* data_ptr,
3101 Ulong data_len,
3102 Byte* signature_ptr,
3103 Ulong* signature_len_ptr,
3104 ReturnValue* return_value = ThrowException);
3105
3106 /**
3107 * C_SignMessageBegin begins a multiple-part message signature operation, where
3108 * the signature is an appendix to the message. C_MessageSignInit must
3109 * previously been called on the session.
3110 *
3111 * @param session the session's handle
3112 * @param parameter_ptr message specific parameter
3113 * @param parameter_len length of message specific parameter
3114 * @param return_value default value (`ThrowException`): throw exception on error
3115 * @return true on success, false otherwise
3116 */
3117 bool C_SignMessageBegin(SessionHandle session,
3118 const void* parameter_ptr,
3119 Ulong parameter_len,
3120 ReturnValue* return_value = ThrowException);
3121
3122 /**
3123 * C_SignMessageNext continues a multiple-part message signature operation,
3124 * processing another data part, or finishes a multiple-part message
3125 * signature operation, returning the signature.
3126 *
3127 * @param session the session's handle
3128 * @param parameter_ptr message specific parameter
3129 * @param parameter_len length of message specific parameter
3130 * @param data_ptr data to sign
3131 * @param data_len data to sign length
3132 * @param signature_ptr gets signature
3133 * @param signature_len_ptr gets signature length
3134 * @param return_value default value (`ThrowException`): throw exception on error
3135 * @return true on success, false otherwise
3136 */
3137 bool C_SignMessageNext(SessionHandle session,
3138 const void* parameter_ptr,
3139 Ulong parameter_len,
3140 const Byte* data_ptr,
3141 Ulong data_len,
3142 Byte* signature_ptr,
3143 Ulong* signature_len_ptr,
3144 ReturnValue* return_value = ThrowException);
3145
3146 /**
3147 * C_MessageSignFinal finishes a message-based signing process.
3148 *
3149 * @param session the session's handle
3150 * @param return_value default value (`ThrowException`): throw exception on error
3151 * @return true on success, false otherwise
3152 */
3153 bool C_MessageSignFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
3154
3155 /****************************** Functions for verifying signatures and MACs ******************************/
3156
3157 /**
3158 * 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).
3159 * @param session the session's handle
3160 * @param mechanism_ptr the verification mechanism
3161 * @param key verification key
3162 * @param return_value default value (`ThrowException`): throw exception on error.
3163 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3164 * At least the following PKCS #11 return values may be returned:
3165 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3166 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3167 * \li FunctionFailed \li GeneralError \li HostMemory
3168 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
3169 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
3170 * \li OK \li OperationActive \li PinExpired
3171 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3172 * @return true on success, false otherwise
3173 */
3174 bool C_VerifyInit(SessionHandle session,
3175 const Mechanism* mechanism_ptr,
3176 ObjectHandle key,
3177 ReturnValue* return_value = ThrowException) const;
3178
3179 /**
3180 * 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.
3181 * @param session the session's handle
3182 * @param data_ptr signed data
3183 * @param data_len length of signed data
3184 * @param signature_ptr signature
3185 * @param signature_len signature length
3186 * @param return_value default value (`ThrowException`): throw exception on error.
3187 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3188 * At least the following PKCS #11 return values may be returned:
3189 * \li ArgumentsBad \li CryptokiNotInitialized \li DataInvalid
3190 * \li DataLenRange \li DeviceError \li DeviceMemory
3191 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3192 * \li GeneralError \li HostMemory \li OK
3193 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3194 * \li SignatureInvalid \li SignatureLenRange
3195 * @return true on success, false otherwise
3196 */
3197 bool C_Verify(SessionHandle session,
3198 const Byte* data_ptr,
3199 Ulong data_len,
3200 const Byte* signature_ptr,
3201 Ulong signature_len,
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 signed data
3208 * @param signature signature
3209 * @param return_value default value (`ThrowException`): throw exception on error.
3210 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3211 * At least the following PKCS #11 return values may be returned:
3212 * \li ArgumentsBad \li CryptokiNotInitialized \li DataInvalid
3213 * \li DataLenRange \li DeviceError \li DeviceMemory
3214 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3215 * \li GeneralError \li HostMemory \li OK
3216 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3217 * \li SignatureInvalid \li SignatureLenRange
3218 * @return true on success, false otherwise
3219 */
3220 template <typename TAllocA, typename TAllocB>
3222 const std::vector<uint8_t, TAllocA>& data,
3223 std::vector<uint8_t, TAllocB>& signature,
3224 ReturnValue* return_value = ThrowException) const {
3225 return C_Verify(session,
3226 data.data(),
3227 static_cast<Ulong>(data.size()),
3228 signature.data(),
3229 static_cast<Ulong>(signature.size()),
3230 return_value);
3231 }
3232
3233 /**
3234 * 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.
3235 * @param session the session's handle
3236 * @param part_ptr signed data
3237 * @param part_len length of signed data
3238 * @param return_value default value (`ThrowException`): throw exception on error.
3239 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3240 * At least the following PKCS #11 return values may be returned:
3241 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
3242 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3243 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3244 * \li HostMemory \li OK \li OperationNotInitialized
3245 * \li SessionClosed \li SessionHandleInvalid
3246 * @return true on success, false otherwise
3247 */
3248 bool C_VerifyUpdate(SessionHandle session,
3249 const Byte* part_ptr,
3250 Ulong part_len,
3251 ReturnValue* return_value = ThrowException) const;
3252
3253 /**
3254 * 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.
3255 * @param session the session's handle
3256 * @param part signed data
3257 * @param return_value default value (`ThrowException`): throw exception on error.
3258 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3259 * At least the following PKCS #11 return values may be returned:
3260 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
3261 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3262 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3263 * \li HostMemory \li OK \li OperationNotInitialized
3264 * \li SessionClosed \li SessionHandleInvalid
3265 * @return true on success, false otherwise
3266 */
3267 template <typename TAlloc>
3269 std::vector<uint8_t, TAlloc> part,
3270 ReturnValue* return_value = ThrowException) const {
3271 return C_VerifyUpdate(session, part.data(), static_cast<Ulong>(part.size()), return_value);
3272 }
3273
3274 /**
3275 * C_VerifyFinal finishes a multiple-part verification operation, checking the signature.
3276 * @param session the session's handle
3277 * @param signature_ptr signature to verify
3278 * @param signature_len signature length
3279 * @param return_value default value (`ThrowException`): throw exception on error.
3280 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3281 * At least the following PKCS #11 return values may be returned:
3282 * \li ArgumentsBad \li CryptokiNotInitialized \li DataLenRange
3283 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3284 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3285 * \li HostMemory \li OK \li OperationNotInitialized
3286 * \li SessionClosed \li SessionHandleInvalid \li SignatureInvalid
3287 * \li SignatureLenRange
3288 * @return true on success, false otherwise
3289 */
3290 bool C_VerifyFinal(SessionHandle session,
3291 const Byte* signature_ptr,
3292 Ulong signature_len,
3293 ReturnValue* return_value = ThrowException) const;
3294
3295 /**
3296 * C_VerifyRecoverInit initializes a signature verification operation, where the data is recovered from the signature.
3297 * @param session the session's handle
3298 * @param mechanism_ptr the verification mechanism
3299 * @param key verification key
3300 * @param return_value default value (`ThrowException`): throw exception on error.
3301 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3302 * At least the following PKCS #11 return values may be returned:
3303 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3304 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3305 * \li FunctionFailed \li GeneralError \li HostMemory
3306 * \li KeyFunctionNotPermitted \li KeyHandleInvalid \li KeySizeRange
3307 * \li KeyTypeInconsistent \li MechanismInvalid \li MechanismParamInvalid
3308 * \li OK \li OperationActive \li PinExpired
3309 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3310 * @return true on success, false otherwise
3311 */
3313 const Mechanism* mechanism_ptr,
3314 ObjectHandle key,
3315 ReturnValue* return_value = ThrowException) const;
3316
3317 /**
3318 * C_VerifyRecover verifies a signature in a single-part operation, where the data is recovered from the signature.
3319 * @param session the session's handle
3320 * @param signature_ptr signature to verify
3321 * @param signature_len signature length
3322 * @param data_ptr gets signed data
3323 * @param data_len_ptr gets signed data len
3324 * @param return_value default value (`ThrowException`): throw exception on error.
3325 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3326 * At least the following PKCS #11 return values may be returned:
3327 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3328 * \li DataInvalid \li DataLenRange \li DeviceError
3329 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3330 * \li FunctionFailed \li GeneralError \li HostMemory
3331 * \li OK \li OperationNotInitialized \li SessionClosed
3332 * \li SessionHandleInvalid \li SignatureLenRange \li SignatureInvalid
3333 * @return true on success, false otherwise
3334 */
3335 bool C_VerifyRecover(SessionHandle session,
3336 const Byte* signature_ptr,
3337 Ulong signature_len,
3338 Byte* data_ptr,
3339 Ulong* data_len_ptr,
3340 ReturnValue* return_value = ThrowException) const;
3341
3342 /**
3343 * C_VerifySignatureInit initializes a verification operation, where the
3344 * signature is included as part of the initialization.
3345 *
3346 * @param session the session's handle
3347 * @param mechanism_ptr the verification mechanism
3348 * @param key verification key
3349 * @param signature_ptr signature
3350 * @param signature_len signature length
3351 * @param return_value default value (`ThrowException`): throw exception on error
3352 * @return true on success, false otherwise
3353 */
3355 const Mechanism* mechanism_ptr,
3356 ObjectHandle key,
3357 const Byte* signature_ptr,
3358 Ulong signature_len,
3359 ReturnValue* return_value = ThrowException);
3360
3361 /**
3362 * C_VerifySignature verifies a signature in a single-part operation, where the
3363 * signature is an appendix to the data.
3364 *
3365 * @param session the session's handle
3366 * @param data_ptr signed data
3367 * @param data_len length of signed data
3368 * @param return_value default value (`ThrowException`): throw exception on error
3369 * @return true on success, false otherwise
3370 */
3371 bool C_VerifySignature(SessionHandle session,
3372 const Byte* data_ptr,
3373 Ulong data_len,
3374 ReturnValue* return_value = ThrowException);
3375
3376 /**
3377 * C_VerifySignatureUpdate continues a multiple-part verification operation,
3378 * processing another data part.
3379 *
3380 * @param session the session's handle
3381 * @param part_ptr signed data
3382 * @param part_len length of signed data
3383 * @param return_value default value (`ThrowException`): throw exception on error
3384 * @return true on success, false otherwise
3385 */
3387 const Byte* part_ptr,
3388 Ulong part_len,
3389 ReturnValue* return_value = ThrowException);
3390
3391 /**
3392 * C_VerifySignatureFinal finishes a multiple-part verification operation,
3393 * checking the signature.
3394 *
3395 * @param session the session's handle
3396 * @param return_value default value (`ThrowException`): throw exception on error
3397 * @return true on success, false otherwise
3398 */
3399 bool C_VerifySignatureFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
3400
3401 /*********** Message-based functions for verifying signatures and MACs ************/
3402
3403 /**
3404 * C_MessageVerifyInit initializes a message-based verification process,
3405 * preparing a session for one or more verification operations (where the
3406 * signature is an appendix to the data) that use the same verification
3407 * mechanism and verification key.
3408 *
3409 * @param session the session's handle
3410 * @param mechanism_ptr the signing mechanism
3411 * @param key handle of signing key
3412 * @param return_value default value (`ThrowException`): throw exception on error
3413 * @return true on success, false otherwise
3414 */
3416 const Mechanism* mechanism_ptr,
3417 ObjectHandle key,
3418 ReturnValue* return_value = ThrowException);
3419
3420 /**
3421 * C_VerifyMessage verifies a signature on a message in a single part operation,
3422 * where the signature is an appendix to the data. C_MessageVerifyInit must
3423 * previously been called on the session.
3424 *
3425 * @param session the session's handle
3426 * @param parameter_ptr message specific parameter
3427 * @param parameter_len length of message specific parameter
3428 * @param data_ptr data to sign
3429 * @param data_len data to sign length
3430 * @param signature_ptr signature
3431 * @param signature_len signature length
3432 * @param return_value default value (`ThrowException`): throw exception on error
3433 * @return true on success, false otherwise
3434 */
3435 bool C_VerifyMessage(SessionHandle session,
3436 const void* parameter_ptr,
3437 Ulong parameter_len,
3438 const Byte* data_ptr,
3439 Ulong data_len,
3440 const Byte* signature_ptr,
3441 Ulong signature_len,
3442 ReturnValue* return_value = ThrowException);
3443
3444 /**
3445 * C_VerifyMessageBegin begins a multiple-part message verification operation,
3446 * where the signature is an appendix to the message. C_MessageVerifyInit
3447 * must previously been called on the session.
3448 *
3449 * @param session the session's handle
3450 * @param parameter_ptr message specific parameter
3451 * @param parameter_len length of message specific parameter
3452 * @param return_value default value (`ThrowException`): throw exception on error
3453 * @return true on success, false otherwise
3454 */
3456 const void* parameter_ptr,
3457 Ulong parameter_len,
3458 ReturnValue* return_value = ThrowException);
3459
3460 /**
3461 * C_VerifyMessageNext continues a multiple-part message verification operation,
3462 * processing another data part, or finishes a multiple-part message
3463 * verification operation, checking the signature.
3464 *
3465 * @param session the session's handle
3466 * @param parameter_ptr message specific parameter
3467 * @param parameter_len length of message specific parameter
3468 * @param data_ptr data to sign
3469 * @param data_len data to sign length
3470 * @param signature_ptr signature
3471 * @param signature_len signature length
3472 * @param return_value default value (`ThrowException`): throw exception on error
3473 * @return true on success, false otherwise
3474 */
3476 const void* parameter_ptr,
3477 Ulong parameter_len,
3478 const Byte* data_ptr,
3479 Ulong data_len,
3480 const Byte* signature_ptr,
3481 Ulong signature_len,
3482 ReturnValue* return_value = ThrowException);
3483
3484 /**
3485 * C_MessageVerifyFinal finishes a message-based verification process.
3486 *
3487 * @param session the session's handle
3488 * @param return_value default value (`ThrowException`): throw exception on error
3489 * @return true on success, false otherwise
3490 */
3491 bool C_MessageVerifyFinal(SessionHandle session, ReturnValue* return_value = ThrowException);
3492
3493 /****************************** Dual-purpose cryptographic functions ******************************/
3494
3495 /**
3496 * C_DigestEncryptUpdate continues a multiple-part digesting and encryption operation.
3497 * @param session session's handle
3498 * @param part_ptr the plaintext data
3499 * @param part_len plaintext length
3500 * @param encrypted_part_ptr gets ciphertext
3501 * @param encrypted_part_len_ptr gets c-text length
3502 * @param return_value default value (`ThrowException`): throw exception on error.
3503 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3504 * At least the following PKCS #11 return values may be returned:
3505 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3506 * \li DataLenRange \li DeviceError \li DeviceMemory
3507 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3508 * \li GeneralError \li HostMemory \li OK
3509 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3510 * @return true on success, false otherwise
3511 */
3513 const Byte* part_ptr,
3514 Ulong part_len,
3515 Byte* encrypted_part_ptr,
3516 Ulong* encrypted_part_len_ptr,
3517 ReturnValue* return_value = ThrowException) const;
3518
3519 /**
3520 * C_DecryptDigestUpdate continues a multiple-part decryption and digesting operation.
3521 * @param session session's handle
3522 * @param encrypted_part_ptr ciphertext
3523 * @param encrypted_part_len ciphertext length
3524 * @param part_ptr gets plaintext
3525 * @param part_len_ptr gets plaintext len
3526 * @param return_value default value (`ThrowException`): throw exception on error.
3527 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3528 * At least the following PKCS #11 return values may be returned:
3529 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3530 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3531 * \li EncryptedDataInvalid \li EncryptedDataLenRange \li FunctionCanceled
3532 * \li FunctionFailed \li GeneralError \li HostMemory
3533 * \li OK \li OperationNotInitialized \li SessionClosed
3534 * \li SessionHandleInvalid
3535 * @return true on success, false otherwise
3536 */
3538 const Byte* encrypted_part_ptr,
3539 Ulong encrypted_part_len,
3540 Byte* part_ptr,
3541 Ulong* part_len_ptr,
3542 ReturnValue* return_value = ThrowException) const;
3543
3544 /**
3545 * C_SignEncryptUpdate continues a multiple-part signing and encryption operation.
3546 * @param session session's handle
3547 * @param part_ptr the plaintext data
3548 * @param part_len plaintext length
3549 * @param encrypted_part_ptr gets ciphertext
3550 * @param encrypted_part_len_ptr gets c-text length
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 DataLenRange \li DeviceError \li DeviceMemory
3556 * \li DeviceRemoved \li FunctionCanceled \li FunctionFailed
3557 * \li GeneralError \li HostMemory \li OK
3558 * \li OperationNotInitialized \li SessionClosed \li SessionHandleInvalid
3559 * \li UserNotLoggedIn
3560 * @return true on success, false otherwise
3561 */
3563 const Byte* part_ptr,
3564 Ulong part_len,
3565 Byte* encrypted_part_ptr,
3566 Ulong* encrypted_part_len_ptr,
3567 ReturnValue* return_value = ThrowException) const;
3568
3569 /**
3570 * C_DecryptVerifyUpdate continues a multiple-part decryption and verify operation.
3571 * @param session session's handle
3572 * @param encrypted_part_ptr ciphertext
3573 * @param encrypted_part_len ciphertext length
3574 * @param part_ptr gets plaintext
3575 * @param part_len_ptr gets p-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 EncryptedDataInvalid \li EncryptedDataLenRange
3582 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3583 * \li HostMemory \li OK \li OperationNotInitialized
3584 * \li SessionClosed \li SessionHandleInvalid
3585 * @return true on success, false otherwise
3586 */
3588 const Byte* encrypted_part_ptr,
3589 Ulong encrypted_part_len,
3590 Byte* part_ptr,
3591 Ulong* part_len_ptr,
3592 ReturnValue* return_value = ThrowException) const;
3593
3594 /****************************** Key management functions ******************************/
3595
3596 /**
3597 * C_GenerateKey generates a secret key, creating a new key object.
3598 * @param session the session's handle
3599 * @param mechanism_ptr key generation mech.
3600 * @param attribute_template_ptr template for new key
3601 * @param count # of attrs in template
3602 * @param key_ptr gets handle of new key
3603 * @param return_value default value (`ThrowException`): throw exception on error.
3604 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3605 * At least the following PKCS #11 return values may be returned:
3606 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3607 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
3608 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3609 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3610 * \li HostMemory \li MechanismInvalid \li MechanismParamInvalid
3611 * \li OK \li OperationActive \li PinExpired
3612 * \li SessionClosed \li SessionHandleInvalid \li SessionReadOnly
3613 * \li TemplateIncomplete \li TemplateInconsistent \li TokenWriteProtected
3614 * \li UserNotLoggedIn
3615 * @return true on success, false otherwise
3616 */
3617 bool C_GenerateKey(SessionHandle session,
3618 const Mechanism* mechanism_ptr,
3619 Attribute* attribute_template_ptr,
3620 Ulong count,
3621 ObjectHandle* key_ptr,
3622 ReturnValue* return_value = ThrowException) const;
3623
3624 /**
3625 * C_GenerateKeyPair generates a public-key/private-key pair, creating new key objects.
3626 * @param session session handle
3627 * @param mechanism_ptr key-gen mech.
3628 * @param public_key_template_ptr template for pub. key
3629 * @param public_key_attribute_count # pub. attrs.
3630 * @param private_key_template_ptr template for priv. key
3631 * @param private_key_attribute_count # priv. attrs.
3632 * @param public_key_ptr gets pub. key handle
3633 * @param private_key_ptr gets priv. key handle
3634 * @param return_value default value (`ThrowException`): throw exception on error.
3635 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3636 * At least the following PKCS #11 return values may be returned:
3637 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3638 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
3639 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3640 * \li DomainParamsInvalid \li FunctionCanceled \li FunctionFailed
3641 * \li GeneralError \li HostMemory \li MechanismInvalid
3642 * \li MechanismParamInvalid \li OK \li OperationActive
3643 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
3644 * \li SessionReadOnly \li TemplateIncomplete \li TemplateInconsistent
3645 * \li TokenWriteProtected \li UserNotLoggedIn
3646 * @return true on success, false otherwise
3647 */
3648 bool C_GenerateKeyPair(SessionHandle session,
3649 const Mechanism* mechanism_ptr,
3650 Attribute* public_key_template_ptr,
3651 Ulong public_key_attribute_count,
3652 Attribute* private_key_template_ptr,
3653 Ulong private_key_attribute_count,
3654 ObjectHandle* public_key_ptr,
3655 ObjectHandle* private_key_ptr,
3656 ReturnValue* return_value = ThrowException) const;
3657
3658 /**
3659 * C_WrapKey wraps (i.e., encrypts) a key.
3660 * @param session the session's handle
3661 * @param mechanism_ptr the wrapping mechanism
3662 * @param wrapping_key wrapping key
3663 * @param key key to be wrapped
3664 * @param wrapped_key_ptr gets wrapped key
3665 * @param wrapped_key_len_ptr gets wrapped key size
3666 * @param return_value default value (`ThrowException`): throw exception on error.
3667 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3668 * At least the following PKCS #11 return values may be returned:
3669 * \li ArgumentsBad \li BufferTooSmall \li CryptokiNotInitialized
3670 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3671 * \li FunctionCanceled \li FunctionFailed \li GeneralError
3672 * \li HostMemory \li KeyHandleInvalid \li KeyNotWrappable
3673 * \li KeySizeRange \li KeyUnextractable \li MechanismInvalid
3674 * \li MechanismParamInvalid \li OK \li OperationActive
3675 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
3676 * \li UserNotLoggedIn \li WrappingKeyHandleInvalid \li WrappingKeySizeRange
3677 * \li WrappingKeyTypeInconsistent
3678 * @return true on success, false otherwise
3679 */
3680 bool C_WrapKey(SessionHandle session,
3681 const Mechanism* mechanism_ptr,
3682 ObjectHandle wrapping_key,
3683 ObjectHandle key,
3684 Byte* wrapped_key_ptr,
3685 Ulong* wrapped_key_len_ptr,
3686 ReturnValue* return_value = ThrowException) const;
3687
3688 /**
3689 * C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new key object.
3690 * @param session session's handle
3691 * @param mechanism_ptr unwrapping mech.
3692 * @param unwrapping_key unwrapping key
3693 * @param wrapped_key_ptr the wrapped key
3694 * @param wrapped_key_len wrapped key len
3695 * @param attribute_template_ptr new key template
3696 * @param attribute_count template length
3697 * @param key_ptr gets new handle
3698 * @param return_value default value (`ThrowException`): throw exception on error.
3699 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3700 * At least the following PKCS #11 return values may be returned:
3701 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3702 * \li AttributeValueInvalid \li BufferTooSmall \li CryptokiNotInitialized
3703 * \li CurveNotSupported \li DeviceError \li DeviceMemory
3704 * \li DeviceRemoved \li DomainParamsInvalid \li FunctionCanceled
3705 * \li FunctionFailed \li GeneralError \li HostMemory
3706 * \li MechanismInvalid \li MechanismParamInvalid \li OK
3707 * \li OperationActive \li PinExpired \li SessionClosed
3708 * \li SessionHandleInvalid \li SessionReadOnly \li TemplateIncomplete
3709 * \li TemplateInconsistent \li TokenWriteProtected \li UnwrappingKeyHandleInvalid
3710 * \li UnwrappingKeySizeRange \li UnwrappingKeyTypeInconsistent \li UserNotLoggedIn
3711 * \li WrappedKeyInvalid \li WrappedKeyLenRange
3712 * @return true on success, false otherwise
3713 */
3714 bool C_UnwrapKey(SessionHandle session,
3715 const Mechanism* mechanism_ptr,
3716 ObjectHandle unwrapping_key,
3717 const Byte* wrapped_key_ptr,
3718 Ulong wrapped_key_len,
3719 Attribute* attribute_template_ptr,
3720 Ulong attribute_count,
3721 ObjectHandle* key_ptr,
3722 ReturnValue* return_value = ThrowException) const;
3723
3724 /**
3725 * C_DeriveKey derives a key from a base key, creating a new key object.
3726 * @param session session's handle
3727 * @param mechanism_ptr key deriv. mech.
3728 * @param base_key base key
3729 * @param attribute_template_ptr new key template
3730 * @param attribute_count template length
3731 * @param key_ptr gets new handle
3732 * @param return_value default value (`ThrowException`): throw exception on error.
3733 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3734 * At least the following PKCS #11 return values may be returned:
3735 * \li ArgumentsBad \li AttributeReadOnly \li AttributeTypeInvalid
3736 * \li AttributeValueInvalid \li CryptokiNotInitialized \li CurveNotSupported
3737 * \li DeviceError \li DeviceMemory \li DeviceRemoved
3738 * \li DomainParamsInvalid \li FunctionCanceled \li FunctionFailed
3739 * \li GeneralError \li HostMemory \li KeyHandleInvalid
3740 * \li KeySizeRange \li KeyTypeInconsistent \li MechanismInvalid
3741 * \li MechanismParamInvalid \li OK \li OperationActive
3742 * \li PinExpired \li SessionClosed \li SessionHandleInvalid
3743 * \li SessionReadOnly \li TemplateIncomplete \li TemplateInconsistent
3744 * \li TokenWriteProtected \li UserNotLoggedIn
3745 * @return true on success, false otherwise
3746 */
3747 bool C_DeriveKey(SessionHandle session,
3748 const Mechanism* mechanism_ptr,
3749 ObjectHandle base_key,
3750 Attribute* attribute_template_ptr,
3751 Ulong attribute_count,
3752 ObjectHandle* key_ptr,
3753 ReturnValue* return_value = ThrowException) const;
3754
3755 /**
3756 * C_WrapKeyAuthenticated wraps (i.e. encrypts) a private or secret key.
3757 *
3758 * @param session session's handle
3759 * @param mechanism_ptr wrapping mechanism
3760 * @param wrapping_key wrapping key
3761 * @param key key to be wrapped
3762 * @param associated_data_ptr associated data for an AEAD mechanism
3763 * @param associated_data_len length of the associated data
3764 * @param wrapped_key_ptr gets the wrapped key
3765 * @param wrapped_key_len_ptr gets the length of the wrapped key
3766 * @param return_value default value (`ThrowException`): throw exception on error
3767 * @return true on success, false otherwise
3768 */
3770 const Mechanism* mechanism_ptr,
3771 ObjectHandle wrapping_key,
3772 ObjectHandle key,
3773 const Byte* associated_data_ptr,
3774 Ulong associated_data_len,
3775 Byte* wrapped_key_ptr,
3776 Ulong* wrapped_key_len_ptr,
3777 ReturnValue* return_value = ThrowException) const;
3778
3779 /**
3780 * C_UnwrapKeyAuthenticated unwraps (i.e. decrypts) a wrapped key,
3781 * creating a new private key or secret key object.
3782 *
3783 * @param session session's handle
3784 * @param mechanism_ptr unwrapping mechanism
3785 * @param unwrapping_key unwrapping key
3786 * @param wrapped_key_ptr wrapped key
3787 * @param wrapped_key_len length of the wrapped key
3788 * @param attribute_template_ptr new key template
3789 * @param attribute_count template length
3790 * @param associated_data_ptr associated data for an AEAD mechanism
3791 * @param associated_data_len length of the associated data
3792 * @param key_ptr gets new key handle
3793 * @param return_value default value (`ThrowException`): throw exception on error
3794 * @return true on success, false otherwise
3795 */
3797 const Mechanism* mechanism_ptr,
3798 ObjectHandle unwrapping_key,
3799 const Byte* wrapped_key_ptr,
3800 Ulong wrapped_key_len,
3801 Attribute* attribute_template_ptr,
3802 Ulong attribute_count,
3803 const Byte* associated_data_ptr,
3804 Ulong associated_data_len,
3805 ObjectHandle* key_ptr,
3806 ReturnValue* return_value = ThrowException) const;
3807
3808 /**
3809 * C_EncapulateKey creates a new secret key object from a public key using a
3810 * KEM.
3811 *
3812 * @param session the session's handle
3813 * @param mechanism_ptr the encapsulation mechanism
3814 * @param public_key the encapsulating key
3815 * @param template_ptr new key template
3816 * @param attribute_count template length
3817 * @param ciphertext_ptr the wrapped key
3818 * @param ciphertext_len_ptr the wrapped key size
3819 * @param key_ptr the encapsulated key
3820 * @param return_value default value (`ThrowException`): throw exception on error
3821 * @return true on success, false otherwise
3822 */
3823 bool C_EncapsulateKey(SessionHandle session,
3824 const Mechanism* mechanism_ptr,
3825 ObjectHandle public_key,
3826 Attribute* template_ptr,
3827 Ulong attribute_count,
3828 Byte* ciphertext_ptr,
3829 Ulong* ciphertext_len_ptr,
3830 ObjectHandle* key_ptr,
3831 ReturnValue* return_value = ThrowException);
3832
3833 /**
3834 * C_DecapsulateKey creates a new secret key object based on the private key and
3835 * ciphertext generated by a prior encapsulate operation. This new key
3836 * (called a ‘shared key’ in most KEM documentation) is identical to the
3837 * key returned by C_EncapsulateKey when it was called with the matching public
3838 * key and returned the same cipher text. This function is a KEM style
3839 * function.
3840 *
3841 * @param session the session's handle
3842 * @param mechanism_ptr the decapsulation mechanism
3843 * @param private_key the decapsulating key
3844 * @param template_ptr new key template
3845 * @param attribute_count template length
3846 * @param ciphertext_ptr the wrapped key
3847 * @param ciphertext_len the wrapped key size
3848 * @param key_ptr the decapsulated key
3849 * @param return_value default value (`ThrowException`): throw exception on error
3850 * @return true on success, false otherwise
3851 */
3852 bool C_DecapsulateKey(SessionHandle session,
3853 const Mechanism* mechanism_ptr,
3854 ObjectHandle private_key,
3855 Attribute* template_ptr,
3856 Ulong attribute_count,
3857 const Byte* ciphertext_ptr,
3858 Ulong ciphertext_len,
3859 ObjectHandle* key_ptr,
3860 ReturnValue* return_value = ThrowException);
3861
3862 /****************************** Random number generation functions ******************************/
3863
3864 /**
3865 * C_SeedRandom mixes additional seed material into the token's random number generator.
3866 * @param session the session's handle
3867 * @param seed_ptr the seed material
3868 * @param seed_len length of seed material
3869 * @param return_value default value (`ThrowException`): throw exception on error.
3870 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3871 * At least the following PKCS #11 return values may be returned:
3872 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3873 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3874 * \li FunctionFailed \li GeneralError \li HostMemory
3875 * \li OK \li OperationActive \li RandomSeedNotSupported
3876 * \li RandomNoRng \li SessionClosed \li SessionHandleInvalid
3877 * \li UserNotLoggedIn
3878 * @return true on success, false otherwise
3879 */
3880 bool C_SeedRandom(SessionHandle session,
3881 const Byte* seed_ptr,
3882 Ulong seed_len,
3883 ReturnValue* return_value = ThrowException) const;
3884
3885 /**
3886 * C_GenerateRandom generates random data.
3887 * @param session the session's handle
3888 * @param random_data_ptr receives the random data
3889 * @param random_len # of bytes to generate
3890 * @param return_value default value (`ThrowException`): throw exception on error.
3891 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3892 * At least the following PKCS #11 return values may be returned:
3893 * \li ArgumentsBad \li CryptokiNotInitialized \li DeviceError
3894 * \li DeviceMemory \li DeviceRemoved \li FunctionCanceled
3895 * \li FunctionFailed \li GeneralError \li HostMemory
3896 * \li OK \li OperationActive \li RandomNoRng
3897 * \li SessionClosed \li SessionHandleInvalid \li UserNotLoggedIn
3898 * @return true on success, false otherwise
3899 */
3900 bool C_GenerateRandom(SessionHandle session,
3901 Byte* random_data_ptr,
3902 Ulong random_len,
3903 ReturnValue* return_value = ThrowException) const;
3904
3905 /****************************** Parallel function management functions ******************************/
3906
3907 /**
3908 * C_GetFunctionStatus is a legacy function; it obtains an updated status of a function running in parallel with an application.
3909 * @param session the session's handle
3910 * @param return_value default value (`ThrowException`): throw exception on error.
3911 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3912 * At least the following PKCS #11 return values may be returned:
3913 * \li CryptokiNotInitialized \li FunctionFailed \li FunctionNotParallel
3914 * \li GeneralError \li HostMemory \li SessionHandleInvalid
3915 * \li SessionClosed
3916 * @return true on success, false otherwise
3917 */
3918 bool C_GetFunctionStatus(SessionHandle session, ReturnValue* return_value = ThrowException) const;
3919
3920 /**
3921 * C_CancelFunction is a legacy function; it cancels a function running in parallel.
3922 * @param session the session's handle
3923 * @param return_value default value (`ThrowException`): throw exception on error.
3924 * if a non-NULL pointer is passed: return_value receives the return value of the PKCS #11 function and no exception is thrown.
3925 * At least the following PKCS #11 return values may be returned:
3926 * \li CryptokiNotInitialized \li FunctionFailed \li FunctionNotParallel
3927 * \li GeneralError \li HostMemory \li SessionHandleInvalid
3928 * \li SessionClosed
3929 * @return true on success, false otherwise
3930 */
3931 bool C_CancelFunction(SessionHandle session, ReturnValue* return_value = ThrowException) const;
3932
3933 /******************* Asynchronous function management functions *******************/
3934
3935 /**
3936 * C_AsyncComplete checks if the function identified by function_name_ptr has
3937 * completed an asynchronous operation and, if so, returns the associated
3938 * result(s).
3939 *
3940 * @param session the session's handle
3941 * @param function_name_ptr pkcs11 function name
3942 * @param result_ptr operation result
3943 * @param return_value default value (`ThrowException`): throw exception on error
3944 * @return true on success, false otherwise
3945 */
3946 bool C_AsyncComplete(SessionHandle session,
3947 const Utf8Char* function_name_ptr,
3948 AsyncData* result_ptr,
3949 ReturnValue* return_value = ThrowException);
3950
3951 /**
3952 * C_AsyncGetID is used to persist an operation past a C_Finalize call and allow
3953 * another instance of the client to reconnect after a call to
3954 * C_Initialize. C_AsyncGetID places a module dependent identifier for
3955 * the asynchronous operation being performed by the function identified by
3956 * function_name_ptr.
3957 *
3958 * @param session the session's handle
3959 * @param function_name_ptr pkcs11 function name
3960 * @param id_ptr persistent operation id
3961 * @param return_value default value (`ThrowException`): throw exception on error
3962 * @return true on success, false otherwise
3963 */
3964 bool C_AsyncGetID(SessionHandle session,
3965 const Utf8Char* function_name_ptr,
3966 Ulong* id_ptr,
3967 ReturnValue* return_value = ThrowException);
3968
3969 /**
3970 * C_AsyncJoin checks if the function identified by function_name_ptr and id is a
3971 * valid asynchronous operation and, if so, reconnects the client application to
3972 * the module using the buffer specified by data_ptr and data_len in place of those
3973 * passed into the original call to function_name_ptr.
3974 *
3975 * @param session the session's handle
3976 * @param function_name_ptr pkcs11 function name
3977 * @param id persistent operation id
3978 * @param data_ptr location for the data
3979 * @param data_len data length
3980 * @param return_value default value (`ThrowException`): throw exception on error
3981 * @return true on success, false otherwise
3982 */
3983 bool C_AsyncJoin(SessionHandle session,
3984 const Utf8Char* function_name_ptr,
3985 Ulong id,
3986 Byte* data_ptr,
3987 Ulong data_len,
3988 ReturnValue* return_value = ThrowException);
3989
3990 /**
3991 * Return the PKCS11 function list that this LowLevel class contains.
3992 *
3993 * This is primarily useful when invoking vendor specific extension
3994 * functions which are not supported directly by LowLevel or the higher
3995 * level PKCS11 API.
3996 */
3997 BOTAN_DEPRECATED("Use get_interface().func_2_40()") FunctionList* get_functions() const;
3998
3999 const InterfaceWrapper& get_interface() { return m_interface_wrapper; }
4000
4001 protected:
4002 /**
4003 * it is possible for an application to inherit from LowLevel in order to
4004 * implement wrappers for vendor specific extensions using the same error
4005 * handling mechanisms as the rest of the library.
4006 */
4007 static bool handle_return_value(CK_RV function_result, ReturnValue* return_value);
4008
4009 private:
4010 InterfaceWrapper m_interface_wrapper;
4011};
4012
4014 public:
4015 explicit PKCS11_Error(std::string_view what) : Exception("PKCS11 error", what) {}
4016
4017 ErrorType error_type() const noexcept override { return ErrorType::Pkcs11Error; }
4018};
4019
4021 public:
4022 explicit PKCS11_ReturnError(ReturnValue return_val);
4023
4024 inline ReturnValue get_return_value() const { return m_return_val; }
4025
4026 int error_code() const noexcept override { return static_cast<int>(m_return_val); }
4027
4028 private:
4029 const ReturnValue m_return_val;
4030};
4031
4032} // namespace PKCS11
4033
4034} // namespace Botan
4035
4036#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:1275
InterfaceWrapper(const InterfaceWrapper &)=default
InterfaceWrapper & operator=(const InterfaceWrapper &)=default
InterfaceWrapper & operator=(InterfaceWrapper &&)=default
InterfaceWrapper(Interface raw_interface)
Basic constructor using an interface.
const Interface & raw_interface() const
Access the underlying interface object.
Definition p11.h:1290
InterfaceWrapper(InterfaceWrapper &&)=default
bool C_InitPIN(SessionHandle session, const std::vector< uint8_t, TAlloc > &pin, ReturnValue *return_value=ThrowException) const
Definition p11.h:1690
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:2190
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:2900
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:1741
bool C_SignUpdate(SessionHandle session, const std::vector< uint8_t, TAlloc > &part, ReturnValue *return_value=ThrowException) const
Definition p11.h:2957
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:1637
bool C_Login(SessionHandle session, UserType user_type, const std::vector< uint8_t, TAlloc > &pin, ReturnValue *return_value=ThrowException) const
Definition p11.h:1921
LowLevel(FunctionList *ptr)
Definition p11.cpp:64
const InterfaceWrapper & get_interface()
Definition p11.h:3999
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:2331
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:3221
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:2564
bool C_VerifyUpdate(SessionHandle session, std::vector< uint8_t, TAlloc > part, ReturnValue *return_value=ThrowException) const
Definition p11.h:3268
bool C_SignFinal(SessionHandle session, std::vector< uint8_t, TAlloc > &signature, ReturnValue *return_value=ThrowException) const
Definition p11.h:3000
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:2112
ErrorType error_type() const noexcept override
Definition p11.h:4017
PKCS11_Error(std::string_view what)
Definition p11.h:4015
int error_code() const noexcept override
Definition p11.h:4026
ReturnValue get_return_value() const
Definition p11.h:4024
PKCS11_ReturnError(ReturnValue return_val)
MlDsaParameterSet
Definition p11.h:1008
CK_SLOT_ID SlotId
Definition p11.h:1202
CK_RSA_PKCS_OAEP_PARAMS RsaPkcsOaepParams
Definition p11.h:1215
CK_DESTROYMUTEX DestroyMutex
Definition p11.h:1195
ReturnValue * ThrowException
Definition p11.cpp:21
CK_CREATEMUTEX CreateMutex
Definition p11.h:1194
PublicPointEncoding
Definition p11.h:1183
MlKemParameterSet
Definition p11.h:1029
JavaMidpSecurityDomain
Definition p11.h:252
secure_vector< uint8_t > secure_string
Definition p11.h:45
CK_FUNCTION_LIST FunctionList
Definition p11.h:1187
AttributeType
Definition p11.h:49
CK_C_INITIALIZE_ARGS C_InitializeArgs
Definition p11.h:1193
CK_MECHANISM Mechanism
Definition p11.h:1206
CK_NOTIFY Notify
Definition p11.h:1209
CertificateType
Definition p11.h:212
void change_pin(Slot &slot, const secure_string &old_pin, const secure_string &new_pin)
Definition p11.cpp:46
SlhDsaParameterSet
Definition p11.h:1014
CK_ECDH1_DERIVE_PARAMS Ecdh1DeriveParams
Definition p11.h:1217
CK_OBJECT_HANDLE ObjectHandle
Definition p11.h:1213
void change_so_pin(Slot &slot, const secure_string &old_so_pin, const secure_string &new_so_pin)
Definition p11.cpp:52
GeneratorFunction
Definition p11.h:382
CK_UNLOCKMUTEX UnlockMutex
Definition p11.h:1197
CK_ATTRIBUTE Attribute
Definition p11.h:1212
@ LibraryCantCreateOsThreads
Definition p11.h:363
@ AsyncSessionSupported
Definition p11.h:326
@ ProtectedAuthenticationPath
Definition p11.h:312
@ SecondaryAuthentication
Definition p11.h:315
Sp800_108DkmLengthMethod
Definition p11.h:267
CK_VERSION Version
Definition p11.h:1200
CK_FUNCTION_LIST_PTR FunctionListPtr
Definition p11.h:1188
CK_BYTE Byte
Definition p11.h:1214
CK_INFO Info
Definition p11.h:1199
CK_SLOT_INFO SlotInfo
Definition p11.h:1204
CK_INTERFACE Interface
Definition p11.h:1191
CK_VOID_PTR VoidPtr
Definition p11.h:1192
CK_FLAGS Flags
Definition p11.h:1198
CK_FUNCTION_LIST_3_0 FunctionList30
Definition p11.h:1189
Flag operator|(Flag a, Flag b)
Definition p11.h:377
CK_DATE Date
Definition p11.h:1218
CK_SESSION_INFO SessionInfo
Definition p11.h:1211
CK_TOKEN_INFO TokenInfo
Definition p11.h:1205
const Bbool True
Definition p11.h:1224
CK_ASYNC_DATA AsyncData
Definition p11.h:1219
CK_UTF8CHAR Utf8Char
Definition p11.h:1208
ValidationAuthorityType
Definition p11.h:1169
CK_FUNCTION_LIST_3_2 FunctionList32
Definition p11.h:1190
CK_ULONG Ulong
Definition p11.h:1203
CK_RSA_PKCS_PSS_PARAMS RsaPkcsPssParams
Definition p11.h:1216
const Bbool False
Definition p11.h:1225
OtpChallengeRequirement
Definition p11.h:246
CertificateCategory
Definition p11.h:221
CK_BBOOL Bbool
Definition p11.h:1201
void set_pin(Slot &slot, const secure_string &so_pin, const secure_string &pin)
Definition p11.cpp:58
SessionValidationFlagsType
Definition p11.h:1043
CK_MECHANISM_INFO MechanismInfo
Definition p11.h:1207
Flags flags(Flag flags)
Definition p11.h:1227
void initialize_token(Slot &slot, std::string_view label, const secure_string &so_pin, const secure_string &pin)
Definition p11.cpp:41
CK_LOCKMUTEX LockMutex
Definition p11.h:1196
CK_SESSION_HANDLE SessionHandle
Definition p11.h:1210
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:68
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