Class EncryptionKey (3.4.0)

public sealed class EncryptionKey : IEquatable<EncryptionKey>

An AES-256 key passed to the Google Cloud Storage servers via headers to allow objects to be encrypted at rest using a client-supplied key rather than a server-supplied default key. An alternative to customer-supplied encryption keys is to use customer-managed encryption keys, via Cloud KMS.

Inheritance

System.Object > EncryptionKey

Implements

System.IEquatable<EncryptionKey>

Namespace

Google.Cloud.Storage.V1

Assembly

Google.Cloud.Storage.V1.dll

Properties

Base64Hash

public string Base64Hash { get; }

The base64 representation of the SHA-256 hash of the key. This will always be 45 characters long, or null for None.

Property Value
TypeDescription
System.String

Base64Key

public string Base64Key { get; }

The base64 representation of the key. This will always be 45 characters long, or null for None.

Property Value
TypeDescription
System.String

None

public static EncryptionKey None { get; }

A "don't encrypt" key, used in call-specific options to indicate that a particular request should not use encryption even if the client has a default encryption key.

Property Value
TypeDescription
EncryptionKey

Methods

Create(Byte[])

public static EncryptionKey Create(byte[] key)

Creates an encryption key from the specified raw bytes.

Parameter
NameDescription
keySystem.Byte[]

The raw key data; must be non-null and 32 bytes long.

Returns
TypeDescription
EncryptionKey

An EncryptionKey based on key.

Generate()

public static EncryptionKey Generate()

Generates a random encryption key using System.Security.Cryptography.RandomNumberGenerator.

Returns
TypeDescription
EncryptionKey

A generated encryption key.

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
System.Int32
Overrides
System.Object.GetHashCode()

ModifyRequest(HttpRequestMessage)

public void ModifyRequest(HttpRequestMessage request)

Adds encryption headers to the specified request, unless this key is None,

Parameter
NameDescription
requestSystem.Net.Http.HttpRequestMessage

The request to modify. Must not be null.