Use of in memory ssl certificate

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
baba
Posts: 22
Joined: Thu 14 Apr 2005 16:40

Use of in memory ssl certificate

Post by baba » Sun 19 Dec 2010 10:54

Hello,

Due to the particular security aspects of our applications, we need to make sure certificates are not written to physical disk, we would appreciate that the library could use in-memory ssl certificate.

Using a special expression like "MEM:....", instead of a file name (or whatever expression is simpler for you).

or memorystream, or....

The contents of the memory string could be the exact image of the file content.

What do you think about that ??

Sebastien

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 23 Dec 2010 16:20

We are still investigating the issue. As we understand, you are requesting an implementation of the byte[]/String/Stream interface for passing already decryped ssl certificate to our provider. Is it correct?

baba
Posts: 22
Joined: Thu 14 Apr 2005 16:40

About SSL certificates : in memory files

Post by baba » Wed 03 Aug 2011 15:27

Hello,
A long time ago, i asked you about the fact that the certificates/key should be deletable.
If i remember, one of the certificates/key was locked by the dll, so it could not be removed from disk.

You made a modification, and now the certificates/key are deletable after the Open call. Good !

But !

I have to put the certificates/key on disk again before each Opening of a connection, even taken from the pool when the pool does not hold any more opened connection.

I suppose after a certain time (that is why i asked for names on your threads, and i thank you for having named them!), you really close the unused connection.

This is very logic in a sense that i avoid the server to be over-connected with "old" unused connections.

I noticed that you choose the pool like if you "name" it with the connection string. This is logic too.

Notice : You create a new pool every time the connection string is rewriten :

PgSqlConnection q = new PgsqlConnection();
q.ConnectionString = "hjkhkjhhjkjhkh";
q.ConnectionString += ";some more info";
q.ConnectionString += ";I am not finished with you, pretty connection";
Now we have 3 pools : MemProfiler proves it !
Only the third one will be used.
Waiste of CPU and RAM !
And probaly a silent bug...
END OF NOTICE



But if i ask for a connection, and no more opened connections are available in the pool, you create a new one... trying again to access the certificates/key on the disk !! But remember i deleted it !

So the application crash when i try to get a second connection !

May i do a suggestion :

In you pool class, you should store at creation the string expression of the certificates/key, and use them directly, without any disk access on any subsequent connection creation/opening.

less disk access, faster connection, more secret security.

Et voila !

BTW : if the certificates/key uses CR/LF instead LF, you crash. You could just insert a Replace function while loading the certificates/key. Just to help...

An additionnal option could be created : After creating a connection, without any mention to SSL in the connection String, and before using it in any way,
3 additionnal functions could allow to provide directly the string expression of the certificates/key :

conn.SetCaCert(String the_content_of_the_certificates);
idem
conn.SetSSLKey(String...
conn.SetSSLCert(String...

This would in fact set the String in the relevant pool.
For sure this could not be allowed as soon as Open is called on any connection of that pool.
And then no more secret on disk ! never !

Thanks for your attention,

Seb

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 08 Aug 2011 15:49

baba wrote:You create a new pool every time the connection string is rewriten
We have reproduced the issue. We will notify you when it is fixed.
baba wrote:In you pool class, you should store at creation the string expression of the certificates/key, and use them directly, without any disk access on any subsequent connection creation/opening.
baba wrote:BTW : if the certificates/key uses CR/LF instead LF, you crash. You could just insert a Replace function while loading the certificates/key. Just to help../
baba wrote:3 additionnal functions could allow to provide directly the string expression of the certificates/key :

conn.SetCaCert(String the_content_of_the_certificates);
idem
conn.SetSSLKey(String...
conn.SetSSLCert(String...
Thank you for your suggestion. We will investigate them and notify you about the results as soon as possible.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 11 Aug 2011 14:25

Sébastien, we have sent a test build of dotConnect for PostgreSQL with a beta functionality to your e-mail address. It includes a new static class to store certificates in memory. Please test it and notify us about the results. We appreciate your feedback.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 31 Aug 2011 15:00

Notice : You create a new pool every time the connection string is rewriten :

PgSqlConnection q = new PgsqlConnection();
q.ConnectionString = "hjkhkjhhjkjhkh";
q.ConnectionString += ";some more info";
q.ConnectionString += ";I am not finished with you, pretty connection";
We will fix this behaviour but there is no timeframe at the moment. As a workaround, we recommend you to assign only a result string to PgSqlConnection.ConnectionString.

Post Reply