protected override void OnHandler(ParameterHandlerInfo info) { Core.Log.Warning("Starting ENCRYPTION TEST"); var message = "Hola Mundo esto es una prueba de encriptación, espero que funcione"; var skp = new SymmetricKeyProvider(); Core.Log.InfoBasic(message); var enc = skp.Encrypt(message, "password"); Core.Log.InfoBasic(enc); var dec = skp.Decrypt(enc, "password"); Core.Log.InfoBasic(dec); }
public static string ReplaceEncriptionTemplate(string source) { if (source == null) { return(null); } if (source.IndexOf("{Encripted:", StringComparison.Ordinal) == -1) { return(source); } var result = EncriptionTemplateFormatRegex.Replace(source, match => { if (match.Groups.Count < 2) { return(match.Value); } var encValue = match.Groups[1].Value; return(SymmetricProvider.Decrypt(encValue, EncryptionKey)); }); return(result); }