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

Pkcs11() public method

Loads and initializes PCKS#11 library
public Pkcs11 ( string libraryPath, bool useOsLocking ) : 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.
return System
        public Pkcs11(string libraryPath, bool useOsLocking)
        {
            _p11 = new LowLevelAPI80.Pkcs11(libraryPath);

            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, bool useGetFunctionList ) : System