diff --git a/src/System Application/App/Cryptography Management/src/RSA.Codeunit.al b/src/System Application/App/Cryptography Management/src/RSA.Codeunit.al
index 6e3c1d32a8..72bd1350ca 100644
--- a/src/System Application/App/Cryptography Management/src/RSA.Codeunit.al
+++ b/src/System Application/App/Cryptography Management/src/RSA.Codeunit.al
@@ -26,6 +26,17 @@ codeunit 1475 "RSA"
RSAImpl.InitializeRSA(KeySize);
end;
+ ///
+ /// Creates a RSA object with private key and returns the XML string.
+ ///
+ /// private key as text
+ /// 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.
+ procedure ToSecretXmlString(PrivateKey: SecretText; IncludePrivateParameters: Boolean): SecretText
+ begin
+ exit(RSAImpl.ToSecretXmlString(PrivateKey, IncludePrivateParameters));
+ end;
+
///
/// Creates and returns an XML string containing the key of the current RSA object.
///
diff --git a/src/System Application/App/Cryptography Management/src/RSAImpl.Codeunit.al b/src/System Application/App/Cryptography Management/src/RSAImpl.Codeunit.al
index 4449b0330c..c69c9e1b62 100644
--- a/src/System Application/App/Cryptography Management/src/RSAImpl.Codeunit.al
+++ b/src/System Application/App/Cryptography Management/src/RSAImpl.Codeunit.al
@@ -186,6 +186,14 @@ codeunit 1476 "RSA Impl." implements "Signature Algorithm v2"
DotNetRSA.FromXmlString(XmlString);
end;
#endif
+ [NonDebuggable]
+ procedure ToSecretXmlString(PrivateKey: SecretText; IncludePrivateParameters: Boolean): SecretText
+ begin
+ DotNetRSA := DotNetRSA.Create(2048);
+ DotNetRSA.ImportFromPem(PrivateKey.Unwrap());
+ exit(ToSecretXmlString(IncludePrivateParameters));
+ end;
+
procedure ToSecretXmlString(IncludePrivateParameters: Boolean): SecretText
begin
exit(DotNetRSA.ToXmlString(IncludePrivateParameters));