ClientSideEncryptionAlgorithm
Specifies the encryption algorithm used to encrypt and decrypt a blob.
using System;
using System.ComponentModel;
namespace Azure.Storage.Cryptography.Models
{
internal readonly struct ClientSideEncryptionAlgorithm
{
internal const string AesCbc256Value = "AES_CBC_256";
internal const string AesGcm256Value = "AES_GCM_256";
private readonly string _value;
public static ClientSideEncryptionAlgorithm AesCbc256 { get; } = new ClientSideEncryptionAlgorithm("AES_CBC_256");
public static ClientSideEncryptionAlgorithm AesGcm256 { get; } = new ClientSideEncryptionAlgorithm("AES_GCM_256");
public ClientSideEncryptionAlgorithm(string value)
{
if (value == null)
throw new ArgumentNullException("value");
_value = value;
}
public static bool operator ==(ClientSideEncryptionAlgorithm left, ClientSideEncryptionAlgorithm right)
{
return left.Equals(right);
}
public static bool operator !=(ClientSideEncryptionAlgorithm left, ClientSideEncryptionAlgorithm right)
{
return !left.Equals(right);
}
public static implicit operator ClientSideEncryptionAlgorithm(string value)
{
return new ClientSideEncryptionAlgorithm(value);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj)
{
if (obj is ClientSideEncryptionAlgorithm) {
ClientSideEncryptionAlgorithm other = (ClientSideEncryptionAlgorithm)obj;
return Equals(other);
}
return false;
}
public bool Equals(ClientSideEncryptionAlgorithm other)
{
return string.Equals(_value, other._value, StringComparison.Ordinal);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode()
{
return _value?.GetHashCode() ?? 0;
}
public override string ToString()
{
return _value;
}
}
}