@@ -32,6 +32,7 @@ abstract protected function getConnection();
3232
3333 abstract protected function getCertificateBundlePath (): ?string ;
3434 abstract protected function getSSECParameters (bool $ copy = false ): array ;
35+ abstract protected function getServerSideEncryptionParameters (bool $ copy = false ): array ;
3536
3637 /**
3738 * @param string $urn the unified resource name used to identify the object
@@ -46,7 +47,7 @@ public function readObject($urn) {
4647 'Bucket ' => $ this ->bucket ,
4748 'Key ' => $ urn ,
4849 'Range ' => 'bytes= ' . $ range ,
49- ] + $ this ->getSSECParameters ());
50+ ] + $ this ->getServerSideEncryptionParameters ());
5051 $ request = \Aws \serialize ($ command );
5152 $ headers = [];
5253 foreach ($ request ->getHeaders () as $ key => $ values ) {
@@ -114,7 +115,7 @@ protected function writeSingle(string $urn, StreamInterface $stream, array $meta
114115 'ContentType ' => $ mimetype ,
115116 'Metadata ' => $ this ->buildS3Metadata ($ metaData ),
116117 'StorageClass ' => $ this ->storageClass ,
117- ] + $ this ->getSSECParameters ();
118+ ] + $ this ->getServerSideEncryptionParameters ();
118119
119120 if ($ size = $ stream ->getSize ()) {
120121 $ args ['ContentLength ' ] = $ size ;
@@ -157,7 +158,7 @@ protected function writeMultiPart(string $urn, StreamInterface $stream, array $m
157158 'ContentType ' => $ mimetype ,
158159 'Metadata ' => $ this ->buildS3Metadata ($ metaData ),
159160 'StorageClass ' => $ this ->storageClass ,
160- ] + $ this ->getSSECParameters (),
161+ ] + $ this ->getServerSideEncryptionParameters (),
161162 'before_upload ' => function (Command $ command ) use (&$ totalWritten ): void {
162163 $ totalWritten += $ command ['ContentLength ' ];
163164 },
@@ -267,14 +268,14 @@ public function deleteObject($urn) {
267268 }
268269
269270 public function objectExists ($ urn ) {
270- return $ this ->getConnection ()->doesObjectExist ($ this ->bucket , $ urn , $ this ->getSSECParameters ());
271+ return $ this ->getConnection ()->doesObjectExist ($ this ->bucket , $ urn , $ this ->getServerSideEncryptionParameters ());
271272 }
272273
273274 public function copyObject ($ from , $ to , array $ options = []) {
274275 $ sourceMetadata = $ this ->getConnection ()->headObject ([
275276 'Bucket ' => $ this ->getBucket (),
276277 'Key ' => $ from ,
277- ] + $ this ->getSSECParameters ());
278+ ] + $ this ->getServerSideEncryptionParameters ());
278279
279280 $ size = (int )($ sourceMetadata ->get ('Size ' ) ?? $ sourceMetadata ->get ('ContentLength ' ));
280281
@@ -286,13 +287,13 @@ public function copyObject($from, $to, array $options = []) {
286287 'bucket ' => $ this ->getBucket (),
287288 'key ' => $ to ,
288289 'acl ' => 'private ' ,
289- 'params ' => $ this ->getSSECParameters () + $ this ->getSSECParameters (true ),
290+ 'params ' => $ this ->getServerSideEncryptionParameters () + $ this ->getServerSideEncryptionParameters (true ),
290291 'source_metadata ' => $ sourceMetadata
291292 ], $ options ));
292293 $ copy ->copy ();
293294 } else {
294295 $ this ->getConnection ()->copy ($ this ->getBucket (), $ from , $ this ->getBucket (), $ to , 'private ' , array_merge ([
295- 'params ' => $ this ->getSSECParameters () + $ this ->getSSECParameters (true ),
296+ 'params ' => $ this ->getServerSideEncryptionParameters () + $ this ->getServerSideEncryptionParameters (true ),
296297 'mup_threshold ' => PHP_INT_MAX ,
297298 ], $ options ));
298299 }
0 commit comments