Esempio n. 1
0
        /// <summary>
        /// Decrypts cipherText
        /// </summary>
        /// <param name="key"> key to use for the decryption </param>
        private static void Decrypt(KeyBundle key)
        {
            KeyOperationResult operationResult;

            var algorithm  = inputValidator.GetEncryptionAlgorithm();
            var cipherText = inputValidator.GetCipherText();

            KeyBundle localKey;

            localKey = (key ?? GetKey(null));

            // Decrypt the encrypted data
            operationResult = keyVaultClient.DecryptAsync(localKey.KeyIdentifier.ToString(), algorithm, cipherText).GetAwaiter().GetResult();

            Console.Out.WriteLine(string.Format("The decrypted text is: {0}", Encoding.UTF8.GetString(operationResult.Result)));
        }