public void ReturnAReadOnlySecureString_WhenCallingGetSecureString() { // Arrange System.Security.SecureString encryptedString = new System.Security.SecureString(); Assert.IsFalse(encryptedString.IsReadOnly()); string password = "******"; // Act encryptedString = SUT.GetSecureString(password); // Assert Assert.IsTrue(encryptedString.IsReadOnly()); }
public EncryptedString(System.Security.SecureString str, byte[] key) { if (!str.IsReadOnly()) { throw new ArgumentException("SecureString is not read only"); } this.encr = new EncryptionHelper(key); this.str = str; }