System.Security.Cryptography.AsymmetricSignatureDeformatter.VerifySignature C# (CSharp) Метод

VerifySignature() публичный Метод

public VerifySignature ( HashAlgorithm hash, byte rgbSignature ) : bool
hash HashAlgorithm
rgbSignature byte
Результат bool
		public virtual bool VerifySignature (HashAlgorithm hash, byte[] rgbSignature) 
		{
			if (hash == null)
				throw new ArgumentNullException ("hash");

			SetHashAlgorithm (hash.ToString ());

			return VerifySignature (hash.Hash, rgbSignature);
		}
	}

Same methods

AsymmetricSignatureDeformatter::VerifySignature ( byte rgbHash, byte rgbSignature ) : bool

Usage Example

Пример #1
0
        void VerifySignature(HashAlgorithm hash, AsymmetricSignatureDeformatter deformatter, string signatureMethod)
        {
            this.Signature.SignedInfo.ComputeHash(hash);
            bool result;

            if (SecurityUtils.RequiresFipsCompliance && signatureMethod == SecurityAlgorithms.RsaSha256Signature)
            {
                // This is to avoid the RSAPKCS1SignatureFormatter.VerifySignature from using SHA256Managed (non-FIPS-Compliant).
                // Hence we precompute the hash using SHA256CSP (FIPS compliant) and pass it to method.
                // NOTE: RSAPKCS1SignatureFormatter does not understand SHA256CSP inherently and hence this workaround. 
                deformatter.SetHashAlgorithm("SHA256");
                result = deformatter.VerifySignature(hash.Hash, GetSignatureValue());
            }
            else
            {
                result = deformatter.VerifySignature(hash, GetSignatureValue());
            }

            if (!result)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CryptographicException(SR.GetString(SR.SignatureVerificationFailed)));
            }
        }
All Usage Examples Of System.Security.Cryptography.AsymmetricSignatureDeformatter::VerifySignature