1. Shawn Luce
  2. PowerServer
  3. Tuesday, 3 December 2024 17:20 PM UTC

In the current system architecture, connection strings to different databases are stored in an Azure Key Vault for security. I'm working on a way to have PowerServer API return connection configurations based on the connection strings from the Key Vault. I'm using a custom ConfigurationProvider for the ProviderFactory of the `AddAppConfigFromFileSystem` and have successfully overridden the necessary methods to fetch and return a config based on values from the Key Vault.

That being said, I am not a fan of having the passwords sent back in cleartext over an API. Doing some research, I can see there's the customizedeploy.dll that can be run via dotnet command to encrypt a string, but I'd rather not have to spawn off processes (which might not even work in Azure) to convert the cleartext database passwords I get from the Key Vault to an encrypted version.

Is there a method I can call in PowerServer C# to encrypt the password?

mike S Accepted Answer Pending Moderation
  1. Tuesday, 3 December 2024 19:00 PM UTC
  2. PowerServer
  3. # 1

keyvault api uses https, so its not clear text. 

 

Comment
  1. Shawn Luce
  2. Tuesday, 3 December 2024 20:54 PM UTC
That's true, but that's not what I'm talking about. PowerServer API provides an endpoint to get connection information, which generally comes from AppConfig.json. If I use the PowerBuilder IDE to set the User ID/Password, the IDE encrypts the password before storing it in the file. Since I'm mimicking the JSON file in the API, I end up returning a cleartext password, which the PowerBuilder client handles perfectly well. What I want you do is encrypt the password at the API, just as the IDE does.
  1. Helpful
There are no comments made yet.
Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 4 December 2024 03:27 AM UTC
  2. PowerServer
  3. # 2

Hi Shawn,

Have you ever tried this solution? How to change database password in the cache dynamically when Web API is running | Appeon

Regards, Logan

Comment
  1. Shawn Luce
  2. Wednesday, 4 December 2024 04:57 AM UTC
That's actually very similar to what I'm doing now; the only difference is that I want to encrypt the password as part of the `GetDbPassword` call, similar to how the IDE will encrypt the password when saving the database connection.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.