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-08-14 UTC."],[[["\u003cp\u003eThis document outlines the \u003ccode\u003eEncryptionKey\u003c/code\u003e structure within the Google Cloud Storage C++ client library, focusing on its use with Customer-Supplied Encryption Keys (CSEK).\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the library available is version 2.37.0-rc, with previous versions down to 2.11.0 being accessible.\u003c/p\u003e\n"],["\u003cp\u003eCSEK allows application developers to use their own encryption keys to protect data in Google Cloud Storage, which means Google does not retain these keys.\u003c/p\u003e\n"],["\u003cp\u003eThe document details the functions \u003ccode\u003eFromBinaryKey\u003c/code\u003e and \u003ccode\u003eFromBase64Key\u003c/code\u003e for creating encryption key parameters, specifying that keys must be exactly 32 bytes when used.\u003c/p\u003e\n"],["\u003cp\u003eCSEK usage applies to read, write, copy, and compose operations, and users are strongly advised to safeguard their keys because data is unrecoverable if keys are lost.\u003c/p\u003e\n"]]],[],null,[]]