When handling some high security data like password etc. its always better to use the encryption – decryption methodology. This small example shows this methodology in AX. It uses TextBuffer class of AX
To encrypt a string, use the following code:
TextBuffer textBuffer = new TextBuffer();;textBuffer.setText(_text);textBuffer.encrypt(987654123); // Basic encryption
To decrypt a string, use the following code:
TextBuffer textBuffer = new TextBuffer();;textBuffer.setText(_text);textBuffer.decrypt(987654123);decryptedString = textBuffer.getText();
In these examples, the encryption key is 987654123. This can be any integer.