Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveDunn committed Sep 3, 2022
1 parent 67bd994 commit ccb6a3f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ private byte[] GetCipherValue(CipherData cipherData)
{
throw new CryptographicException(SR.Cryptography_Xml_UriNotSupported);
}
#pragma warning disable CS8604 // the check for _document == null above is never true, but because it's there, the analyzer thinks it can be null here too.
decInputStream = tc.TransformToOctetStream(_document, _xmlResolver, baseUri);
#pragma warning restore CS8604
}
else if (cipherData.CipherReference.Uri[0] == '#')
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ internal void UpdateHashValue(XmlDocument document, CanonicalXmlNodeList refList
// Normalize the containing document
resolver = (SignedXml!.ResolverSet ? SignedXml._xmlResolver : XmlResolverHelper.GetThrowingResolver());
XmlDocument docWithNoComments = Utils.DiscardComments(Utils.PreProcessDocumentInput(document, resolver!, baseUri));
hashInputStream = TransformChain.TransformToOctetStream(docWithNoComments, resolver!, baseUri);
hashInputStream = TransformChain.TransformToOctetStream(docWithNoComments, resolver, baseUri);
}
else if (_uri[0] == '#')
{
Expand All @@ -401,7 +401,7 @@ internal void UpdateHashValue(XmlDocument document, CanonicalXmlNodeList refList

// We should not discard comments here!!!
resolver = (SignedXml!.ResolverSet ? SignedXml._xmlResolver : XmlResolverHelper.GetThrowingResolver());
hashInputStream = TransformChain.TransformToOctetStream(Utils.PreProcessDocumentInput(document, resolver!, baseUri), resolver!, baseUri);
hashInputStream = TransformChain.TransformToOctetStream(Utils.PreProcessDocumentInput(document, resolver!, baseUri), resolver , baseUri);
break;
}

Expand Down Expand Up @@ -441,12 +441,12 @@ internal void UpdateHashValue(XmlDocument document, CanonicalXmlNodeList refList
{
// We should discard comments before going into the transform chain
XmlDocument docWithNoComments = Utils.DiscardComments(normDocument);
hashInputStream = TransformChain.TransformToOctetStream(docWithNoComments, resolver!, baseUri);
hashInputStream = TransformChain.TransformToOctetStream(docWithNoComments, resolver, baseUri);
}
else
{
// This is an XPointer reference, do not discard comments!!!
hashInputStream = TransformChain.TransformToOctetStream(normDocument, resolver!, baseUri);
hashInputStream = TransformChain.TransformToOctetStream(normDocument, resolver, baseUri);
}
}
else
Expand All @@ -457,7 +457,7 @@ internal void UpdateHashValue(XmlDocument document, CanonicalXmlNodeList refList
case ReferenceTargetType.XmlElement:
// We need to create a DocumentNavigator out of the XmlElement
resolver = (SignedXml!.ResolverSet ? SignedXml._xmlResolver : XmlResolverHelper.GetThrowingResolver());
hashInputStream = TransformChain.TransformToOctetStream(Utils.PreProcessElementInput((XmlElement)_refTarget!, resolver!, baseUri), resolver!, baseUri);
hashInputStream = TransformChain.TransformToOctetStream(Utils.PreProcessElementInput((XmlElement)_refTarget!, resolver!, baseUri), resolver , baseUri);
break;
default:
throw new CryptographicException(SR.Cryptography_Xml_UriNotResolved, _uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public Transform this[int index]
return TransformToOctetStream(input, typeof(Stream), resolver, baseUri);
}

internal Stream? TransformToOctetStream(XmlDocument document, XmlResolver? resolver, string baseUri)
internal Stream? TransformToOctetStream(XmlDocument? document, XmlResolver? resolver, string baseUri)
{
return TransformToOctetStream(document, typeof(XmlDocument), resolver, baseUri);
}
Expand Down

0 comments on commit ccb6a3f

Please sign in to comment.