How to store user setting and passwords in add-in

I’m currently building a SolidWorks add-in in C# targeting .NET Framework. Beside the class library project of the add-in, I have a class library to handle a connection to SQL database.

Now I wonder how to store the connection string to the database (and eventually others information). Ideally I would like to:

  1. not have it in the source control (I’m using Git)
  2. not have it readily available to the end user

I though of storing the data in a json file that I can add to the .gitignore file, but the second point would not be solved.

I read that .NET can store secrets, but I don’t know that if it’s true for .NET Framework. I also though of using an API as a middle layer between the add-in and the database, to handle the authentication, but I’m not a programmer and it will add to much complexity.

How would you solve the issue? Is there a solution?

Thanks in advance.

1.You can simply encrypt the JSON string and store it in any custom file located in the plugin’s installation path, such as a .db, .ini, or registry file.
2.As for how to encrypt the string, you can use chatgpt.

app.config is a good option

image