コード例 #1
0
ファイル: Pkcs11.cs プロジェクト: Pkcs11Interop/Pkcs11Interop
        /// <summary>
        /// Disposes object
        /// </summary>
        /// <param name="disposing">Flag indicating whether managed resources should be disposed</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!this._disposed)
            {
                if (disposing)
                {
                    // Dispose managed objects
                    if (_p11_40 != null)
                    {
                        _p11_40.Dispose();
                        _p11_40 = null;
                    }

                    if (_p11_41 != null)
                    {
                        _p11_41.Dispose();
                        _p11_41 = null;
                    }

                    if (_p11_80 != null)
                    {
                        _p11_80.Dispose();
                        _p11_80 = null;
                    }

                    if (_p11_81 != null)
                    {
                        _p11_81.Dispose();
                        _p11_81 = null;
                    }
                }

                // Dispose unmanaged objects
                _disposed = true;
            }
        }
コード例 #2
0
ファイル: Pkcs11.cs プロジェクト: Pkcs11Interop/Pkcs11Interop
 /// <summary>
 /// Loads and initializes PCKS#11 library
 /// </summary>
 /// <param name="libraryPath">Library name or path</param>
 /// <param name="useOsLocking">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.</param>
 /// <param name="useGetFunctionList">Flag indicating whether cryptoki function pointers should be acquired via C_GetFunctionList (true) or via platform native function (false)</param>
 public Pkcs11(string libraryPath, bool useOsLocking, bool useGetFunctionList)
 {
     if (Platform.UnmanagedLongSize == 4)
     {
         if (Platform.StructPackingSize == 0)
             _p11_40 = new HighLevelAPI40.Pkcs11(libraryPath, useOsLocking, useGetFunctionList);
         else
             _p11_41 = new HighLevelAPI41.Pkcs11(libraryPath, useOsLocking, useGetFunctionList);
     }
     else
     {
         if (Platform.StructPackingSize == 0)
             _p11_80 = new HighLevelAPI80.Pkcs11(libraryPath, useOsLocking, useGetFunctionList);
         else
             _p11_81 = new HighLevelAPI81.Pkcs11(libraryPath, useOsLocking, useGetFunctionList);
     }
 }