本文整理汇总了VB.NET中System.Security.Cryptography.Xml.IRelDecryptor接口的典型用法代码示例。如果您正苦于以下问题:VB.NET IRelDecryptor接口的具体用法?VB.NET IRelDecryptor怎么用?VB.NET IRelDecryptor使用的例子?那么恭喜您, 这里精选的接口代码示例或许可以为您提供帮助。
在下文中一共展示了IRelDecryptor接口的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: CheckSignatureWithEncryptedGrant
Public Shared Sub CheckSignatureWithEncryptedGrant(ByVal fileName As String, ByVal decryptor As IRelDecryptor)
' Create a new XML document.
Dim xmlDocument As New XmlDocument()
Dim nsManager As New XmlNamespaceManager(xmlDocument.NameTable)
' Format using white spaces.
xmlDocument.PreserveWhitespace = True
' Load the passed XML file into the document.
xmlDocument.Load(fileName)
nsManager.AddNamespace("dsig", SignedXml.XmlDsigNamespaceUrl)
' Find the "Signature" node and create a new XmlNodeList object.
Dim nodeList As XmlNodeList = xmlDocument.SelectNodes("//dsig:Signature", nsManager)
Dim count = nodeList.Count
For i As Integer = 0 To count - 1
Dim clone As XmlDocument = xmlDocument.Clone()
Dim signatures As XmlNodeList = clone.SelectNodes("//dsig:Signature", nsManager)
' Create a new SignedXml object and pass into it the XML document clone.
Dim signedXml As New SignedXml(clone)
' Load the signature node.
signedXml.LoadXml(CType(signatures(i), XmlElement))
' Set the context for license transform
Dim trans As Transform = CType(signedXml.SignedInfo.References(0), Reference).TransformChain(0)
If TypeOf trans Is XmlLicenseTransform Then
' Decryptor is used to decrypt encryptedGrant elements.
If Not (decryptor Is Nothing) Then
CType(trans, XmlLicenseTransform).Decryptor = decryptor
End If
End If
' Check the signature and display the result.
Dim result As Boolean = signedXml.CheckSignature()
If result Then
Console.WriteLine("SUCCESS: CheckSignatureWithEncryptedGrant - issuer index #" + i.ToString())
Else
Console.WriteLine("FAILURE: CheckSignatureWithEncryptedGrant - issuer index #" + i.ToString())
End If
Next i
End Sub
End Class