An optional parameter to set the Customer-Supplied Encryption key.
Application developers can generate their own encryption keys to protect the data in GCS. This is known as a Customer-Supplied Encryption key (CSEK). If the application provides a CSEK, GCS does not retain the key. The object data, the object CRC32 checksum, and its MD5 hash (if applicable) are all encrypted with this key, and the key is required to read any of these elements back.
Care must be taken to save and protect these keys, if lost, the data is not recoverable. Also, applications should avoid generating predictable keys, as this weakens the encryption.
This option is used in read (download), write (upload), copy, and compose operations. Note that copy and compose operations use the same key for the source and destination objects.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-18 UTC."],[[["The latest version available is 2.37.0-rc, with multiple previous versions available down to 2.11.0, all related to the `EncryptionKey` struct in Google Cloud Storage (GCS)."],["Customer-Supplied Encryption Keys (CSEK) allow users to encrypt their data in GCS, where GCS does not retain the key and requires the key to decrypt and read data."],["Data encrypted with a CSEK, including object data, CRC32 checksum, and MD5 hash, are dependent on that key, so that it must be stored and protected, as lost keys will result in permanent data loss."],["The `EncryptionKey` struct supports the creation of keys from both binary and base64 formats, with the requirement of a 32-byte key size after decoding."],["This feature is used in operations such as read, write, copy and compose."]]],[]]