< Summary

Class:Azure.Security.KeyVault.Keys.Cryptography.WrapResult
Assembly:Azure.Security.KeyVault.Keys
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Keys\src\Cryptography\WrapResult.cs
Covered lines:11
Uncovered lines:0
Coverable lines:11
Total lines:51
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_EncryptedKey()-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\WrapResult.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Text.Json;
 5
 6namespace Azure.Security.KeyVault.Keys.Cryptography
 7{
 8    /// <summary>
 9    /// Represents information about a wrap operation.
 10    /// </summary>
 11    public class WrapResult : IJsonDeserializable
 12    {
 13        private const string KeyIdPropertyName = "kid";
 14        private const string EncryptedKeyPropertyName = "value";
 15
 3616        internal WrapResult()
 17        {
 3618        }
 19
 20        /// <summary>
 21        /// Gets the <see cref="KeyProperties.Id"/> of the <see cref="KeyVaultKey"/> used to wrap the <see cref="Encrypt
 22        /// </summary>
 4823        public string KeyId { get; internal set; }
 24
 25        /// <summary>
 26        /// Gets the wrapped key.
 27        /// </summary>
 6828        public byte[] EncryptedKey { get; internal set; }
 29
 30        /// <summary>
 31        /// Gets the <see cref="KeyWrapAlgorithm"/> used. This must be stored alongside the <see cref="EncryptedKey"/> a
 32        /// </summary>
 4833        public KeyWrapAlgorithm Algorithm { get; internal set; }
 34
 35        void IJsonDeserializable.ReadProperties(JsonElement json)
 36        {
 16837            foreach (JsonProperty prop in json.EnumerateObject())
 38            {
 5639                switch (prop.Name)
 40                {
 41                    case KeyIdPropertyName:
 2842                        KeyId = prop.Value.GetString();
 2843                        break;
 44                    case EncryptedKeyPropertyName:
 2845                        EncryptedKey = Base64Url.Decode(prop.Value.GetString());
 46                        break;
 47                }
 48            }
 2849        }
 50    }
 51}