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
2021-12-06 00:39:32 -08:00
committed by GitHub
parent 8591d17d82
commit be34fc9134
3 changed files with 20 additions and 5 deletions

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