Example #1
0
 public static string ToEncryptedJson(
     ConnectionDetails connectionDetails,
     SigningService signingService)
 {
     return($@"""ConnectionDetails"": {{
         ""DataSource"": ""{signingService.Encrypt(connectionDetails.DataSource)}""
         ""InitialCatalogue"": ""{signingService.Encrypt(connectionDetails.InitialCatalogue)}""
         ""UserId"": ""{signingService.Encrypt(connectionDetails.UserId)}""
         ""Password"": ""{signingService.Encrypt(connectionDetails.Password)}""
     }}");
 }
Example #2
0
        public void Run(
            [Option("e", "text to be encrypted")] string encrypt = "",
            [Option("d", "text to be decrypted")] string decrypt = "")
        {
            if (!string.IsNullOrWhiteSpace(encrypt))
            {
                Console.WriteLine(signingService.Encrypt(encrypt));
            }

            if (!string.IsNullOrWhiteSpace(decrypt))
            {
                Console.WriteLine(signingService.Decrypt(decrypt));
            }
        }