Partager via


RSA.FromXmlString Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Initializes an RSA object from the key information from an XML string.

Namespace:  System.Security.Cryptography
Assembly:  mscorlib.Extensions (in mscorlib.Extensions.dll)

Syntax

'Declaration
Public Overrides Sub FromXmlString ( _
    xmlString As String _
)
public override void FromXmlString(
    string xmlString
)

Parameters

Exceptions

Exception Condition
ArgumentNullException

The xmlString parameter is nulla null reference (Nothing in Visual Basic).

CryptographicException

The format of the xmlString parameter is not valid.

Remarks

The FromXmlString initializes an RSA object using key information in an XML string that was generated using the ToXmlString method. The FromXmlString method accepts either an XML string containing a public key or an XML string containing a public and private key.

Use the FromXmlString method to conveniently initialize RSA key information.

Caution noteCaution:

Persisting an XML string containing a private key to an insecure location is a security threat. The security of your application can be compromised if a malicious third party can access your private key. To safely persist a private key, use a secure key container. For more information about persisting private keys in a key container, see CspParameters.

Version Information

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.