本文整理汇总了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
开发者ID:VB.NET开发者,项目名称:System.Security.Cryptography.Xml,代码行数:40,代码来源:CipherData
注:本文中的System.Security.Cryptography.Xml.CipherData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论