Skip to main content

Notifications

Microsoft Dynamics NAV forum
Suggested answer

Password Encryption and Decription

Posted on by Microsoft Employee

Step1: Decrypt password

string encryptpwd = "";
foreach(User u in logUserDetails)
{
encryptpwd = u.Password;
}

string decryptpwd = string.Empty;
UTF8Encoding encodepwd = new UTF8Encoding();
Decoder Decode = encodepwd.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(encryptpwd);
int charCount = Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];


Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
decryptpwd = new String(decoded_char);

Step2: Encrypt password

byte[] encData_byte = new byte[user.Password.Length];
encData_byte = System.Text.Encoding.UTF8.GetBytes(user.Password);
string encodedData = Convert.ToBase64String(encData_byte);
user.Password = encodedData;

Categories:
  • Suggested answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: Password Encryption and Decription

    Is this for NAV or something else ? or Just for Information

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,524 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,469 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans