fix: kms-id header should have arn:aws:kms: prefix (#13833)

arn:aws:kms: is a must for KMS keyID.
This commit is contained in:
Harshavardhana authored and GitHub committed 2021-12-06 00:39:32 -08:00
1 parent 8591d17d82
commit be34fc9134
3 files changed
+20 -5

No files matched your search

+15
View File
@@ -68,6 +68,21 @@ const (
)
// KMSKeyID returns in AWS compatible KMS KeyID() format.
func (o ObjectInfo) KMSKeyID() string {
if len(o.UserDefined) == 0 {
return ""
}
kmsID, ok := o.UserDefined[crypto.MetaKeyID]
if !ok {
return ""
}
if strings.HasPrefix(kmsID, "arn:aws:kms:") {
return kmsID
}
return "arn:aws:kms:" + kmsID
}
// isMultipart returns true if the current object is
// uploaded by the user using multipart mechanism:
// initiate new multipart, upload part, complete upload