CSharpTest.Net
FromParameters Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > RSAPrivateKey Class : FromParameters Method

parameters

Glossary Item Box

Creates the key from the information provided

Syntax

Visual Basic (Declaration) 
Public Shared Shadows Function FromParameters( _
   ByVal parameters As RSAParameters _
) As RSAPrivateKey
C# 
public new static RSAPrivateKey FromParameters( 
   RSAParameters parameters
)

Parameters

parameters

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.NETCopy 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

Reference

RSAPrivateKey Class
RSAPrivateKey Members

Source Code

Library/Crypto/RSAPrivateKey.cs

Used By

RSAPrivateKey RSAPrivateKey.FromXml(XmlReader)

Generated with Document! X 2011 by Innovasys