Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

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;

*This post is locked for comments

  • 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans