Visual Basic (Declaration) | |
---|---|
Public Shared Sub CopyChars( _ ByVal input As SecureString, _ ByVal inputOffset As Integer, _ ByVal output() As Char, _ ByVal outputOffset As Integer, _ ByVal outputLength As Integer _ ) |
C# | |
---|---|
public static void CopyChars( SecureString input, int inputOffset, char[] output, int outputOffset, int outputLength ) |
Parameters
- input
- inputOffset
- output
- outputOffset
- outputLength
Library/Library.Test/TestSecureString.cs
C# | Copy Code |
---|---|
foreach (SecureString ss in MakeStrings()) { char[] temp = new char[TEST_PASSWORD.Length]; SecureStringUtils.CopyChars(ss, 0, temp, 0, temp.Length); Assert.AreEqual(TEST_PASSWORD, new String(temp)); temp = new char[TEST_PASSWORD.Length]; SecureStringUtils.CopyChars(ss, 4, temp, 4, temp.Length - 4); Assert.AreNotEqual(TEST_PASSWORD, new String(temp)); SecureStringUtils.CopyChars(ss, 0, temp, 0, 4); Assert.AreEqual(TEST_PASSWORD, new String(temp)); } |
VB.NET | Copy Code |
---|---|
For Each ss As SecureString In MakeStrings() Dim temp As Char() = New Char(TEST_PASSWORD.Length) {} SecureStringUtils.CopyChars(ss, 0, temp, 0, temp.Length) Assert.AreEqual(TEST_PASSWORD, New [String](temp)) temp = New Char(TEST_PASSWORD.Length) {} SecureStringUtils.CopyChars(ss, 4, temp, 4, temp.Length - 4) Assert.AreNotEqual(TEST_PASSWORD, New [String](temp)) SecureStringUtils.CopyChars(ss, 0, temp, 0, 4) Assert.AreEqual(TEST_PASSWORD, New [String](temp)) Next |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7