lib/google/cloud/storage/file.rb in google-cloud-storage-1.29.0 vs lib/google/cloud/storage/file.rb in google-cloud-storage-1.29.1
- old
+ new
@@ -410,11 +410,12 @@
# encryption
# key](https://cloud.google.com/storage/docs/encryption#customer-supplied).
# You can use this SHA256 hash to uniquely identify the AES-256
# encryption key required to decrypt this file.
#
- # @return [String]
+ # @return [String, nil] The encoded SHA256 hash, or `nil` if there is
+ # no customer-supplied encryption key for this file.
#
def encryption_key_sha256
return nil unless @gapi.customer_encryption
Base64.decode64 @gapi.customer_encryption.key_sha256
end
@@ -1227,11 +1228,11 @@
# # Key generation shown for example purposes only. Write your own.
# cipher = OpenSSL::Cipher.new "aes-256-cfb"
# cipher.encrypt
# new_key = cipher.random_key
#
- # file = bucket.file "path/to/my-file.ext"
+ # file = bucket.file "path/to/my-file.ext", encryption_key: old_key
# file.rewrite "new-destination-bucket",
# "path/to/destination/file.ext",
# encryption_key: old_key,
# new_encryption_key: new_key do |f|
# f.metadata["rewritten_from"] = "#{file.bucket}/#{file.name}"
@@ -1248,10 +1249,10 @@
# kms_key_name = "projects/a/locations/b/keyRings/c/cryptoKeys/d"
#
# # Old customer-supplied key was stored securely for later use.
# old_key = "y\x03\"\x0E\xB6\xD3\x9B\x0E\xAB*\x19\xFAv\xDEY\xBEI..."
#
- # file = bucket.file "path/to/my-file.ext"
+ # file = bucket.file "path/to/my-file.ext", encryption_key: old_key
# file.rewrite "new-destination-bucket",
# "path/to/destination/file.ext",
# encryption_key: old_key,
# new_kms_key: kms_key_name do |f|
# f.metadata["rewritten_from"] = "#{file.bucket}/#{file.name}"