< Summary

Class:Azure.Security.KeyVault.Keys.Cryptography.EncryptResult
Assembly:Azure.Security.KeyVault.Keys
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Keys\src\Cryptography\EncryptResult.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_Ciphertext()-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\EncryptResult.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 an encryption operation.
 10    /// </summary>
 11    public class EncryptResult : IJsonDeserializable
 12    {
 13        private const string KeyIdPropertyName = "kid";
 14        private const string CiphertextPropertyName = "value";
 15
 2416        internal EncryptResult()
 17        {
 2418        }
 19
 20        /// <summary>
 21        /// Gets the <see cref="KeyProperties.Id"/> of the <see cref="KeyVaultKey"/> used to encrypt. This must be store
 22        /// </summary>
 3623        public string KeyId { get; internal set; }
 24
 25        /// <summary>
 26        /// Gets the ciphertext that is the result of the encryption.
 27        /// </summary>
 4828        public byte[] Ciphertext { get; internal set; }
 29
 30        /// <summary>
 31        /// Gets the <see cref="EncryptionAlgorithm"/> used for encryption. This must be stored alongside the <see cref=
 32        /// </summary>
 3633        public EncryptionAlgorithm Algorithm { get; internal set; }
 34
 35        void IJsonDeserializable.ReadProperties(JsonElement json)
 36        {
 14437            foreach (JsonProperty prop in json.EnumerateObject())
 38            {
 4839                switch (prop.Name)
 40                {
 41                    case KeyIdPropertyName:
 2442                        KeyId = prop.Value.GetString();
 2443                        break;
 44                    case CiphertextPropertyName:
 2445                        Ciphertext = Base64Url.Decode(prop.Value.GetString());
 46                        break;
 47                }
 48            }
 2449        }
 50    }
 51}