/// <summary>
        /// Verifies the specified signature data by comparing it to the signature computed for the specified hash value.
        /// </summary>
        /// <param name="rgbHash">The hash value of the data to be signed.</param>
        /// <param name="hashAlgorithm">The hash algorithm used to create the hash value of the data.</param>
        /// <param name="rgbSignature">The signature data to be verified.</param>
        /// <returns>true if the signature verifies as valid; otherwise, false.</returns>
        public bool VerifyHash(byte[] rgbHash, MechanismType hashAlgorithm, byte[] rgbSignature) 
        {
            if (rgbHash == null || rgbSignature == null)
                throw new ArgumentNullException();
            if (rgbHash.Length == 0)
                throw new CryptographicException();

            bool isValid = false;

            m_signatureMech.Parameter = Utility.ConvertToBytes((int)(hashAlgorithm | MechanismType.SIGN_NO_NODIGEST_FLAG));

            using (CryptokiVerify ver = new CryptokiVerify(m_session, m_signatureMech, KeyPair))
            {
                isValid = ver.Verify(rgbHash, 0, rgbHash.Length, rgbSignature, 0, rgbSignature.Length);
            }

            return isValid;
        }
        /// <summary>
        /// Verifies that a digital signature is valid by determining the hash value in the signature using the provided public key and comparing it to the hash value of the provided data.
        /// </summary>
        /// <param name="buffer">The data that was signed.</param>
        /// <param name="halg">The hash algorithm used to create the hash value of the data.</param>
        /// <param name="signature">The signature data to be verified.</param>
        /// <returns>true if the signature is valid; otherwise, false.</returns>
        public bool VerifyData(byte[] buffer, HashAlgorithm halg, byte[] signature) 
        {
            bool retVal;

            if (halg != null)
            {
                //return VerifyHash(halg.ComputeHash(buffer), signature);
                m_signHashMech.Parameter = Utility.ConvertToBytes((int)halg.HashType);
            }
            else
            {
                m_signHashMech.Parameter = Utility.ConvertToBytes((int)m_hashMech);
            }

            using (CryptokiVerify ver = new CryptokiVerify(m_session, m_signHashMech, KeyPair))
            {
                retVal = ver.Verify(buffer, 0, buffer.Length, signature, 0, signature.Length);
            }

            return retVal;
        }
        /// <summary>
        /// Verifies the specified signature data by comparing it to the signature computed for the specified data.
        /// </summary>
        /// <param name="rgbData">The data that was signed.</param>
        /// <param name="rgbSignature">The signature data to be verified.</param>
        /// <returns>true if the signature verifies as valid; otherwise, false.</returns>
        public bool VerifyData(byte[] rgbData, byte[] rgbSignature) 
        {
            if (rgbData == null || rgbSignature == null) throw new ArgumentNullException();

            bool isValid = false;

            m_signatureMech.Parameter = Utility.ConvertToBytes((int)m_hashAlgorithm);

            using (CryptokiVerify ver = new CryptokiVerify(m_session, m_signatureMech, KeyPair))
            {
                isValid = ver.Verify(rgbData, 0, rgbData.Length, rgbSignature, 0, rgbSignature.Length);
            }

            return isValid;
        }
        /// <summary>
        /// Verifies the digital signature of the specified data. 
        /// </summary>
        /// <param name="data">The data that was signed.</param>
        /// <param name="offset">The offset index in the message data to start verifying</param>
        /// <param name="count">The number of bytes from the offset to sign.</param>
        /// <param name="signature">The signature data to be verified.</param>
        /// <returns>true if the signature is valid; otherwise, false.</returns>
        public bool VerifyData(byte[] data, int offset, int count, byte[] signature)
        {
            if (data == null)
            {
                throw new ArgumentNullException();
            }
            if (offset < 0 || offset > data.Length)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (count < 0 || count > data.Length - offset)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (signature == null)
            {
                throw new ArgumentNullException();
            }

            bool isValid = false;

            m_signMech.Parameter = Utility.ConvertToBytes((int)m_hashAlgorithm);

            using (CryptokiVerify ver = new CryptokiVerify(m_session, m_signMech, KeyPair))
            {
                isValid = ver.Verify(data, offset, count, signature, 0, signature.Length);
            }

            return isValid;
        }