Assembly: OptimaJet.Workflow.Core

Class RSACryptoServiceProviderExtensions

OptimaJet.Workflow.Core.RSACryptoServiceProviderExtensions

Provides helper methods for importing and exporting RSA key data from and to XML.

public static class RSACryptoServiceProviderExtensions

Methods

public static void FromXmlString(RSACryptoServiceProvider rsa, string xmlString) #
Loads RSA key values from an XML string and assigns them to the specified RSACryptoServiceProvider instance.

Parameters

Name
Type
Description
rsa
RSACryptoServiceProvider
The RSA provider that receives the imported key values.
xmlString
String
XML text in <RSAKeyValue> format that contains RSA key parameter nodes.

Exceptions

Type
Description
XmlException
The XML text is not valid XML.
Exception
The XML document is not an <RSAKeyValue> block.
FormatException
One or more key node values are not valid Base64 text.
CryptographicException
The imported key parameters are not valid for the provider.

Remarks

The method reads Base64-encoded values from child nodes whose names match Modulus, Exponent, P, Q, DP, DQ, InverseQ, and D.
public static string ToXmlString(RSACryptoServiceProvider rsa) #
Exports the RSA parameters from the specified provider as an <RSAKeyValue> XML string.

Parameters

Name
Type
Description
rsa
RSACryptoServiceProvider
The RSA provider whose key parameters to serialize.

Returns

Type
Description
String
A string containing RSA key data encoded as an <RSAKeyValue> XML document.

Exceptions

Type
Description
CryptographicException
The RSA parameters cannot be exported.

Remarks

The output includes both public and private parameter elements.

Remarks

This class is intended for working with RSACryptoServiceProvider key XML in the <RSAKeyValue> format.