PluginProbe
Media Cloud Sync / 1.4.1
Media Cloud Sync v1.4.1
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
media-cloud-sync / includes / sdk / s3 / Aws / Crypto / MetadataEnvelope.php

MetadataEnvelope.php in Media Cloud Sync 1.4.1, at includes/sdk/s3/Aws/Crypto/MetadataEnvelope.php

54 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\Aws\Crypto;
4
5 use Dudlewebs\WPMCS\s3\Aws\HasDataTrait;
6 use ArrayAccess;
7 use IteratorAggregate;
8 use InvalidArgumentException;
9 use JsonSerializable;
10 /**
11 * Stores encryption metadata for reading and writing.
12 *
13 * @internal
14 */
15 class MetadataEnvelope implements ArrayAccess, IteratorAggregate, JsonSerializable
16 {
17 use HasDataTrait;
18 const CONTENT_KEY_V2_HEADER = 'x-amz-key-v2';
19 const IV_HEADER = 'x-amz-iv';
20 const MATERIALS_DESCRIPTION_HEADER = 'x-amz-matdesc';
21 const KEY_WRAP_ALGORITHM_HEADER = 'x-amz-wrap-alg';
22 const CONTENT_CRYPTO_SCHEME_HEADER = 'x-amz-cek-alg';
23 const CRYPTO_TAG_LENGTH_HEADER = 'x-amz-tag-len';
24 const UNENCRYPTED_CONTENT_LENGTH_HEADER = 'x-amz-unencrypted-content-length';
25 private static $constants = [];
26 public static function getConstantValues()
27 {
28 if (empty(self::$constants)) {
29 $reflection = new \ReflectionClass(static::class);
30 foreach (\array_values($reflection->getConstants()) as $constant) {
31 self::$constants[$constant] = \true;
32 }
33 }
34 return \array_keys(self::$constants);
35 }
36 /**
37 * @return void
38 */
39 #[\ReturnTypeWillChange]
40 public function offsetSet($name, $value)
41 {
42 $constants = self::getConstantValues();
43 if (\is_null($name) || !\in_array($name, $constants)) {
44 throw new InvalidArgumentException('MetadataEnvelope fields must' . ' must match a predefined offset; use the header constants.');
45 }
46 $this->data[$name] = $value;
47 }
48 #[\ReturnTypeWillChange]
49 public function jsonSerialize()
50 {
51 return $this->data;
52 }
53 }
54