Page 1 of 1

Documentation for MemCryptStorage?

Posted: Thu 28 Feb 2019 17:54
by rayrad
Problem
We have an Azure WebJob that needs to connect to a remote PostgreSQL database via encrypted connection. This job interacts with a customer's database so the connection string and SSL certificate files are dynamic and cannot be deployed with the service, either as a separate file or an embedded resource. The connection string not a problem, but the SslOptions class appears to only accept paths to files.

Searching the web and these forums, the 6.0 release from 2012 notes say:

"The MemCryptStorage class for storing SSL certificates in the application memory is implemented."

We tried using this and calling the AddCert and AddKey methods but it did not work. Searching the web, DevArt documentation, and DevArt forums, there is almost zero information on this class. This surprises me because loading keys and certs from memory seems like a reasonably common scenario.

Questions
  • Is there any official documentation on MemCryptStorage?
  • Both AddCert and AddKey require a "id" parameter. How is this parameter later used? Is there some id value that needs to be set on the connection or something to get it to find the stored credentials?
  • Is MemCryptStorage the correct way to accomplish our goal?
  • Is there any way to accomplish our goal with dotConnect for PostgreSQL?
Thank you very much in advance for any assistance.

Dave Parker

Re: Documentation for MemCryptStorage?

Posted: Tue 12 Mar 2019 20:25
by rayrad
Wow. Nobody has any response to this? Is this feature still even supported? If not, what is the best way to load the cert and key files from an in-memory context?

Thanks,
Dave Parker

Re: Documentation for MemCryptStorage?

Posted: Wed 13 Mar 2019 16:28
by Pinturiccio
Sorry for the late response. We are processing your request and will contact you as soon as possible.

Re: Documentation for MemCryptStorage?

Posted: Thu 14 Mar 2019 15:14
by Pinturiccio
Indeed we do not have any documentation regarding MemCryptStorage. We will add corresponding information to our documentation.

You can use the following code:

Code: Select all

MemCryptStorage.AddCert("my_test_cert", content)
where id is a string, and content is the content of a cert.pem file either as a string or as an array of bytes.

After this, you may use this certificate in your connection strings in the following way:

Code: Select all

Ssl Cert=memory://my_test_cert
where my_test_cert is the id text specified in the AddCert method.
rayrad wrote:Is MemCryptStorage the correct way to accomplish our goal?
Is there any way to accomplish our goal with dotConnect for PostgreSQL?
Yes, dotConnect for PostgreSQL and MemCryptStorage should accomplish your goal.