Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support key version with KMS names to correctly recognize when to skip re-encryption #1705

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions gslib/commands/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,12 @@ def RewriteFunc(self, name_expansion_result, thread_state=None):

should_encrypt_dest = self.boto_file_encryption_keywrapper is not None

# Remove version number from CMEK name if present for matching with dest key
if (src_encryption_kms_key is not None and
'/cryptoKeyVersions/' in src_encryption_kms_key):
versionIdx = src_encryption_kms_key.find('/cryptoKeyVersions/')
src_encryption_kms_key = src_encryption_kms_key[:versionIdx]

encryption_unchanged = (src_encryption_sha256 == dest_encryption_sha256 and
src_encryption_kms_key == dest_encryption_kms_key)

Expand Down