/// <summary>
        /// Called during deserialization to decrypt a property value
        /// </summary>
        public object GetValue(object target)
        {
            string clearText = PropertyInfo.GetValue(target) as string;

            if (!string.IsNullOrEmpty(clearText))
            {
                return(DataProtection.Encrypt(clearText, Scope));
            }
            return(null);
        }
Example #2
0
        internal void OnSerializingMethod(StreamingContext context)
        {
            string sourceString = string.Join(PairSeparator.ToString(), this.Contents.Select(kp => $"{kp.Key}{KeyValueSeparator}{kp.Value}"));

            SourceString = DataProtection.Encrypt(sourceString, Scope);
        }