Put SecureString in PasswordBox

I have an existing SecureString that I would like to add to PasswordBox without exposing .Password . It can be done? For example:

tbPassword.SecurePassword = DecryptString(Properties.Settings.Default.proxyPassword); 

In this case, DecryptString creates a SecureString. However, SecurePassword is a read -only property, so I cannot assign a value to it.

+7
security c # wpf securestring
source share
1 answer

You can not.

However, what you can do is put placeholder text in it (it can even be a "placeholder" , we use it only to display several points in the field).

After you place the placeholder, when you go to the "current password" somewhere in your program, first check if the PasswordChanged event has been fired since the password was entered. If the event did not work, use the old saved password, if the event started using the current password from the SecurePassword PasswordBox property.

+8
source share

All Articles