Example #1
0
        /// <summary>
        /// Initializes a new instance of the CkOtpSignatureInfo class.
        /// </summary>
        /// <param name='signature'>Signature value returned by all OTP mechanisms in successful calls to Sign method</param>
        public CkOtpSignatureInfo(byte[] signature)
        {
            if (Platform.UnmanagedLongSize == 4)
            {
                if (Platform.StructPackingSize == 0)
                {
                    _params40 = new HighLevelAPI40.MechanismParams.CkOtpSignatureInfo(signature);

                    IList <HighLevelAPI40.MechanismParams.CkOtpParam> hlaParams = _params40.Params;
                    for (int i = 0; i < hlaParams.Count; i++)
                    {
                        _params.Add(new CkOtpParam(hlaParams[i]));
                    }
                }
                else
                {
                    _params41 = new HighLevelAPI41.MechanismParams.CkOtpSignatureInfo(signature);

                    IList <HighLevelAPI41.MechanismParams.CkOtpParam> hlaParams = _params41.Params;
                    for (int i = 0; i < hlaParams.Count; i++)
                    {
                        _params.Add(new CkOtpParam(hlaParams[i]));
                    }
                }
            }
            else
            {
                if (Platform.StructPackingSize == 0)
                {
                    _params80 = new HighLevelAPI80.MechanismParams.CkOtpSignatureInfo(signature);

                    IList <HighLevelAPI80.MechanismParams.CkOtpParam> hlaParams = _params80.Params;
                    for (int i = 0; i < hlaParams.Count; i++)
                    {
                        _params.Add(new CkOtpParam(hlaParams[i]));
                    }
                }
                else
                {
                    _params81 = new HighLevelAPI81.MechanismParams.CkOtpSignatureInfo(signature);

                    IList <HighLevelAPI81.MechanismParams.CkOtpParam> hlaParams = _params81.Params;
                    for (int i = 0; i < hlaParams.Count; i++)
                    {
                        _params.Add(new CkOtpParam(hlaParams[i]));
                    }
                }
            }
        }
Example #2
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 (_params40 != null)
                    {
                        _params40.Dispose();
                        _params40 = null;
                    }

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

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

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

                    if (_paramsLeftInstance == false)
                    {
                        for (int i = 0; i < _params.Count; i++)
                        {
                            if (_params[i] != null)
                            {
                                _params[i].Dispose();
                                _params[i] = null;
                            }
                        }
                    }
                }

                // Dispose unmanaged objects

                _disposed = true;
            }
        }
        /// <summary>
        /// Initializes a new instance of the CkOtpSignatureInfo class.
        /// </summary>
        /// <param name='signature'>Signature value returned by all OTP mechanisms in successful calls to Sign method</param>
        public CkOtpSignatureInfo(byte[] signature)
        {
            if (Platform.UnmanagedLongSize == 4)
            {
                if (Platform.StructPackingSize == 0)
                {
                    _params40 = new HighLevelAPI40.MechanismParams.CkOtpSignatureInfo(signature);

                    IList<HighLevelAPI40.MechanismParams.CkOtpParam> hlaParams = _params40.Params;
                    for (int i = 0; i < hlaParams.Count; i++)
                        _params.Add(new CkOtpParam(hlaParams[i]));
                }
                else
                {
                    _params41 = new HighLevelAPI41.MechanismParams.CkOtpSignatureInfo(signature);

                    IList<HighLevelAPI41.MechanismParams.CkOtpParam> hlaParams = _params41.Params;
                    for (int i = 0; i < hlaParams.Count; i++)
                        _params.Add(new CkOtpParam(hlaParams[i]));
                }
            }
            else
            {
                if (Platform.StructPackingSize == 0)
                {
                    _params80 = new HighLevelAPI80.MechanismParams.CkOtpSignatureInfo(signature);

                    IList<HighLevelAPI80.MechanismParams.CkOtpParam> hlaParams = _params80.Params;
                    for (int i = 0; i < hlaParams.Count; i++)
                        _params.Add(new CkOtpParam(hlaParams[i]));
                }
                else
                {
                    _params81 = new HighLevelAPI81.MechanismParams.CkOtpSignatureInfo(signature);

                    IList<HighLevelAPI81.MechanismParams.CkOtpParam> hlaParams = _params81.Params;
                    for (int i = 0; i < hlaParams.Count; i++)
                        _params.Add(new CkOtpParam(hlaParams[i]));
                }
            }
        }
        /// <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 (_params40 != null)
                    {
                        _params40.Dispose();
                        _params40 = null;
                    }

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

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

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

                    if (_paramsLeftInstance == false)
                    {
                        for (int i = 0; i < _params.Count; i++)
                        {
                            if (_params[i] != null)
                            {
                                _params[i].Dispose();
                                _params[i] = null;
                            }
                        }
                    }
                }
                
                // Dispose unmanaged objects

                _disposed = true;
            }
        }