RSA.ToXmlString(Boolean) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates and returns an XML string containing the key of the current RSA object.
public:
override System::String ^ ToXmlString(bool includePrivateParameters);
public override string ToXmlString (bool includePrivateParameters);
override this.ToXmlString : bool -> string
Public Overrides Function ToXmlString (includePrivateParameters As Boolean) As String
- includePrivateParameters
- Boolean
true
to include a public and private RSA key; false
to include only the public key.
An XML string containing the key of the current RSA object.
.NET Core and .NET 5+ only: In all cases.
The ToXmlString method creates an XML string that contains either the public and private key of the current RSA object or contains only the public key of the current RSA object.
Use the ToXmlString method whenever you need to conveniently persist RSA key information. To initialize an RSA object with the key in an XML string, use the FromXmlString method.
Varúð
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 How to: Store Asymmetric Keys in a Key Container.
When you pass true
to the ToXmlString method, the resulting XML string takes the following form:
<RSAKeyValue>
<Modulus>…</Modulus>
<Exponent>…</Exponent>
<P>…</P>
<Q>…</Q>
<DP>…</DP>
<DQ>…</DQ>
<InverseQ>…</InverseQ>
<D>…</D>
</RSAKeyValue>
When you pass false
to the ToXmlString method, the resulting XML string takes the following form:
<RSAKeyValue>
<Modulus>…</Modulus>
<Exponent>…</Exponent>
</RSAKeyValue>
Vara | Útgáfur |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
.NET umsögn
.NET er opið verkefni. Veldu tengil til að gefa umsögn: