fix return the wrong value
This commit is contained in:
@@ -11,20 +11,19 @@ namespace Pilz.Cryptography
|
||||
public class SecureString
|
||||
{
|
||||
public static ICrypter DefaultCrypter { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public ICrypter Crypter { get; set; }
|
||||
|
||||
[JsonProperty]
|
||||
public string EncryptedValue { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string Value
|
||||
{
|
||||
get => GetCrypter().Decrypt(EncryptedValue);
|
||||
get => GetCrypter()?.Decrypt(EncryptedValue);
|
||||
set => EncryptedValue = GetCrypter().Encrypt(value);
|
||||
}
|
||||
|
||||
[JsonConstructor]
|
||||
private SecureString(JsonConstructorAttribute dummyAttribute)
|
||||
{
|
||||
}
|
||||
|
||||
public SecureString() :
|
||||
this(string.Empty, true)
|
||||
{
|
||||
@@ -73,7 +72,7 @@ namespace Pilz.Cryptography
|
||||
public static implicit operator string(SecureString value) => value?.Value;
|
||||
public static implicit operator SecureString(string value) => new SecureString(value, false);
|
||||
|
||||
public static bool operator ==(SecureString left, SecureString right) => left.EncryptedValue == right.EncryptedValue;
|
||||
public static bool operator !=(SecureString left, SecureString right) => left.EncryptedValue != right.EncryptedValue;
|
||||
public static bool operator ==(SecureString left, SecureString right) => left?.EncryptedValue == right?.EncryptedValue;
|
||||
public static bool operator !=(SecureString left, SecureString right) => left?.EncryptedValue != right?.EncryptedValue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user