# Class RSACryptoServiceProviderExtensions OptimaJet.Workflow.Core.RSACryptoServiceProviderExtensions Provides helper methods for importing and exporting RSA key data from and to XML. Namespace: [OptimaJet.Workflow.Core](https://api.workflowengine.io/core/OptimaJet.Workflow.Core/) ```csharp 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](https://learn.microsoft.com/dotnet/api/system.security.cryptography.rsacryptoserviceprovider) instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `rsa` | `RSACryptoServiceProvider` | The RSA provider that receives the imported key values. | | `xmlString` | `String` | XML text in `` 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 `` 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 `` 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 `` 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](https://learn.microsoft.com/dotnet/api/system.security.cryptography.rsacryptoserviceprovider) key XML in the `` format. [Previous RetryExtensions](https://api.workflowengine.io/core/OptimaJet.Workflow.Core/RetryExtensions/) [Next SaveToAnnotationsPolicy](https://api.workflowengine.io/core/OptimaJet.Workflow.Core/SaveToAnnotationsPolicy/)