index.rst (3033B)
1 .. _mozilla_projects_nss_reference_fc_getinfo: 2 3 FC_GetInfo 4 ========== 5 6 `Name <#name>`__ 7 ~~~~~~~~~~~~~~~~ 8 9 .. container:: 10 11 FC_GetInfo - return general information about the PKCS #11 library. 12 13 `Syntax <#syntax>`__ 14 ~~~~~~~~~~~~~~~~~~~~ 15 16 .. container:: 17 18 .. code:: 19 20 CK_RV FC_GetInfo(CK_INFO_PTR pInfo); 21 22 `Parameters <#parameters>`__ 23 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 24 25 .. container:: 26 27 ``FC_GetInfo`` has one parameter: 28 29 ``pInfo`` 30 points to a `CK_INFO </en-US/CK_INFO>`__ structure 31 32 `Description <#description>`__ 33 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 34 35 .. container:: 36 37 ``FC_GetInfo`` returns general information about the PKCS #11 library. On return, the ``CK_INFO`` 38 structure that ``pInfo`` points to has the following information: 39 40 - ``cryptokiVersion``: PKCS #11 interface version number implemented by the PKCS #11 library. 41 The version is 2.20 (``major=0x02, minor=0x14``). 42 - ``manufacturerID``: the PKCS #11 library manufacturer, "Mozilla Foundation", padded with 43 spaces to 32 characters and not null-terminated. 44 - ``flags``: should be 0. 45 - ``libraryDescription``: description of the library, "NSS Internal Crypto Services", padded 46 with spaces to 32 characters and not null-terminated. 47 - ``libraryVersion``: PKCS #11 library version number, for example, 3.11 48 (``major=0x03, minor=0x0b``). 49 50 A user may call ``FC_GetInfo`` without logging into the token (to assume the NSS User role). 51 52 .. _return_value: 53 54 `Return value <#return_value>`__ 55 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 57 .. container:: 58 59 ``FC_GetInfo`` always returns ``CKR_OK``. 60 61 .. note:: 62 63 ``FC_GetInfo`` should return ``CKR_ARGUMENTS_BAD`` if ``pInfo`` is ``NULL``. 64 65 ``FC_GetInfo`` should return ``CKR_CRYPTOKI_NOT_INITIALIZED`` if the library is not 66 initialized. 67 68 `Examples <#examples>`__ 69 ~~~~~~~~~~~~~~~~~~~~~~~~ 70 71 .. container:: 72 73 Note the use of the ``%.32s`` format string to print the ``manufacturerID`` and 74 ``libraryDescription`` members of the ``CK_INFO`` structure. 75 76 .. code:: 77 78 #include <assert.h> 79 #include <stdio.h> 80 81 CK_FUNCTION_LIST_PTR pFunctionList; 82 CK_RV crv; 83 CK_INFO info; 84 85 crv = FC_GetFunctionList(&pFunctionList); 86 assert(crv == CKR_OK); 87 88 ... 89 90 /* invoke FC_GetInfo as pFunctionList->C_GetInfo */ 91 crv = pFunctionList->C_GetInfo(&info); 92 assert(crv == CKR_OK); 93 printf("General information about the PKCS #11 library:\n"); 94 printf(" PKCS #11 version: %d.%d\n", 95 (int)info.cryptokiVersion.major, (int)info.cryptokiVersion.minor); 96 printf(" manufacturer ID: %.32s\n", info.manufacturerID); 97 printf(" flags: 0x%08lx\n", info.flags); 98 printf(" library description: %.32s\n", info.libraryDescription); 99 printf(" library version: %d.%d\n", 100 (int)info.libraryVersion.major, (int)info.libraryVersion.minor); 101 printf("\n"); 102 103 .. _see_also: 104 105 `See also <#see_also>`__ 106 ~~~~~~~~~~~~~~~~~~~~~~~~ 107 108 .. container:: 109 110 - `NSC_GetInfo </en-US/NSC_GetInfo>`__