MaterialsProviderInterface.php 1.8 KB

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