/// <summary> /// Appends the specified secure string. /// </summary> /// <param name="secureString">The secure string.</param> /// <param name="value">The value.</param> public static void Append(this SecureString secureString, string value) { foreach (char c in value.ToCharArray()) { secureString.AppendChar(c); } }
/// <summary> /// Appends a string onto a SecureString /// </summary> /// <param name="value"></param> /// <param name="appendText"></param> /// <returns>The SecureString passed in</returns> public static SecureString Append(this SecureString value, string appendText) { if (value == null) throw new ArgumentNullException("value"); foreach (var character in appendText) value.AppendChar(character); return value; }
public static void Append(this SecureString input, string suffix) { if(suffix != null) { char[] chars = suffix.ToCharArray(); foreach (char c in chars) { input.AppendChar(c); } } }
/// <summary> /// Appends the specified secure string. /// </summary> /// <param name="secureString">The secure string.</param> /// <param name="value">The value.</param> public static void Append(this SecureString secureString, SecureString value) { // Uncrypt the password and get a reference to it... IntPtr bstr = Marshal.SecureStringToBSTR(value); //TODO make sure my byte count assumptions are correct try { for (int i = 0; i < value.Length; i++) { secureString.AppendChar(Convert.ToChar(Marshal.ReadInt16(bstr))); } } finally { Marshal.ZeroFreeBSTR(bstr); } }
public static void AppendString(this SecureString secureString, string value) { if (secureString == null) { throw new ArgumentNullException("secureString"); } if (value.Length <= 0) { return; } foreach (var c in value) { secureString.AppendChar(c); } }
/// <summary> /// /// </summary> /// <param name="secureString"></param> /// <param name="s"></param> /// <returns></returns> public static SecureString AppendString(this SecureString secureString, string s) { foreach (var c in s) { secureString.AppendChar(c); } return secureString; }