none
Setup Project and encrypt conf RRS feed

Answers

  • You need to actually have authority to get to the share or whatever the database is on and that database has to allow the group your user is in authority to at least read.

    They also have to be on the same domain with no firewall or proxy between them to interfere with passing the security token.

    https://msdn.microsoft.com/en-us/library/ms144284.aspx?f=255&MSPPError=-2147217396

    Note from that article:

    Security Note 
    
    
    When possible, use Windows Authentication.
     
    


    Hope that helps.

    Technet articles: WPF: MVVM Step 1; All my Technet Articles

    • Marked as answer by Lionhart34 Wednesday, October 14, 2015 2:36 PM
    Tuesday, October 13, 2015 10:03 AM
    Moderator

All replies

  • Distributing a password or some such in an app is a bad idea.

    Why are you encrypting at all?

    If you can avoid this, you should do so.

    Can you not use windows integrated security?


    Wednesday, August 19, 2015 8:11 AM
    Moderator
  • My app is copy to each computer of users and i would like to protect the password/username of connection string in my config file.

    Each user can access to the config file with notepad.

    I didn't have any idea how to secure the connection informations...*

    When i search how protected config file i always find something about encrypt/decrypt.


    Thanks

    Wednesday, August 19, 2015 8:59 AM
  • You didn't answer my question.

    If the database is on the user's machine then they can likely obtain admin control of a database on that machine anyhow.

    If your database is on a server and everyone connects to that then most business windows users will be on active directory and you can use that to authenticate with no username or password in the connection string.

    If your database is accessed via some web server then you'd presumably need the user to authenticate anyhow and a you should be using web services to supply data.

    There are therefore very few scenarios where having a username and password in a connection string in a config file which you distribute ought to be necessary.

    .

    Anyhow.

    I don't see anything in that article about the key.

    It's machine dependent.

    You would need to export your key from the machine you encrypt the config on.

    As mentioned here:

    https://social.msdn.microsoft.com/Forums/en-US/d43a4bd7-7cc1-40cf-8269-82c92894df43/encrypt-section-of-appconfig-decrypt-on-other-machine?forum=csharplanguage


    Wednesday, August 19, 2015 12:08 PM
    Moderator
  • ok.

    My app connect to a database on another machine.

    When app start it connects to the SQL server with user/password specify in the config file.

    Maybe i'll try with windows authenfication as you say.

    EDIT : When i try to connect with windows authenfication i couldn't access to my database... i get an error of connection


    • Edited by Lionhart34 Wednesday, August 19, 2015 12:41 PM
    Wednesday, August 19, 2015 12:30 PM
  • Hi,

     what is the error message? In generally, you could access the database with windows authentication if it is built by yourself.

    Monday, August 24, 2015 7:37 AM
  • Hi,

    Sorry for my back today.

    I just add Trusted_Connection=Yes;Integrated Security=SSPI;

    I get somtjhing like this :

    "Fail to open user session 'domain\\user'."

    Thanks a lot for your help.



    • Edited by Lionhart34 Tuesday, October 13, 2015 9:07 AM
    Tuesday, October 13, 2015 9:00 AM
  • You need to actually have authority to get to the share or whatever the database is on and that database has to allow the group your user is in authority to at least read.

    They also have to be on the same domain with no firewall or proxy between them to interfere with passing the security token.

    https://msdn.microsoft.com/en-us/library/ms144284.aspx?f=255&MSPPError=-2147217396

    Note from that article:

    Security Note 
    
    
    When possible, use Windows Authentication.
     
    


    Hope that helps.

    Technet articles: WPF: MVVM Step 1; All my Technet Articles

    • Marked as answer by Lionhart34 Wednesday, October 14, 2015 2:36 PM
    Tuesday, October 13, 2015 10:03 AM
    Moderator