private bool IsSafeTransform(string transformAlgorithm)
        {
            // All canonicalization algorithms are valid transform algorithms.
            foreach (string safeAlgorithm in SafeCanonicalizationMethods)
            {
                if (string.Equals(safeAlgorithm, transformAlgorithm, StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
            }

            foreach (string safeAlgorithm in DefaultSafeTransformMethods)
            {
                if (string.Equals(safeAlgorithm, transformAlgorithm, StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
            }

            SignedXmlDebugLog.LogUnsafeTransformMethod(
                this,
                transformAlgorithm,
                SafeCanonicalizationMethods,
                DefaultSafeTransformMethods);

            return(false);
        }
Пример #2
0
        private static bool IsSafeTransform(NS transformAlgorithm, SignedXml signedXml)
        {
            foreach (string safeAlgorithm in signedXml.SafeCanonicalizationMethods)
            {
                if (string.Equals(safeAlgorithm, XmlNameSpace.Url[transformAlgorithm], StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
            }

            foreach (string safeAlgorithm in DefaultSafeTransformMethods(SignedXml.s_defaultSafeTransformMethods))
            {
                if (string.Equals(safeAlgorithm, XmlNameSpace.Url[transformAlgorithm], StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
            }

            SignedXmlDebugLog.LogUnsafeTransformMethod(
                signedXml,
                XmlNameSpace.Url[transformAlgorithm],
                signedXml.SafeCanonicalizationMethods,
                DefaultSafeTransformMethods(SignedXml.s_defaultSafeTransformMethods));

            return(false);
        }