Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
352 views
in Technique[技术] by (71.8m points)

c# - Oracle DB and SecureString

I am currently storing the user password in a SecureString. Which is also kept around in case the connection to the DB resets.

My problem is, I'm trying to pass this password to an OracleParamater, but I'm not sure if it supports it or not.

Does Oracle's Oracle.DataAccess dll support SecureString or BStr? Since If I have to convert it to a string then that would kinda defeat the purpose of SecureString.

--- EDIT

I know that SecureString is about reducing the attack surface by keeping as few copies of the password around unencrypted as possible. The problem is at some point you ofcourse have to decrypt the password to use it. If I could pass a char[] or a BStr or the secure string itself in an OracleParameter then I could clear it after the call returns. But If I have to create a string in order to pass it to Oracle, then I've just created a new immutable copy of the password. So I'm not really sure I gained much then.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

No - AFAIK what you ask is not supported...

BUT even if it were supported the security issue would remain since the Oracle driver used (OCI) is native and does not know anything about SecureString thus it will handle the value internally without encryption which in turn means that this value can end up for example unencrypted in the swap file...

It would be a bit more secure if what you ask were supported on the .NET side of things but merely so...

IF you really need that level of security I would recommend redesigning that part of your software to use encrypted values in a way that the server-side (Oracle DB) of things does not require "plain text" but works with the encrypted values...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...