The System.Data.SqlClient.SqlCredential
class has a two argument constructor which accepts a username (System.String
) and password (System.Security.SecureString
).
After calling this constructor, is it safe to dispose the SecureString
storing the password? I expect that the SqlCredential
class should perform a one-way hash on the password according to the SQL server authentication scheme and not require continued access to the parameter... but perhaps this cannot be done until the connection is opened and a challenge is issued (a nonce may be involved in the HMAC calculation to prevent replay attacks). If SqlCredential
does independently keep the needed information, then naturally I want to expedite erasure of the SecureString
storage which is reversible.
I have been unable to find any statement in the documentation specifying whether the password SecureString
object passed in must remain valid after the SqlCredential
constructor returns.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…