Encryption.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. namespace Config;
  3. use CodeIgniter\Config\BaseConfig;
  4. /**
  5. * Encryption configuration.
  6. *
  7. * These are the settings used for encryption, if you don't pass a parameter
  8. * array to the encrypter for creation/initialization.
  9. */
  10. class Encryption extends BaseConfig
  11. {
  12. /**
  13. * --------------------------------------------------------------------------
  14. * Encryption Key Starter
  15. * --------------------------------------------------------------------------
  16. *
  17. * If you use the Encryption class you must set an encryption key (seed).
  18. * You need to ensure it is long enough for the cipher and mode you plan to use.
  19. * See the user guide for more info.
  20. */
  21. public string $key = '';
  22. /**
  23. * --------------------------------------------------------------------------
  24. * Encryption Driver to Use
  25. * --------------------------------------------------------------------------
  26. *
  27. * One of the supported encryption drivers.
  28. *
  29. * Available drivers:
  30. * - OpenSSL
  31. * - Sodium
  32. */
  33. public string $driver = 'OpenSSL';
  34. /**
  35. * --------------------------------------------------------------------------
  36. * SodiumHandler's Padding Length in Bytes
  37. * --------------------------------------------------------------------------
  38. *
  39. * This is the number of bytes that will be padded to the plaintext message
  40. * before it is encrypted. This value should be greater than zero.
  41. *
  42. * See the user guide for more information on padding.
  43. */
  44. public int $blockSize = 16;
  45. /**
  46. * --------------------------------------------------------------------------
  47. * Encryption digest
  48. * --------------------------------------------------------------------------
  49. *
  50. * HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
  51. */
  52. public string $digest = 'SHA512';
  53. /**
  54. * Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
  55. * This setting is only used by OpenSSLHandler.
  56. *
  57. * Set to false for CI3 Encryption compatibility.
  58. */
  59. public bool $rawData = true;
  60. /**
  61. * Encryption key info.
  62. * This setting is only used by OpenSSLHandler.
  63. *
  64. * Set to 'encryption' for CI3 Encryption compatibility.
  65. */
  66. public string $encryptKeyInfo = '';
  67. /**
  68. * Authentication key info.
  69. * This setting is only used by OpenSSLHandler.
  70. *
  71. * Set to 'authentication' for CI3 Encryption compatibility.
  72. */
  73. public string $authKeyInfo = '';
  74. /**
  75. * Cipher to use.
  76. * This setting is only used by OpenSSLHandler.
  77. *
  78. * Set to 'AES-128-CBC' to decrypt encrypted data that encrypted
  79. * by CI3 Encryption default configuration.
  80. */
  81. public string $cipher = 'AES-256-CTR';
  82. }