Encrypt

Encrypt a string as a extension method. It uses RSA Standard algorithm to do this.

Method: Encrypt

[Command("Enc")]
public class EncryptExtension_Command : ICommand
{        
    [CommandOption("enc", 'e', Description = "Value that has to be encrypt")]
    public string Value { get; set; }

    [CommandOption("key", 'k', Description = "Key used to encrypt or Decrypt.")]
    public string Key { get; set; }

    public ValueTask ExecuteAsync(IConsole console)
    {
        string encryptedValue = Value.Encrypt(Key);
        console.Output.WriteLine($"Plan Text : {Value} Encrypted Value : {encryptedValue} Key : {Key}");
        return default;
    }
}

Last updated