471,347 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,347 software developers and data experts.

From a myTextBox.Text to a mySecureString.

What's the best way to handle this situation securely?

I'm currently manually converting the string to a SecureString, but
for some reason it looks ugly.

public SecureString ConvertToSecureString (string str)
{
SecureString secureString = new SecureString();
foreach (char c in str)
{
secureString.AppendChar(c);
}

return secureString;
}

Thanks,
-tom
Apr 2 '08 #1
1 1252
AppendChar, InsertAt, and RemoveAt are the only methods available.
So, it may be ugly but that's the deal, essentially.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"thomasnguyencom" wrote:
What's the best way to handle this situation securely?

I'm currently manually converting the string to a SecureString, but
for some reason it looks ugly.

public SecureString ConvertToSecureString (string str)
{
SecureString secureString = new SecureString();
foreach (char c in str)
{
secureString.AppendChar(c);
}

return secureString;
}

Thanks,
-tom
Apr 2 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Juba | last post: by
2 posts views Thread by David Dvali | last post: by
4 posts views Thread by Ken Soenen | last post: by
2 posts views Thread by Michael Raczynski | last post: by
5 posts views Thread by nomail.thanks | last post: by
2 posts views Thread by Bruno Alexandre | last post: by
3 posts views Thread by =?Utf-8?B?S3VsYmVy?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.