I am running this test code and it is causing the session to crash. Is it known bug?
pageextension 70100 CustomerListExt extends "Customer List"
{
actions
{
addlast(Processing)
{
action(RSATest)
{
ApplicationArea = All;
trigger OnAction()
var
RSAKey: Text;
begin
RSAKey := '<RSAKeyValue><Modulus>secrettext</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>AwIDAQAB</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>';
Message(RSAEncrypt('TestTextToEncrypt', RSAKey));
end;
}
}
}
procedure RSAEncrypt(TextToEncrypt: Text; RsaXmlKey: SecretText): Text
var
RSACryptoProvider: Codeunit RSACryptoServiceProvider;
Base64Convert: Codeunit "Base64 Convert";
TempBlob: Codeunit "Temp Blob";
PlainTextOutStream: OutStream;
EncryptedTextInStream: InStream;
EncryptedTextOutStream: OutStream;
EncryptedTextBase64: Text;
begin
// Convert the text to an OutStream
TempBlob.CreateOutStream(PlainTextOutStream, TEXTENCODING::UTF8);
PlainTextOutStream.WriteText(TextToEncrypt);
// Reset the TempBlob and prepare InStream for encryption
TempBlob.CreateInStream(EncryptedTextInStream, TEXTENCODING::UTF8);
// Prepare OutStream for receiving encrypted data
TempBlob.CreateOutStream(EncryptedTextOutStream);
// Encrypt the text
RSACryptoProvider.Encrypt(RsaXmlKey, EncryptedTextInStream, true, EncryptedTextOutStream);
// Reset the TempBlob and create an InStream to read the encrypted data
TempBlob.CreateInStream(EncryptedTextInStream);
// Convert the encrypted data to Base64
EncryptedTextBase64 := Base64Convert.ToBase64(EncryptedTextInStream);
exit(EncryptedTextBase64);
end;
}