public override ICryptKey Clone(CryptAction crypt) { return(new AESCryptKey(Cryptography.AES.Clone(Aes)) { Crypt = crypt }); }
protected ConfigPropertyBase(Config config, String key, CryptAction crypt, Byte[] cryptKey, Boolean caching, params String[] sections) { Config = config; Key = key; Crypt = crypt; CryptKey = cryptKey; Sections = sections; Caching = caching; }
public String GetOrSetValue(String key, String defaultValue, CryptAction crypt, ICryptKey cryptKey, IEnumerable <String> sections) { sections = sections.Materialize(); String value = GetValue(key, sections); if (GetOrSetValueInternalCrypt(value, crypt, cryptKey, out String result)) { return(result); } SetValue(key, defaultValue, cryptKey, sections); return(defaultValue); }
public Boolean GetOrSetValueInternalCrypt(String value, CryptAction crypt, ICryptKey cryptKey, out String result) { cryptKey ??= Crypt; if (value is null) { result = default; return(false); } result = crypt.HasFlag(CryptAction.Decrypt) ? cryptKey.Decrypt(value) ?? value : value; return(true); }
public async Task <String> GetOrSetValueAsync(String key, String defaultValue, CryptAction crypt, ICryptKey cryptKey, IEnumerable <String> sections, CancellationToken token) { sections = sections.Materialize(); String value = await GetValueAsync(key, sections, token).ConfigureAwait(false); if (GetOrSetValueInternalCrypt(value, crypt, cryptKey, out String result)) { return(result); } await SetValueAsync(key, defaultValue, cryptKey, sections, token).ConfigureAwait(false); return(defaultValue); }
public Task <String> GetOrSetValueAsync(String key, String defaultValue, CryptAction crypt, ICryptKey cryptKey, IEnumerable <String> sections) { return(GetOrSetValueAsync(key, defaultValue, crypt, cryptKey, sections, CancellationToken.None)); }
public Task <String> GetOrSetValueAsync(String key, String defaultValue, CryptAction crypt, IEnumerable <String> sections, CancellationToken token) { return(GetOrSetValueAsync(key, defaultValue, crypt, null, sections, token)); }
public String GetOrSetValue(String key, String defaultValue, CryptAction crypt, IEnumerable <String> sections) { return(GetOrSetValue(key, defaultValue, crypt, null, sections)); }
public Task <String> GetOrSetValueAsync(String key, String defaultValue, CryptAction crypt, ICryptKey cryptKey, IEnumerable <String> sections) { return(Config.GetOrSetValueAsync(key, defaultValue, crypt, cryptKey, sections)); }
internal ConfigProperty(Config config, String key, T defaultValue, Func <T, Boolean> validate, CryptAction crypt, Byte[] cryptKey, Boolean caching, params String[] sections) : base(config, key, crypt, cryptKey, caching, sections) { DefaultValue = defaultValue; Validate = validate; Read(); }
public IConfigProperty <T> GetProperty <T>(String key, T defaultValue, Func <T, Boolean> validate, CryptAction crypt, Byte[] cryptKey, Boolean caching, params String[] sections) { return((IConfigProperty <T>)GetOrAddProperty(new ConfigProperty <T>(this, key, defaultValue, validate, crypt, cryptKey, caching, sections))); }
public IConfigProperty <T> GetProperty <T>(String key, T defaultValue, Func <T, Boolean> validate, CryptAction crypt, Byte[] cryptKey, params String[] sections) { return(GetProperty(key, defaultValue, validate, crypt, cryptKey, CachingByDefault, sections)); }
public IConfigProperty <T> GetProperty <T>(String key, T defaultValue, Func <T, Boolean> validate, CryptAction crypt, params String[] sections) { return(GetProperty(key, defaultValue, validate, crypt, null, sections)); }