< Summary

Class:Azure.Security.KeyVault.Keys.Cryptography.DecryptResult
Assembly:Azure.Security.KeyVault.Keys
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Keys\src\Cryptography\DecryptResult.cs
Covered lines:11
Uncovered lines:0
Coverable lines:11
Total lines:52
Line coverage:100% (11 of 11)
Covered branches:6
Total branches:6
Branch coverage:100% (6 of 6)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
get_KeyId()-100%100%
get_Plaintext()-100%100%
get_Algorithm()-100%100%
Azure.Security.KeyVault.IJsonDeserializable.ReadProperties(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Keys\src\Cryptography\DecryptResult.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Text.Json;
 6
 7namespace Azure.Security.KeyVault.Keys.Cryptography
 8{
 9    /// <summary>
 10    /// Represents information about a decrypt operation.
 11    /// </summary>
 12    public class DecryptResult : IJsonDeserializable
 13    {
 14        private const string KeyIdPropertyName = "kid";
 15        private const string PlaintextPropertyName = "value";
 16
 2817        internal DecryptResult()
 18        {
 2819        }
 20
 21        /// <summary>
 22        /// Gets the <see cref="KeyProperties.Id"/> of the <see cref="KeyVaultKey"/> used to decrypt.
 23        /// </summary>
 4024        public string KeyId { get; internal set; }
 25
 26        /// <summary>
 27        /// Gets the decrypted data.
 28        /// </summary>
 5229        public byte[] Plaintext { get; internal set; }
 30
 31        /// <summary>
 32        /// Gets the <see cref="EncryptionAlgorithm"/> used for the decryption.
 33        /// </summary>
 4034        public EncryptionAlgorithm Algorithm { get; internal set; }
 35
 36        void IJsonDeserializable.ReadProperties(JsonElement json)
 37        {
 16838            foreach (JsonProperty prop in json.EnumerateObject())
 39            {
 5640                switch (prop.Name)
 41                {
 42                    case KeyIdPropertyName:
 2843                        KeyId = prop.Value.GetString();
 2844                        break;
 45                    case PlaintextPropertyName:
 2846                        Plaintext = Base64Url.Decode(prop.Value.GetString());
 47                        break;
 48                }
 49            }
 2850        }
 51    }
 52}