本文整理匯總了VB.NET中System.Security.Cryptography.Xml.CipherData類的典型用法代碼示例。如果您正苦於以下問題:VB.NET CipherData類的具體用法?VB.NET CipherData怎麽用?VB.NET CipherData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了CipherData類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: EncryptedDataSample1
' 導入命名空間
Imports System.Security.Cryptography.Xml
Imports System.Xml
Imports System.IO
'/ This sample used the EncryptedData class to create a EncryptedData element
'/ and write it to an XML file.
Module EncryptedDataSample1
Sub Main()
' Create a new CipherData object.
Dim cd As New CipherData
' Assign a byte array to the CipherValue.
cd.CipherValue = New Byte(7) {}
' Create a new EncryptedData object.
Dim ed As New EncryptedData
'Add an encryption method to the object.
ed.Id = "ED"
ed.EncryptionMethod = New EncryptionMethod("http://www.w3.org/2001/04/xmlenc#aes128-cbc")
ed.CipherData = cd
'Add key information to the object.
Dim ki As New KeyInfo
ki.AddClause(New KeyInfoRetrievalMethod("#EK", "http://www.w3.org/2001/04/xmlenc#EncryptedKey"))
ed.KeyInfo = ki
' Create new XML document and put encrypted data into it.
Dim doc As New XmlDocument
Dim encryptionPropertyElement As XmlElement = CType(doc.CreateElement("EncryptionProperty", EncryptedXml.XmlEncNamespaceUrl), XmlElement)
Dim ep As New EncryptionProperty(encryptionPropertyElement)
ed.AddProperty(ep)
' Output the resulting XML information into a file.
Dim path As String = "c:\test\MyTest.xml"
File.WriteAllText(path, ed.GetXml().OuterXml)
'End Sub
End Sub
End Module