Decrypt SQLSERVER_PASSWORD prior to connecting to SQLServer to run SQLScript

Is there a way that I can make the SQLSERVER_PASSWORD undergo modification through a c# class or program prior to using it to connect to the SQLServer connection entered in the SQLServer Dialog?

My autodeployment process sends an encrypted password to the installer as a parameter, and I would like to decrypt this password in order to open the connection and run the Database Seed Script in my installer.

I then would like to Encrypt the password using a different algorithm and store it to my web.config.

Is there a way I can do processing on these values?

0 Kudos
1 Reply
Occasional contributor

Yes, this is possible.  If you have an InstallScript project you can utilize the "UseDLL" function to load your C# DLL - which must be COM Visible and x86 (or AnyCPU)

In your DLL function, you could take a string input (the encrypted password) and return the decrypted string value.

Use the decrypted value to connect to your SQL server.

In another function of your DLL, you could take a string input (the decrypted password) and return the encrypted string value using the second kind of encryption.

Use the encrypted value to write to your web.config file


0 Kudos