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 / MaterialsProviderV2.php

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

58 lines 2.0 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 abstract class MaterialsProviderV2 implements MaterialsProviderInterfaceV2
6 {
7 private static $supportedKeySizes = [128 => \true, 256 => \true];
8 /**
9 * Returns if the requested size is supported by AES.
10 *
11 * @param int $keySize Size of the requested key in bits.
12 *
13 * @return bool
14 */
15 public static function isSupportedKeySize($keySize)
16 {
17 return isset(self::$supportedKeySizes[$keySize]);
18 }
19 /**
20 * Returns the wrap algorithm name for this Provider.
21 *
22 * @return string
23 */
24 public abstract function getWrapAlgorithmName();
25 /**
26 * Takes an encrypted content encryption key (CEK) and material description
27 * for use decrypting the key according to the Provider's specifications.
28 *
29 * @param string $encryptedCek Encrypted key to be decrypted by the Provider
30 * for use decrypting other data.
31 * @param string $materialDescription Material Description for use in
32 * decrypting the CEK.
33 * @param string $options Options for use in decrypting the CEK.
34 *
35 * @return string
36 */
37 public abstract function decryptCek($encryptedCek, $materialDescription, $options);
38 /**
39 * @param string $keySize Length of a cipher key in bits for generating a
40 * random content encryption key (CEK).
41 * @param array $context Context map needed for key encryption
42 * @param array $options Additional options to be used in CEK generation
43 *
44 * @return array
45 */
46 public abstract function generateCek($keySize, $context, $options);
47 /**
48 * @param string $openSslName Cipher OpenSSL name to use for generating
49 * an initialization vector.
50 *
51 * @return string
52 */
53 public function generateIv($openSslName)
54 {
55 return \openssl_random_pseudo_bytes(\openssl_cipher_iv_length($openSslName));
56 }
57 }
58