From a myTextBox.Text to a mySecureString.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • thomasnguyencom

    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 ConvertToSecure String (string str)
    {
    SecureString secureString = new SecureString();
    foreach (char c in str)
    {
    secureString.Ap pendChar(c);
    }

    return secureString;
    }

    Thanks,
    -tom
  • =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=

    #2
    RE: From a myTextBox.Text to a mySecureString.

    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


    "thomasnguyenco m" 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 ConvertToSecure String (string str)
    {
    SecureString secureString = new SecureString();
    foreach (char c in str)
    {
    secureString.Ap pendChar(c);
    }
    >
    return secureString;
    }
    >
    Thanks,
    -tom
    >

    Comment

    Working...