Visual Basic (Declaration) | |
---|---|
Public Overloads Shared Function FromXml( _ ByVal xml As String _ ) As RSAPublicKey |
C# | |
---|---|
public static RSAPublicKey FromXml( string xml ) |
Parameters
- xml
Library/Library.Test/TestRSACrypto.cs
C# | Copy Code |
---|---|
RSAPublicKey pk = new RSAPrivateKey().PublicKey; string xml = pk.ToXml(); RSAPublicKey copy = RSAPublicKey.FromXml(xml); Assert.AreEqual(xml, copy.ToXml()); byte[] bytes = pk.ToArray(); Assert.AreEqual(148, bytes.Length); copy = RSAPublicKey.FromBytes(bytes); Assert.AreEqual(bytes, copy.ToArray()); copy = RSAPublicKey.FromParameters(pk.ExportParameters()); Assert.AreEqual(bytes, copy.ToArray()); |
VB.NET | Copy Code |
---|---|
Dim pk As RSAPublicKey = New RSAPrivateKey().PublicKey Dim xml As String = pk.ToXml() Dim copy As RSAPublicKey = RSAPublicKey.FromXml(xml) Assert.AreEqual(xml, copy.ToXml()) Dim bytes As Byte() = pk.ToArray() Assert.AreEqual(148, bytes.Length) copy = RSAPublicKey.FromBytes(bytes) Assert.AreEqual(bytes, copy.ToArray()) copy = RSAPublicKey.FromParameters(pk.ExportParameters()) Assert.AreEqual(bytes, copy.ToArray()) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
RSAPublicKey ClassRSAPublicKey Members
Overload List