Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3242270
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:17:43+00:00 2026-05-17T18:17:43+00:00

I am using Visual C# built in feature Settings to save some of my

  • 0

I am using Visual C# built in feature Settings to save some of my program’s options.
I also want to store one password, but then it comes public… is it possible to encrypt the password before saving it using this settings method and then decrypt it back?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:17:44+00:00Added an answer on May 17, 2026 at 6:17 pm

    For simple encryption needs, I’ve used the DPAPI via the ProtectedData class. To make the resulting encrypted value storable in a text file or registry, I encode the resulting byte array.

    Here is the class I wrote to wrap this up:

    namespace SomeNamespace
    {
       using System;
       using System.Security.Cryptography;
       using System.Text;
    
       /// <summary>
       /// used for encryption and decryption
       /// </summary>
       public static class DataProtector
       {
          private const string EntropyValue = "secret";
    
          /// <summary>
          /// Encrypts a string using the DPAPI.
          /// </summary>
          /// <param name="stringToEncrypt">The string to encrypt.</param>
          /// <returns>The encrypted data.</returns>
          public static string EncryptData(string stringToEncrypt)
          {
             byte[] encryptedData = ProtectedData.Protect(Encoding.Unicode.GetBytes(stringToEncrypt), Encoding.Unicode.GetBytes(EntropyValue), DataProtectionScope.LocalMachine);
             return Convert.ToBase64String(encryptedData);
          }
    
          /// <summary>
          /// Decrypts a string using the DPAPI.
          /// </summary>
          /// <param name="stringToDecrypt">The string to decrypt.</param>
          /// <returns>The decrypted data.</returns>
         public static string DecryptData(string stringToDecrypt)
          {
             byte[] decryptedData = ProtectedData.Unprotect(Convert.FromBase64String(stringToDecrypt), Encoding.Unicode.GetBytes(EntropyValue), DataProtectionScope.LocalMachine);
             return Encoding.Unicode.GetString(decryptedData);
          }
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Visual C# built in feature Settings to save some of my
I'm using the built in web server in Visual Studio to test some pags
When using the built-in Publish feature of Visual Studio 2010 with a web application
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I am developing a WCF service on my local computer using Visual Studios built
When using Visual Studio's built in web server, every time I make a page
Using Visual Studio 2008 and built-in web server. In a Web Handler .ashx file
I'm looking into using Visual Studio 2008's built in unit test projects instead of
I'm using Visual Studio 2008 and the built-in installation tools for a C# client
I've just built an MS Outlook Add In using Visual Studio and Office 2010.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.