Copy .linq files to another computer

Hello

We try to share some of our *.linq files between the users in our company. The thing is, even if we have configured the same connection on another computer, the *.linq file is not working, as the password (which is encrypted within the file), can't probably not be decrypted.

Is there a way to share the files including connection between the computers? We also tryed to copy ConnectionsV2.xml to another computer, but then all connection passwords are lost.

Where is the master key for encryption stored, so that we can copy that one to the other machine.

Thanks!

Comments

  • You need to do this manually per computer, but only once per connection. Right-click the connection when it automatically appears, correct the password, and check 'Remember this connection' before clicking OK. It will then remember the password for that computer when another query is opened.
  • Joe or anyone. Is it still the case that when we move the connections file to a new computer, we have to re-enter the password for each connection?
    We have 500 connections. And on the laptop the password can update almost immediately (still a pain for 500 connections)
    But, on our new remote server, it is taking 30 seconds for each connection update. Help!!
    thanks!
  • From http://www.linqpad.net/faq.aspx :
    LINQPad encrypts the password securely using the Windows Data Protection API.

    Not knowing the details of the Windows Data Protection API, I would simply decrypt the file on machine A to plain text and encrypt them on machine B.

    Using LINQPad, you can use the following (C# Statement(s)) script to create an unprotected version of the ConnectionsV2.xml file:
    using System.Security.Cryptography;
    
    var source = Environment.ExpandEnvironmentVariables(@"%APPDATA%\LINQPad\ConnectionsV2.xml");
    var target = Environment.ExpandEnvironmentVariables(@"%APPDATA%\LINQPad\ConnectionsV2-Unprotected.xml");
    
    var key = Assembly.GetCallingAssembly().GetName().GetPublicKey();
    
    var doc = XDocument.Load(source);
    
    foreach (var pwd in doc.XPathSelectElements("/Connections/Connection/Password[text()]"))
    {
      pwd.Value =
        Encoding.UTF8.GetString(
          ProtectedData.Unprotect(
            Convert.FromBase64String(pwd.Value), key, DataProtectionScope.CurrentUser));
    }
    
    doc.Save(target);
    
    new Hyperlinq(target).Dump();
    On the target machine, place the ConnectionsV2-Unprotected.xml from the source machine in %APPDATA%\LINQPad and run the following script to create the encrypted ConnectionsV2.xml file (this will erase existing connections on the machine).
    using System.Security.Cryptography;
    
    var source = Environment.ExpandEnvironmentVariables(@"%APPDATA%\LINQPad\ConnectionsV2-Unprotected.xml");
    var target = Environment.ExpandEnvironmentVariables(@"%APPDATA%\LINQPad\ConnectionsV2.xml");
    
    var key = Assembly.GetCallingAssembly().GetName().GetPublicKey();
    
    var doc = XDocument.Load(source);
    
    foreach (var pwd in doc.XPathSelectElements("/Connections/Connection/Password[text()]"))
    {
      pwd.Value =
        Convert.ToBase64String(
          ProtectedData.Protect(
            Encoding.UTF8.GetBytes(pwd.Value), key, DataProtectionScope.CurrentUser));
    }
    
    doc.Save(target);
    
    new Hyperlinq(target).Dump();
    Source: LINQPad.Repository.Encrypt(string s) and LINQPad.Repository.Decrypt(string s). As stated here, you are allowed to decompile the LINQPad executable to inspect inner workings.
  • I have similar issue. Even though windows authentication is used.
    LPRun refuses to run the query. I need to bring it up in the editor, press "F5" and do a minor edit (like adding and removing a whitespace) and then hit "save". Then LPRun is able to run it.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!