0

I'm having a Library Application in C#. It contains all EDMX files and Database accessing methods. I created one Console application, in that I refereed that Library DLL to access the methods. But the console application expects the Connection String in local App.Config file. I need a Security, how to access the DLL without specifying the Connection String in the Console Application ?

Is there is any other way is there to achieve the requirement. Kindly assist me.

1
  • It is common to use integrated security so you don't need to put a username and password in the connection string. Are you also trying to hide the server and database name? The only way to truly hide this from the user is to use a distributed service for data access, don't do it from the application directly. Commented Dec 2, 2016 at 13:12

1 Answer 1

1

You must provide the connection string in order to access the database. If you can't use integrated security then I suggest you to keep keep the connection string encrypted in the app.config file, in the <appSettings></appSettings> section and decrypt it in the console app before sending it to the business layer.

Consult this answer for how to encrypt/decrypt strings: Simple two way encryption for C#

Sign up to request clarification or add additional context in comments.

5 Comments

If your app can decrypt it, then a savvy user can too.
If savvy user can't then NSA will certainly do. But let's get back to the problem here.
If you store the key such that you can decrypt it then you have the same problem as connection string.
That's why people invented public and private keys, there are thousands of encryption algorithms. If you can help the guy that posted the question then please feel free to do so. Otherwise any non-related comments are not necessary.
I am trying to help. It is the private key that decrypts, you don't give that to someone you are trying to hide the data from.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.