Creates the key from the information provided
Syntax
Visual Basic (Declaration) | |
---|
Public Shared Shadows Function FromBytes( _
ByVal bytes() As Byte _
) As RSAPrivateKey |
Parameters
- bytes
Example
Library/Library.Test/TestRSACrypto.cs
C# | Copy Code |
---|
RSAPrivateKey pk = new RSAPrivateKey();
string xml = pk.ToXml();
RSAPrivateKey copy = RSAPrivateKey.FromXml(xml);
Assert.AreEqual(xml, copy.ToXml());
byte[] bytes = pk.ToArray();
Assert.AreEqual(596, bytes.Length);
copy = RSAPrivateKey.FromBytes(bytes);
Assert.AreEqual(bytes, copy.ToArray());
copy = RSAPrivateKey.FromParameters(pk.ExportParameters());
Assert.AreEqual(bytes, copy.ToArray()); |
VB.NET | Copy Code |
---|
Dim pk As New RSAPrivateKey()
Dim xml As String = pk.ToXml()
Dim copy As RSAPrivateKey = RSAPrivateKey.FromXml(xml)
Assert.AreEqual(xml, copy.ToXml())
Dim bytes As Byte() = pk.ToArray()
Assert.AreEqual(596, bytes.Length)
copy = RSAPrivateKey.FromBytes(bytes)
Assert.AreEqual(bytes, copy.ToArray())
copy = RSAPrivateKey.FromParameters(pk.ExportParameters())
Assert.AreEqual(bytes, copy.ToArray()) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also