Visual Basic (Declaration) | |
---|---|
Public Function New( _ ByVal data As SecureString _ ) |
C# | |
---|---|
public PasswordKey( SecureString data ) |
Parameters
- data
Library/Library.Test/TestPassword.cs
C# | Copy Code |
---|---|
PasswordKey pk1 = new PasswordKey(TEST_PASSWORD); PasswordKey pk2 = new PasswordKey(SecureStringUtils.Create(TEST_PASSWORD)); Assert.AreNotEqual(pk1.CreateKey().Key, pk2.CreateKey().Key); pk2.Salt = pk1.Salt; Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key); pk1.CreateKey(); Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key); pk1.Salt = new Salt(); Assert.AreNotEqual(pk1.Salt, pk2.Salt); Assert.AreNotEqual(pk1.CreateKey().Key, pk2.CreateKey().Key); Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey(pk1.Salt).Key); pk2.Salt = pk1.Salt; Assert.AreEqual(pk1.Salt, pk2.Salt); Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key); |
VB.NET | Copy Code |
---|---|
Dim pk1 As New PasswordKey(TEST_PASSWORD) Dim pk2 As New PasswordKey(SecureStringUtils.Create(TEST_PASSWORD)) Assert.AreNotEqual(pk1.CreateKey().Key, pk2.CreateKey().Key) pk2.Salt = pk1.Salt Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key) pk1.CreateKey() Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key) pk1.Salt = New Salt() Assert.AreNotEqual(pk1.Salt, pk2.Salt) Assert.AreNotEqual(pk1.CreateKey().Key, pk2.CreateKey().Key) Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey(pk1.Salt).Key) pk2.Salt = pk1.Salt Assert.AreEqual(pk1.Salt, pk2.Salt) Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
PasswordKey ClassPasswordKey Members
Overload List