Example #1
0
        private bool CheckDigestedReferences()
        {
            ArrayList references = m_signature.SignedInfo.References;

            for (int i = 0; i < references.Count; ++i)
            {
                Reference digestedReference = (Reference)references[i];

                if (!ReferenceUsesSafeTransformMethods(digestedReference))
                {
                    return(false);
                }

                SignedXmlDebugLog.LogVerifyReference(this, digestedReference);
                byte[] calculatedHash = null;
                try
                {
                    calculatedHash = digestedReference.CalculateHashValue(_containingDocument, m_signature.ReferencedItems);
                }
                catch (CryptoSignedXmlRecursionException)
                {
                    SignedXmlDebugLog.LogSignedXmlRecursionLimit(this, digestedReference);
                    return(false);
                }
                // Compare both hashes
                SignedXmlDebugLog.LogVerifyReferenceHash(this, digestedReference, calculatedHash, digestedReference.DigestValue);

                if (!CryptographicEquals(calculatedHash, digestedReference.DigestValue))
                {
                    return(false);
                }
            }

            return(true);
        }
        private bool CheckDigestedReferences()
        {
            ArrayList references = this.m_signature.SignedInfo.References;

            for (int i = 0; i < references.Count; i++)
            {
                Reference reference = (Reference)references[i];
                SignedXmlDebugLog.LogVerifyReference(this, reference);
                byte[] actualHash = reference.CalculateHashValue(this.m_containingDocument, this.m_signature.ReferencedItems);
                SignedXmlDebugLog.LogVerifyReferenceHash(this, reference, actualHash, reference.DigestValue);
                if (actualHash.Length != reference.DigestValue.Length)
                {
                    return(false);
                }
                byte[] buffer2     = actualHash;
                byte[] digestValue = reference.DigestValue;
                for (int j = 0; j < buffer2.Length; j++)
                {
                    if (buffer2[j] != digestValue[j])
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #3
0
        private bool CheckDigestedReferences()
        {
            ArrayList references = m_signature.SignedInfo.References;

            for (int i = 0; i < references.Count; ++i)
            {
                Reference digestedReference = (Reference)references[i];

                SignedXmlDebugLog.LogVerifyReference(this, digestedReference);
                byte[] calculatedHash = digestedReference.CalculateHashValue(m_containingDocument, m_signature.ReferencedItems);

                // Compare both hashes
                SignedXmlDebugLog.LogVerifyReferenceHash(this, digestedReference, calculatedHash, digestedReference.DigestValue);
                if (calculatedHash.Length != digestedReference.DigestValue.Length)
                {
                    return(false);
                }

                byte[] rgb1 = calculatedHash;
                byte[] rgb2 = digestedReference.DigestValue;
                for (int j = 0; j < rgb1.Length; ++j)
                {
                    if (rgb1[j] != rgb2[j])
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }