当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET AsymmetricAlgorithm.FromXmlString方法代码示例

本文整理汇总了VB.NET中System.Security.Cryptography.AsymmetricAlgorithm.FromXmlString方法的典型用法代码示例。如果您正苦于以下问题:VB.NET AsymmetricAlgorithm.FromXmlString方法的具体用法?VB.NET AsymmetricAlgorithm.FromXmlString怎么用?VB.NET AsymmetricAlgorithm.FromXmlString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Security.Cryptography.AsymmetricAlgorithm的用法示例。


在下文中一共展示了AsymmetricAlgorithm.FromXmlString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: FromXmlString

' Expected XML schema:
'      <ProviderName></ProviderName>
'      <KeyContainerName></KeyContainerName>
'      <KeyNumber></KeyNumber>
'      <ProviderType></ProviderType>
Public Overrides Sub FromXmlString(ByVal xmlString As String)
    If Not xmlString Is Nothing Then
        Dim doc As New XmlDocument
        doc.LoadXml(xmlString)
        Dim firstNode As XmlNode = doc.FirstChild
        Dim nodeList As XmlNodeList

        ' Assemble parameters from values in each XML element.
        cspParameters = New CspParameters

        ' KeyContainerName is optional.
        nodeList = doc.GetElementsByTagName("KeyContainerName")
        Dim keyName As String = nodeList.Item(0).InnerText
        If Not keyName Is Nothing Then
            cspParameters.KeyContainerName = keyName
        End If

        ' KeyNumber is optional.
        nodeList = doc.GetElementsByTagName("KeyNumber")
        Dim keyNumber As String = nodeList.Item(0).InnerText
        If Not keyNumber Is Nothing Then
            cspParameters.KeyNumber = Int32.Parse(keyNumber)
        End If

        ' ProviderName is optional.
        nodeList = doc.GetElementsByTagName("ProviderName")
        Dim providerName As String = nodeList.Item(0).InnerText
        If Not providerName Is Nothing Then
            cspParameters.ProviderName = providerName
        End If

        ' ProviderType is optional.
        nodeList = doc.GetElementsByTagName("ProviderType")
        Dim providerType As String = nodeList.Item(0).InnerText
        If Not providerType Is Nothing Then
            cspParameters.ProviderType = Int32.Parse(providerType)
        End If
    Else
        Throw New ArgumentNullException("xmlString")
    End If
End Sub
开发者ID:VB.NET开发者,项目名称:System.Security.Cryptography,代码行数:46,代码来源:AsymmetricAlgorithm.FromXmlString


注:本文中的System.Security.Cryptography.AsymmetricAlgorithm.FromXmlString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。