Reduce sending of kms key to minimum in requests

Signed-off-by: Bernd.Rederlechner@t-systems.com <bernd.rederlechner@t-systems.com>
This commit is contained in:
Bernd.Rederlechner@t-systems.com 2021-05-18 07:12:41 +00:00
parent f9c92477b9
commit 5809f7a7ac
2 changed files with 6 additions and 9 deletions

View File

@ -108,10 +108,12 @@ trait S3ConnectionTrait {
if (!empty($this->sseKmsBucketKeyId)) {
return [
'ServerSideEncryption' => 'aws:kms',
'BucketKeyEnabled' => true,
];
} elseif (!empty($this->sseKmsKeyId)) {
return [
'ServerSideEncryption' => 'aws:kms',
'BucketKeyEnabled' => false,
'SSEKMSKeyId' => $this->sseKmsKeyId,
];
} else {
@ -127,15 +129,10 @@ trait S3ConnectionTrait {
* @return array with encryption parameters
*/
public function getSseKmsGetParameters(): array {
if (!empty($this->sseKmsBucketKeyId)) {
if (!empty($this->sseKmsBucketKeyId) ||
!empty($this->sseKmsKeyId)) {
return [
'ServerSideEncryption' => 'aws:kms',
'SSEKMSKeyId' => $this->sseKmsBucketKeyId,
];
} elseif (!empty($this->sseKmsKeyId)) {
return [
'ServerSideEncryption' => 'aws:kms',
'SSEKMSKeyId' => $this->sseKmsKeyId,
];
} else {
return [];

View File

@ -132,7 +132,7 @@ abstract class ObjectStoreTest extends TestCase
$this->assertEquals('foobar', stream_get_contents($instance->readObject('target')));
$instance->deleteObject('source');
$instance->deleteObject('target');
//$instance->deleteObject('source');
//$instance->deleteObject('target');
}
}