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.
Implements
IEquatableEncryptionKeyNamespace
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 |
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 |
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 | 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 RandomNumberGenerator.
Returns | |
---|---|
Type | Description |
EncryptionKey | A generated encryption key. |
GetHashCode()
public override int GetHashCode()
Returns | |
---|---|
Type | Description |
int |
ModifyRequest(HttpRequestMessage)
public void ModifyRequest(HttpRequestMessage request)
Adds encryption headers to the specified request, unless this key is None,
Parameter | |
---|---|
Name | Description |
request | HttpRequestMessage The request to modify. Must not be null. |