Google Cloud Storage v1 API - Class EncryptionKey (4.7.0)

public sealed class EncryptionKey : IEquatable<EncryptionKey>

Reference documentation and code samples for the Google Cloud Storage v1 API class 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

object > 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
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
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
keybyte

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 RandomNumberGenerator.

Returns
TypeDescription
EncryptionKey

A generated encryption key.

GetHashCode()

public override int GetHashCode()

Serves as the default hash function.

Returns
TypeDescription
int

A hash code for the current object.

Overrides

ModifyRequest(HttpRequestMessage)

public void ModifyRequest(HttpRequestMessage request)

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

Parameter
NameDescription
requestHttpRequestMessage

The request to modify. Must not be null.