Пример #1
0
 /// <summary>
 /// Creates mechanism of given type with byte array parameter
 /// </summary>
 /// <param name="type">Mechanism type</param>
 /// <param name="parameter">Mechanism parameter</param>
 public Mechanism(CKM type, byte[] parameter)
 {
     if (Platform.UnmanagedLongSize == 4)
     {
         if (Platform.StructPackingSize == 0)
         {
             _mechanism40 = new HighLevelAPI40.Mechanism(Convert.ToUInt32(type), parameter);
         }
         else
         {
             _mechanism41 = new HighLevelAPI41.Mechanism(Convert.ToUInt32(type), parameter);
         }
     }
     else
     {
         if (Platform.StructPackingSize == 0)
         {
             _mechanism80 = new HighLevelAPI80.Mechanism(type, parameter);
         }
         else
         {
             _mechanism81 = new HighLevelAPI81.Mechanism(type, parameter);
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Creates mechanism of given type with object parameter
        /// </summary>
        /// <param name="type">Mechanism type</param>
        /// <param name="parameter">Mechanism parameter</param>
        public Mechanism(CKM type, IMechanismParams parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException("parameter");
            }

            if (Platform.UnmanagedLongSize == 4)
            {
                if (Platform.StructPackingSize == 0)
                {
                    _mechanism40 = new HighLevelAPI40.Mechanism(Convert.ToUInt32(type), parameter);
                }
                else
                {
                    _mechanism41 = new HighLevelAPI41.Mechanism(Convert.ToUInt32(type), parameter);
                }
            }
            else
            {
                if (Platform.StructPackingSize == 0)
                {
                    _mechanism80 = new HighLevelAPI80.Mechanism(type, parameter);
                }
                else
                {
                    _mechanism81 = new HighLevelAPI81.Mechanism(type, parameter);
                }
            }
        }
Пример #3
0
 /// <summary>
 /// Creates mechanism of given type with no parameter
 /// </summary>
 /// <param name="type">Mechanism type</param>
 public Mechanism(ulong type)
 {
     if (Platform.UnmanagedLongSize == 4)
     {
         if (Platform.StructPackingSize == 0)
         {
             _mechanism40 = new HighLevelAPI40.Mechanism(Convert.ToUInt32(type));
         }
         else
         {
             _mechanism41 = new HighLevelAPI41.Mechanism(Convert.ToUInt32(type));
         }
     }
     else
     {
         if (Platform.StructPackingSize == 0)
         {
             _mechanism80 = new HighLevelAPI80.Mechanism(type);
         }
         else
         {
             _mechanism81 = new HighLevelAPI81.Mechanism(type);
         }
     }
 }
Пример #4
0
        /// <summary>
        /// Converts platform specific Mechanism to platfrom neutral Mechanism
        /// </summary>
        /// <param name="mechanism">Platform specific Mechanism</param>
        internal Mechanism(HighLevelAPI81.Mechanism mechanism)
        {
            if (mechanism == null)
            {
                throw new ArgumentNullException("mechanism");
            }

            _mechanism81 = mechanism;
        }
Пример #5
0
        /// <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 (_mechanism40 != null)
                    {
                        _mechanism40.Dispose();
                        _mechanism40 = null;
                    }

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

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

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

                // Dispose unmanaged objects

                _disposed = true;
            }
        }
Пример #6
0
        /// <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 (_mechanism40 != null)
                    {
                        _mechanism40.Dispose();
                        _mechanism40 = null;
                    }

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

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

                    if (_mechanism81 != null)
                    {
                        _mechanism81.Dispose();
                        _mechanism81 = null;
                    }
                }
                
                // Dispose unmanaged objects

                _disposed = true;
            }
        }
Пример #7
0
        /// <summary>
        /// Creates mechanism of given type with object parameter
        /// </summary>
        /// <param name="type">Mechanism type</param>
        /// <param name="parameter">Mechanism parameter</param>
        public Mechanism(CKM type, IMechanismParams parameter)
        {
            if (parameter == null)
                throw new ArgumentNullException("parameter");

            if (Platform.UnmanagedLongSize == 4)
            {
                if (Platform.StructPackingSize == 0)
                    _mechanism40 = new HighLevelAPI40.Mechanism(Convert.ToUInt32(type), parameter);
                else
                    _mechanism41 = new HighLevelAPI41.Mechanism(Convert.ToUInt32(type), parameter);
            }
            else
            {
                if (Platform.StructPackingSize == 0)
                    _mechanism80 = new HighLevelAPI80.Mechanism(type, parameter);
                else
                    _mechanism81 = new HighLevelAPI81.Mechanism(type, parameter);
            }
        }
Пример #8
0
 /// <summary>
 /// Creates mechanism of given type with byte array parameter
 /// </summary>
 /// <param name="type">Mechanism type</param>
 /// <param name="parameter">Mechanism parameter</param>
 public Mechanism(CKM type, byte[] parameter)
 {
     if (Platform.UnmanagedLongSize == 4)
     {
         if (Platform.StructPackingSize == 0)
             _mechanism40 = new HighLevelAPI40.Mechanism(Convert.ToUInt32(type), parameter);
         else
             _mechanism41 = new HighLevelAPI41.Mechanism(Convert.ToUInt32(type), parameter);
     }
     else
     {
         if (Platform.StructPackingSize == 0)
             _mechanism80 = new HighLevelAPI80.Mechanism(type, parameter);
         else
             _mechanism81 = new HighLevelAPI81.Mechanism(type, parameter);
     }
 }
Пример #9
0
 /// <summary>
 /// Creates mechanism of given type with no parameter
 /// </summary>
 /// <param name="type">Mechanism type</param>
 public Mechanism(ulong type)
 {
     if (Platform.UnmanagedLongSize == 4)
     {
         if (Platform.StructPackingSize == 0)
             _mechanism40 = new HighLevelAPI40.Mechanism(Convert.ToUInt32(type));
         else
             _mechanism41 = new HighLevelAPI41.Mechanism(Convert.ToUInt32(type));
     }
     else
     {
         if (Platform.StructPackingSize == 0)
             _mechanism80 = new HighLevelAPI80.Mechanism(type);
         else
             _mechanism81 = new HighLevelAPI81.Mechanism(type);
     }
 }
Пример #10
0
        /// <summary>
        /// Converts platform specific Mechanism to platfrom neutral Mechanism
        /// </summary>
        /// <param name="mechanism">Platform specific Mechanism</param>
        internal Mechanism(HighLevelAPI81.Mechanism mechanism)
        {
            if (mechanism == null)
                throw new ArgumentNullException("mechanism");

            _mechanism81 = mechanism;
        }