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 > EncryptionKeyImplements
System.IEquatable<EncryptionKey>Namespace
Google.Cloud.Storage.V1Assembly
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
EncryptionKey |
Methods
Create(Byte[])
public static EncryptionKey Create(byte[] key)
Creates an encryption key from the specified raw bytes.
Parameter | |
---|---|
Name | Description |
key | System.Byte[] The raw key data; must be non-null and 32 bytes long. |
Returns | |
---|---|
Type | Description |
EncryptionKey | An EncryptionKey based on |
Generate()
public static EncryptionKey Generate()
Generates a random encryption key using System.Security.Cryptography.RandomNumberGenerator.
Returns | |
---|---|
Type | Description |
EncryptionKey | A generated encryption key. |
GetHashCode()
public override int GetHashCode()
Returns | |
---|---|
Type | Description |
System.Int32 |
ModifyRequest(HttpRequestMessage)
public void ModifyRequest(HttpRequestMessage request)
Adds encryption headers to the specified request, unless this key is None,
Parameter | |
---|---|
Name | Description |
request | System.Net.Http.HttpRequestMessage The request to modify. Must not be null. |