Net.Pkcs11Interop.HighLevelAPI80.Pkcs11.Pkcs11 C# (CSharp) Method

Pkcs11() public method

Loads and initializes PCKS#11 library
public Pkcs11 ( string libraryPath, bool useOsLocking, bool useGetFunctionList ) : System
libraryPath string Library name or path
useOsLocking bool Flag indicating whether PKCS#11 library can use the native operation system threading model for locking. Should be set to true in all multithreaded applications.
useGetFunctionList bool Flag indicating whether cryptoki function pointers should be acquired via C_GetFunctionList (true) or via platform native function (false)
return System
        public Pkcs11(string libraryPath, bool useOsLocking, bool useGetFunctionList)
        {
            _p11 = new LowLevelAPI80.Pkcs11(libraryPath, useGetFunctionList);

            try
            {
                CK_C_INITIALIZE_ARGS initArgs = null;
                if (useOsLocking)
                {
                    initArgs = new CK_C_INITIALIZE_ARGS();
                    initArgs.Flags = CKF.CKF_OS_LOCKING_OK;
                }

                CKR rv = _p11.C_Initialize(initArgs);
                if ((rv != CKR.CKR_OK) && (rv != CKR.CKR_CRYPTOKI_ALREADY_INITIALIZED))
                    throw new Pkcs11Exception("C_Initialize", rv);
            }
            catch
            {
                _p11.Dispose();
                _p11 = null;
                throw;
            }
        }

Same methods

Pkcs11::Pkcs11 ( string libraryPath, bool useOsLocking ) : System