@@ -4,11 +4,7 @@ Imports System.Security.Cryptography
44Imports System.Security.Cryptography.Xml
55Imports System.Xml
66
7-
8-
97Module VerifyXML
10-
11-
128 Sub Main( ByVal args() As String )
139 Try
1410 ' Create a new CspParameters object to specify
@@ -44,32 +40,27 @@ Module VerifyXML
4440 Catch e As Exception
4541 Console.WriteLine(e.Message)
4642 End Try
47-
4843 End Sub
4944
50-
51-
52-
53-
5445 ' Verify the signature of an XML file against an asymmetric
5546 ' algorithm and return the result.
56- Function VerifyXml( ByVal Doc As XmlDocument, ByVal Key As RSA) As [Boolean]
47+ Function VerifyXml( ByVal xmlDoc As XmlDocument, ByVal key As RSA) As [Boolean]
5748 ' Check arguments.
58- If Doc Is Nothing Then
59- Throw New ArgumentException( "Doc " )
49+ If xmlDoc Is Nothing Then
50+ Throw New ArgumentException( "xmlDoc " )
6051 End If
61- If Key Is Nothing Then
62- Throw New ArgumentException( "Key " )
52+ If key Is Nothing Then
53+ Throw New ArgumentException( "key " )
6354 End If
6455 ' Create a new SignedXml object and pass it
6556 ' the XML document class.
6657 ' <snippet5>
67- Dim signedXml As New SignedXml(Doc )
58+ Dim signedXml As New SignedXml(xmlDoc )
6859 ' </snippet5>
6960 ' Find the "Signature" node and create a new
7061 ' XmlNodeList object.
7162 ' <snippet6>
72- Dim nodeList As XmlNodeList = Doc .GetElementsByTagName("Signature" )
63+ Dim nodeList As XmlNodeList = xmlDoc .GetElementsByTagName("Signature" )
7364 ' </snippet6>
7465 ' Throw an exception if no signature was found.
7566 If nodeList.Count <= 0 Then
@@ -89,7 +80,7 @@ Module VerifyXML
8980 ' </snippet7>
9081 ' Check the signature and return the result.
9182 ' <snippet8>
92- Return signedXml.CheckSignature( Key )
83+ Return signedXml.CheckSignature( key )
9384 ' </snippet8>
9485 End Function
9586End Module
0 commit comments