< Summary

Class:Azure.Storage.Queues.QueueClientSideEncryptor
Assembly:Azure.Storage.Queues
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Queues\src\QueueClientSideEncryptor.cs
Covered lines:0
Uncovered lines:14
Coverable lines:14
Total lines:39
Line coverage:0% (0 of 14)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%100%
ClientSideEncryptInternal()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Queues\src\QueueClientSideEncryptor.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.IO;
 6using System.Text;
 7using System.Threading;
 8using System.Threading.Tasks;
 9using Azure.Storage.Cryptography;
 10using Azure.Storage.Cryptography.Models;
 11using Azure.Storage.Queues.Specialized.Models;
 12
 13namespace Azure.Storage.Queues
 14{
 15    internal class QueueClientSideEncryptor
 16    {
 17        private readonly ClientSideEncryptor _encryptor;
 18
 019        public QueueClientSideEncryptor(ClientSideEncryptor encryptor)
 20        {
 021            _encryptor = encryptor;
 022        }
 23
 24        public async Task<string> ClientSideEncryptInternal(string messageToUpload, bool async, CancellationToken cancel
 25        {
 026            var bytesToEncrypt = Encoding.UTF8.GetBytes(messageToUpload);
 027            (byte[] ciphertext, EncryptionData encryptionData) = await _encryptor.BufferedEncryptInternal(
 028                new MemoryStream(bytesToEncrypt),
 029                async,
 030                cancellationToken).ConfigureAwait(false);
 31
 032            return EncryptedMessageSerializer.Serialize(new EncryptedMessage
 033            {
 034                EncryptedMessageText = Convert.ToBase64String(ciphertext),
 035                EncryptionData = encryptionData
 036            });
 037        }
 38    }
 39}