EncryptionData
class EncryptionData
Represents the encryption data that is stored on the service.
using Azure.Core.Cryptography;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
namespace Azure.Storage.Cryptography.Models
{
internal class EncryptionData
{
public string EncryptionMode { get; set; }
public KeyEnvelope WrappedContentKey { get; set; }
public EncryptionAgent EncryptionAgent { get; set; }
public byte[] ContentEncryptionIV { get; set; }
public EncryptedRegionInfo EncryptedRegionInfo { get; set; }
public IDictionary<string, string> KeyWrappingMetadata { get; set; }
private static string AgentString { get; } = GenerateAgentString();
[AsyncStateMachine(typeof(<CreateInternalV1_0>d__24))]
internal static ValueTask<EncryptionData> CreateInternalV1_0(byte[] contentEncryptionIv, string keyWrapAlgorithm, byte[] contentEncryptionKey, IKeyEncryptionKey keyEncryptionKey, bool async, CancellationToken cancellationToken)
{
<CreateInternalV1_0>d__24 stateMachine = default(<CreateInternalV1_0>d__24);
stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<EncryptionData>.Create();
stateMachine.contentEncryptionIv = contentEncryptionIv;
stateMachine.keyWrapAlgorithm = keyWrapAlgorithm;
stateMachine.contentEncryptionKey = contentEncryptionKey;
stateMachine.keyEncryptionKey = keyEncryptionKey;
stateMachine.async = async;
stateMachine.cancellationToken = cancellationToken;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
[AsyncStateMachine(typeof(<CreateInternalV2_0>d__25))]
internal static Task<EncryptionData> CreateInternalV2_0(string keyWrapAlgorithm, byte[] contentEncryptionKey, IKeyEncryptionKey keyEncryptionKey, bool async, CancellationToken cancellationToken)
{
<CreateInternalV2_0>d__25 stateMachine = default(<CreateInternalV2_0>d__25);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<EncryptionData>.Create();
stateMachine.keyWrapAlgorithm = keyWrapAlgorithm;
stateMachine.contentEncryptionKey = contentEncryptionKey;
stateMachine.keyEncryptionKey = keyEncryptionKey;
stateMachine.async = async;
stateMachine.cancellationToken = cancellationToken;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
private static string GenerateAgentString()
{
Assembly assembly = typeof(EncryptionData).Assembly;
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(4, 2);
defaultInterpolatedStringHandler.AppendLiteral("(");
defaultInterpolatedStringHandler.AppendFormatted(RuntimeInformation.FrameworkDescription);
defaultInterpolatedStringHandler.AppendLiteral("; ");
defaultInterpolatedStringHandler.AppendFormatted(RuntimeInformation.OSDescription);
defaultInterpolatedStringHandler.AppendLiteral(")");
string value = defaultInterpolatedStringHandler.ToStringAndClear();
defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(12, 3);
defaultInterpolatedStringHandler.AppendLiteral("azsdk-net-");
defaultInterpolatedStringHandler.AppendFormatted(assembly.GetName().Name);
defaultInterpolatedStringHandler.AppendLiteral("/");
defaultInterpolatedStringHandler.AppendFormatted(assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion);
defaultInterpolatedStringHandler.AppendLiteral(" ");
defaultInterpolatedStringHandler.AppendFormatted(value);
return defaultInterpolatedStringHandler.ToStringAndClear();
}
}
}