| 1 | <?php |
| 2 | namespace Aws\Crypto; |
| 3 | |
| 4 | interface MaterialsProviderInterface |
| 5 | { |
| 6 | /** |
| 7 | * Returns if the requested size is supported by AES. |
| 8 | * |
| 9 | * @param int $keySize Size of the requested key in bits. |
| 10 | * |
| 11 | * @return bool |
| 12 | */ |
| 13 | public static function isSupportedKeySize($keySize); |
| 14 | |
| 15 | /** |
| 16 | * Performs further initialization of the MaterialsProvider based on the |
| 17 | * data inside the MetadataEnvelope. |
| 18 | * |
| 19 | * @param MetadataEnvelope $envelope A storage envelope for encryption |
| 20 | * metadata to be read from. |
| 21 | * |
| 22 | * @internal |
| 23 | */ |
| 24 | public function fromDecryptionEnvelope(MetadataEnvelope $envelope); |
| 25 | |
| 26 | /** |
| 27 | * Returns the wrap algorithm name for this Provider. |
| 28 | * |
| 29 | * @return string |
| 30 | */ |
| 31 | public function getWrapAlgorithmName(); |
| 32 | |
| 33 | /** |
| 34 | * Takes an encrypted content encryption key (CEK) and material description |
| 35 | * for use decrypting the key according to the Provider's specifications. |
| 36 | * |
| 37 | * @param string $encryptedCek Encrypted key to be decrypted by the Provider |
| 38 | * for use decrypting other data. |
| 39 | * @param string $materialDescription Material Description for use in |
| 40 | * encrypting the $cek. |
| 41 | * |
| 42 | * @return string |
| 43 | */ |
| 44 | public function decryptCek($encryptedCek, $materialDescription); |
| 45 | |
| 46 | /** |
| 47 | * @param string $keySize Length of a cipher key in bits for generating a |
| 48 | * random content encryption key (CEK). |
| 49 | * |
| 50 | * @return string |
| 51 | */ |
| 52 | public function generateCek($keySize); |
| 53 | |
| 54 | /** |
| 55 | * @param string $openSslName Cipher OpenSSL name to use for generating |
| 56 | * an initialization vector. |
| 57 | * |
| 58 | * @return string |
| 59 | */ |
| 60 | public function generateIv($openSslName); |
| 61 | } |