Menu

## Documentation

### Packages

Application

### Namespaces

KickassCrypto

### Table of Contents

KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_OPENSSL_SECRET_CURR = 'config invalid: CONFIG_OPENSSL_SECRET_CURR.'
  2023-04-05 jj5 - this happens when CONFIG_OPENSSL_SECRET_CURR is defined for the round-trip use case and the OpenSSL module but it is not valid.
KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_OPENSSL_SECRET_LIST = 'config invalid: CONFIG_OPENSSL_SECRET_LIST.'
  2023-04-05 jj5 - this happens when CONFIG_OPENSSL_SECRET_LIST is defined for the at-rest use case and the OpenSSL module but it is not valid.
KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_OPENSSL_SECRET_PREV = 'config invalid: CONFIG_OPENSSL_SECRET_PREV.'
  2023-04-05 jj5 - this happens when CONFIG_OPENSSL_SECRET_PREV is defined for the round-trip use case and the OpenSSL module but it is not valid.
KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_SODIUM_SECRET_CURR = 'config invalid: CONFIG_SODIUM_SECRET_CURR.'
  2023-04-05 jj5 - this happens when CONFIG_SODIUM_SECRET_CURR is defined for the round-trip use case and the Sodium module but it is not valid.
KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_SODIUM_SECRET_LIST = 'config invalid: CONFIG_SODIUM_SECRET_LIST.'
  2023-04-05 jj5 - this happens when CONFIG_SODIUM_SECRET_LIST is defined for the at-rest use case and the Sodium module but it is not valid.
KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_SODIUM_SECRET_PREV = 'config invalid: CONFIG_SODIUM_SECRET_PREV.'
  2023-04-05 jj5 - this happens when CONFIG_SODIUM_SECRET_PREV is defined for the round-trip use case and the Sodium module but it is not valid.
KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_OPENSSL_SECRET_CURR = 'config missing: CONFIG_OPENSSL_SECRET_CURR.'
  2023-04-05 jj5 - this happens when CONFIG_OPENSSL_SECRET_CURR is not defined for the round-trip use case and the OpenSSL module.
KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_OPENSSL_SECRET_LIST = 'config missing: CONFIG_OPENSSL_SECRET_LIST.'
  2023-04-05 jj5 - this happens when CONFIG_OPENSSL_SECRET_LIST is not defined for the at-rest use case and the OpenSSL module.
KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_SODIUM_SECRET_CURR = 'config missing: CONFIG_SODIUM_SECRET_CURR.'
  2023-04-05 jj5 - this happens when CONFIG_SODIUM_SECRET_CURR is not defined for the round-trip use case and the Sodium module.
KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_SODIUM_SECRET_LIST = 'config missing: CONFIG_SODIUM_SECRET_LIST.'
  2023-04-05 jj5 - this happens when CONFIG_SODIUM_SECRET_LIST is not defined for the at-rest use case and the Sodium module.
KICKASS_CRYPTO_DATA_ENCODING_JSON = 'json'
  2023-04-04 jj5 - the JSON format uses the PHP json_encode() and json_decode() functions; the encoding format strings must be four characters long.
KICKASS_CRYPTO_DATA_ENCODING_PHPS = 'phps'
  2023-04-04 jj5 - uses the PHP serialize() and unserialize() functions (not enabled by default due to potential security issues, enable with CONFIG_ENCRYPTION_PHPS_ENABLE); the encoding format strings must be four characters long.
KICKASS_CRYPTO_DATA_ENCODING_TEXT = 'text'
  2023-04-07 jj5 - encode as text.
KICKASS_CRYPTO_DATA_FORMAT_LENGTH_MAX = 8
  2023-04-05 jj5 - the data format indicator must meet this maximum character length.
KICKASS_CRYPTO_DATA_FORMAT_LENGTH_MIN = 2
  2023-04-05 jj5 - the data format indicator must meet this minimum character length.
KICKASS_CRYPTO_DATA_FORMAT_OPENSSL = 'KA0'
  2023-04-05 jj5 - the OpenSSL data format.
KICKASS_CRYPTO_DATA_FORMAT_SODIUM = 'KAS0'
  2023-04-05 jj5 - the Sodium data format.
KICKASS_CRYPTO_DEFAULT_CHUNK_SIZE = \pow(2, 12)
  2023-04-05 jj5 - this is the default chunk size; messages are padded up to the message length modulo the chunk size; 2^12 is 4KiB; this value might be changed in future.
KICKASS_CRYPTO_DEFAULT_CHUNK_SIZE_MAX = \pow(2, 26)
  2023-04-05 jj5 - this is the default maximum chunk size; 2^26 is 64 MiB; this value might be changed in future.
KICKASS_CRYPTO_DEFAULT_DATA_ENCODING = \KICKASS_CRYPTO_DATA_ENCODING_JSON
  2023-04-05 jj5 - default data encoding format is JSON.
KICKASS_CRYPTO_DEFAULT_DATA_LENGTH_MAX = \pow(2, 26)
  2023-04-05 jj5 - this is the maximum data length supported; 2^26 is 64 MiB; this value might be changed in future.
KICKASS_CRYPTO_DEFAULT_FALSE_ENABLE = \false
  2023-04-05 jj5 - by default you can't encrypt false.
KICKASS_CRYPTO_DEFAULT_JSON_DECODE_OPTIONS = \JSON_THROW_ON_ERROR
  2023-04-05 jj5 - these are the default JSON decoding options passed to the PHP json_decode() function.
KICKASS_CRYPTO_DEFAULT_JSON_ENCODE_OPTIONS = \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE
  2023-04-05 jj5 - these are the default JSON encoding options passed to the PHP json_encode() function.
KICKASS_CRYPTO_DEFAULT_PHPS_ENABLE = \false
  2023-04-05 jj5 - PHP serialization is disabled by default because it can lead to code execution vulnerabilities... (I don't have a source for this claim, that might be a rumor or not true any more).
KICKASS_CRYPTO_DELAY_NANOSECONDS_MAX = 10000000000
  2023-04-05 jj5 - the maximum random delay (in nanoseconds) used for timing attack mitigation; this value might be changed in future.
KICKASS_CRYPTO_DELAY_NANOSECONDS_MIN = 1000000
  2023-04-05 jj5 - the minimum random delay (in nanoseconds) used for timing attack mitigation; this value might be changed in future.
KICKASS_CRYPTO_DELAY_SECONDS_MIN = 1.0 / (\KICKASS_CRYPTO_DELAY_NANOSECONDS_MIN / 1000)
  2023-04-03 jj5 - this delay is a floating-point value in seconds, it's for comparison of the value returned from the PHP microtime() to check that our delay implementation did actually delay for at least this minimum amount of time.
KICKASS_CRYPTO_DISABLE_CIPHER_VALIDATION = false
  2023-04-07 jj5 - programmers can disable cipher validation by defining this constant as true.
KICKASS_CRYPTO_DISABLE_CONFIG_VALIDATION = false
  2023-04-07 jj5 - programmers can disable config validation by defining this constant as true.
KICKASS_CRYPTO_DISABLE_IV_LENGTH_VALIDATION = false
  2023-04-07 jj5 - programmers can disable initialization vector length validation by defining this constant as true.
KICKASS_CRYPTO_DISABLE_KEY_HASH_VALIDATION = false
  2023-04-07 jj5 - programmers can disable secret key hash function validation by defining this constant as true.
KICKASS_CRYPTO_DISABLE_PHP_VERSION_CHECK = false
  2023-04-05 jj5 - defines whether the PHP version check is disabled or not.
KICKASS_CRYPTO_DISABLE_RANDOM_BYTES_VALIDATION = false
  2023-04-07 jj5 - programmers can disable validation of the random_bytes() function by defining this constant as true.
KICKASS_CRYPTO_ERROR_BASE64_DECODING_FAILED = 'base64 decoding failed.'
KICKASS_CRYPTO_ERROR_BASE64_DECODING_FAILED_2 = 'base64 decoding failed (2).'
KICKASS_CRYPTO_ERROR_BINARY_DATA_INVALID = 'binary data invalid.'
KICKASS_CRYPTO_ERROR_BINARY_LENGTH_INVALID = 'binary length invalid.'
KICKASS_CRYPTO_ERROR_CANNOT_ENCRYPT_FALSE = 'cannot encrypt false.'
KICKASS_CRYPTO_ERROR_CHUNK_SIZE_INVALID = 'chunk size invalid.'
KICKASS_CRYPTO_ERROR_CIPHERTEXT_INVALID = 'ciphertext invalid.'
KICKASS_CRYPTO_ERROR_CIPHERTEXT_INVALID_2 = 'ciphertext invalid (2).'
KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED = 'data decoding failed.'
KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED_2 = 'data decoding failed (2).'
KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED_3 = 'data decoding failed (3).'
KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED_4 = 'data decoding failed (4).'
KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED = 'data encoding failed.'
KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED_2 = 'data encoding failed (2).'
KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED_3 = 'data encoding failed (3).'
KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED_4 = 'data encoding failed (4).'
KICKASS_CRYPTO_ERROR_DATA_ENCODING_INVALID = 'data encoding invalid.'
KICKASS_CRYPTO_ERROR_DATA_ENCODING_INVALID_2 = 'data encoding invalid (2).'
KICKASS_CRYPTO_ERROR_DATA_ENCODING_INVALID_3 = 'data encoding invalid (3).'
KICKASS_CRYPTO_ERROR_DATA_ENCODING_TOO_LARGE = 'data encoding too large.'
KICKASS_CRYPTO_ERROR_DECRYPTION_FAILED = 'decryption failed.'
KICKASS_CRYPTO_ERROR_DECRYPTION_FAILED_2 = 'decryption failed (2).'
KICKASS_CRYPTO_ERROR_ENCRYPTION_FAILED = 'encryption failed.'
KICKASS_CRYPTO_ERROR_ENCRYPTION_FAILED_2 = 'encryption failed (2).'
KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED = 'exception raised.'
KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED_2 = 'exception raised (2).'
KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED_3 = 'exception raised (3).'
KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED_4 = 'exception raised (4).'
KICKASS_CRYPTO_ERROR_IV_LENGTH_INVALID = 'IV length invalid.'
KICKASS_CRYPTO_ERROR_IV_LENGTH_INVALID_2 = 'IV length invalid (2).'
KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED = 'JSON decoding failed.'
KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED_2 = 'JSON decoding failed (2).'
KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED_3 = 'JSON decoding failed (3).'
KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED_4 = 'JSON decoding failed (4).'
KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED = 'JSON encoding failed.'
KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED_2 = 'JSON encoding failed (2).'
KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED_3 = 'JSON encoding failed (3).'
KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED_4 = 'JSON encoding failed (4).'
KICKASS_CRYPTO_ERROR_MESSAGE_DATA_LENGTH_RANGE_INVALID = 'message data length range invalid.'
KICKASS_CRYPTO_ERROR_MESSAGE_DATA_LENGTH_SPEC_INVALID = 'message data length spec invalid.'
KICKASS_CRYPTO_ERROR_MESSAGE_DECODING_FAILED = 'message decoding failed.'
KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED = 'message encoding failed.'
KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED_2 = 'message encoding failed (2).'
KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED_3 = 'message encoding failed (3).'
KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED_4 = 'message encoding failed (4).'
KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_INVALID = 'message encoding invalid.'
KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_UNKNOWN = 'message encoding unknown.'
KICKASS_CRYPTO_ERROR_MESSAGE_FORMAT_INVALID = 'message format invalid.'
KICKASS_CRYPTO_ERROR_MESSAGE_LENGTH_INVALID = 'message length invalid.'
KICKASS_CRYPTO_ERROR_NO_VALID_KEY = 'no valid key.'
KICKASS_CRYPTO_ERROR_PASSPHRASE_INVALID = 'passphrase invalid.'
KICKASS_CRYPTO_ERROR_PASSPHRASE_LENGTH_INVALID = 'passphrase length invalid.'
KICKASS_CRYPTO_ERROR_PASSPHRASE_LENGTH_INVALID_2 = 'passphrase length invalid (2).'
KICKASS_CRYPTO_ERROR_PASSPHRASE_MISSING = 'passphrase missing.'
KICKASS_CRYPTO_ERROR_PHPS_DECODING_FAILED = 'PHPS decoding failed.'
KICKASS_CRYPTO_ERROR_PHPS_DECODING_FAILED_2 = 'PHPS decoding failed (2).'
KICKASS_CRYPTO_ERROR_PHPS_ENCODING_DISABLED = 'PHPS encoding disabled.'
KICKASS_CRYPTO_ERROR_PHPS_ENCODING_DISABLED_2 = 'PHPS encoding disabled (2).'
KICKASS_CRYPTO_ERROR_PHPS_ENCODING_FAILED = 'PHPS encoding failed.'
KICKASS_CRYPTO_ERROR_PHPS_ENCODING_FAILED_2 = 'PHPS encoding failed (2).'
KICKASS_CRYPTO_ERROR_PHPS_ENCODING_FAILED_3 = 'PHPS encoding failed (3).'
KICKASS_CRYPTO_ERROR_RESULT_INVALID = 'result invalid.'
KICKASS_CRYPTO_ERROR_TAG_LENGTH_INVALID = 'tag length invalid.'
KICKASS_CRYPTO_ERROR_TAG_LENGTH_INVALID_2 = 'tag length invalid (2).'
KICKASS_CRYPTO_ERROR_TEXT_DECODING_FAILED = 'text decoding failed.'
KICKASS_CRYPTO_ERROR_TEXT_DECODING_FAILED_2 = 'text decoding failed (2).'
KICKASS_CRYPTO_ERROR_TEXT_DECODING_FAILED_3 = 'text decoding failed (3).'
KICKASS_CRYPTO_ERROR_TEXT_ENCODING_FAILED = 'text encoding failed.'
KICKASS_CRYPTO_ERROR_TEXT_ENCODING_FAILED_2 = 'text encoding failed (2).'
KICKASS_CRYPTO_ERROR_TEXT_ENCODING_FAILED_3 = 'text encoding failed (3).'
KICKASS_CRYPTO_EXCEPTION_INSECURE_RANDOM = 6000
  2023-04-05 jj5 - if the PHP random_bytes() implementation is not using a secure PRNG then this exception is supposed to be raised.
KICKASS_CRYPTO_EXCEPTION_INVALID_CIPHER = 4000
  2023-04-05 jj5 - if the cipher nominated for the OpenSSL library is not available in the environment this exception is raise.
KICKASS_CRYPTO_EXCEPTION_INVALID_CONFIG = 2000
  2023-04-05 jj5 - this exception is raise if the config is invalid. Modules define what constitutes a valid config based on the use case.
KICKASS_CRYPTO_EXCEPTION_INVALID_ERROR_LIST = 7000
  2023-04-06 jj5 - if we can't get a valid error list from an implementation we bail with an exception.
KICKASS_CRYPTO_EXCEPTION_INVALID_EXCEPTION_CODE = 1000
  2023-04-05 jj5 - if an invalid exception code is passed to the exception raising facility this exception is raised instead.
KICKASS_CRYPTO_EXCEPTION_INVALID_IV_LENGTH = 5000
  2023-04-05 jj5 - if the initialization vector for the OpenSSL library is not what we've been coded to expect then this exception is raise.
KICKASS_CRYPTO_EXCEPTION_INVALID_KEY_HASH = 3000
  2023-04-05 jj5 - if the hash algorithm is invalid or not available this exception is raised.
KICKASS_CRYPTO_EXCEPTION_MESSAGE = [\KICKASS_CRYPTO_EXCEPTION_INVALID_EXCEPTION_CODE => 'invalid exception code.', \KICKASS_CRYPTO_EXCEPTION_INVALID_CONFIG => 'invalid config.', \KICKASS_CRYPTO_EXCEPTION_INVALID_KEY_HASH => 'invalid key hash.', \KICKASS_CRYPTO_EXCEPTION_INVALID_CIPHER => 'invalid cipher.', \KICKASS_CRYPTO_EXCEPTION_INVALID_IV_LENGTH => 'invalid IV length.', \KICKASS_CRYPTO_EXCEPTION_INSECURE_RANDOM => 'insecure random.', \KICKASS_CRYPTO_EXCEPTION_INVALID_ERROR_LIST => 'invalid error list.', \KICKASS_CRYPTO_EXCEPTION_RECURSION_DETECTED => 'recursion detected.']
  2023-03-30 jj5 - these are the exception messages for each exception code. These exception messages should be stable, you can add new ones but don't change existing ones.
KICKASS_CRYPTO_EXCEPTION_RECURSION_DETECTED = 8000
  2023-04-07 jj5 - called if recursion/reentrancy is detected.
KICKASS_CRYPTO_EXIT_ASSERT = 83
  2023-04-05 jj5 - the error level to return when the program exits due to an assertion violation.
KICKASS_CRYPTO_EXIT_BAD_ENVIRONMENT = 60
  2023-04-05 jj5 - the error level to return when the program can't run due to an invalid run-time environment.
KICKASS_CRYPTO_EXIT_CANNOT_CONTINUE = 10
  2023-04-05 jj5 - the error level to return when nothing is broken or wrong but the program cannot continue.
KICKASS_CRYPTO_EXIT_ERROR = 81
  2023-04-05 jj5 - the error level to return when the program exits due to an error.
KICKASS_CRYPTO_EXIT_EXCEPTION = 82
  2023-04-05 jj5 - the error level to return when the program exits due to an exception.
KICKASS_CRYPTO_EXIT_FILE_MISSING = 61
  2023-04-05 jj5 - the error level to return when a file is missing.
KICKASS_CRYPTO_EXIT_HELP = 99
  2023-04-05 jj5 - the error level to return when help (or version) has been requested; this is not an error but it does return a non-zero error level for safety.
KICKASS_CRYPTO_EXIT_INVALID = 89
  2023-04-05 jj5 - the error level to return when the program tries to exit with an invalid error level.
KICKASS_CRYPTO_EXIT_OPTIONS_LISTED = 98
  2023-04-05 jj5 - the error level to return when program options have been requested; this is not an error but it does return a non-zero error level for safety.
KICKASS_CRYPTO_EXIT_PROBLEM = 80
  2023-04-05 jj5 - the error level to return when there's a problem with the program.
KICKASS_CRYPTO_EXIT_SUCCESS = 0
  2023-04-05 jj5 - the error level to return upon success.
KICKASS_CRYPTO_EXIT_TEST_FAILED = 84
  2023-04-05 jj5 - the error level to return when a unit-test failed.
KICKASS_CRYPTO_KEY_HASH = 'sha512/256'
  2023-04-05 jj5 - the key has is used to convert a secret key into a 32 byte (256-bit) passphrase for use with either the OpenSSL or Sodium encryption library.
KICKASS_CRYPTO_KEY_LENGTH_MIN = 88
  2023-04-05 jj5 - the minimum key length is used to ensure that secret keys meet at least a minimal requirement.
KICKASS_CRYPTO_LOG_ERROR_INVALID_PASSPHRASE = 'error: invalid passphrase.'
KICKASS_CRYPTO_LOG_PREFIX_EMERGENCY_DELAY = 'emergency delay: '
KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_HANDLE = 'handled exception: '
KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_IGNORE = 'ignored exception: '
KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_NOTIFY = 'caught exception: '
KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_THROW = 'throwing exception: '
KICKASS_CRYPTO_LOG_WARNING_DELAY = 'warning: delayed due to error.'
KICKASS_CRYPTO_LOG_WARNING_SHORT_PASSPHRASE = 'warning: passphrase shorter than recommended.'
KICKASS_CRYPTO_LOG_WARNING_SHORT_SECRET = 'warning: secret shorter than recommended.'
KICKASS_CRYPTO_OPENSSL_CIPHER = 'aes-256-gcm'
  2023-04-05 jj5 - this is the OpenSSL cipher we use, this should never be changed... at least not without a lot of support to upgrading to a new cipher.
KICKASS_CRYPTO_OPENSSL_IV_LENGTH = 12
  2023-04-05 jj5 - this is the length of the initialization vector expected by the openssl_encrypt() and openssl_decrypt() fucntions, this should not be changed.
KICKASS_CRYPTO_OPENSSL_OPTIONS = \OPENSSL_RAW_DATA
  2023-04-05 jj5 - these are the options for the OpenSSL openssl_encrypt() function, these should not be changed.
KICKASS_CRYPTO_OPENSSL_PASSPHRASE_LENGTH = 32
  2023-04-05 jj5 - this is the passphrase length excepted by the openssl_encrypt() function, this should not be changed.
KICKASS_CRYPTO_OPENSSL_TAG_LENGTH = 16
  2023-04-05 jj5 - this is the tag length of the tag generated by the openssl_encrypt() function and expected by the openssl_decrypt() function, this should not be changed.
KICKASS_CRYPTO_PASSPHRASE_LENGTH_MIN = 32
  2023-04-05 jj5 - the minimum key length is used to ensure that passphrases meet at least a minimal requirement.
KICKASS_CRYPTO_RECURSION_LIMIT = 100
  2023-04-07 jj5 - this is the limit of recursion that we allow... the Xdebug limit is 256 and PHP by itself has no limit (it will recurse until it runs out of memory); we pick a value less than the Xdebug limit so that we can handle things ourselves.
KICKASS_CRYPTO_REGEX_BASE64 = '/^[a-zA-Z0-9\\/+]{2,}={0,2}$/'
  2023-04-05 jj5 - this is our Base64 validation regex; see the link for discussion concerning the previous regex and poor performance.
KICKASS_CRYPTO_SODIUM_PASSPHRASE_LENGTH = \SODIUM_CRYPTO_SECRETBOX_KEYBYTES
  2023-04-05 jj5 - this is the length of the passphrase (it's the $key parameter) expected by the sodium_crypto_secretbox() function.
kickass_crypto_autoload() : bool
  2023-04-05 jj5 - this function registered with PHP's spl_autoload_register() to provide automatic loading of namespace elements.
kickass_crypto_validate_environment() : void
  2023-03-31 jj5 - this function is for validating our run-time environment. If there's a problem then we exit, unless the programmer has overridden that behavior by defining certain constants.
kickass_crypto_validate_environment_openssl() : void
  2023-03-31 jj5 - this function is for validating our run-time environment. If there's a problem then we exit, unless the programmer has overridden that behavior by defining certain constants.
kickass_crypto_validate_environment_sodium() : void
  2023-04-03 jj5 - this function is for validating our run-time environment. If there's a problem then we exit, unless the programmer has overridden that behavior by defining certain constants.
main() : void
  2023-03-31 jj5 - this function hosts a unit test, it's just for convenience. It sets up your environment and then calls run_test() which you should define. If debugging is enabled then no try-catch block is used, otherwise it is. Also we make sure DEBUG is defined before we run your code so you shouldn't have to worry about whether it is defined or not.
kickass_crypto_validate_php() : void
  2023-04-04 jj5 - this function makes sure we're running a supported version of PHP; don't use fancy PHP features because they might not be available in older versions.
kickass_round_trip() : IKickassCrypto
  2023-04-05 jj5 - this is the round-trip service locator defined for use by the OpenSSL module.
kickass_at_rest() : IKickassCrypto
  2023-04-05 jj5 - this is the at-rest service locator defined for use by the OpenSSL module.
kickass_round_trip() : IKickassCrypto
  2023-04-05 jj5 - this is the round-trip service locator defined for use by the Sodium module.
kickass_at_rest() : IKickassCrypto
  2023-04-05 jj5 - this is the at-rest service locator defined for use by the Sodium module.
kickass_crypto_setup_unit_test_environment() : void
  2023-04-05 jj5 - this function will set up a test environment.
kickass_crypto_get_floats() : void
  2023-04-05 jj5 - this function will generate a bunch of special purpose floating-point values.
kickass_crypto_setup_environment() : void
  2023-04-05 jj5 - this function will set up a standard run-time environment.
kickass_crypto_handle_error() : mixed
  2023-04-05 jj5 - this function handles a PHP error by throwing it as an ErrorException. This function is called by PHP when it's registered as an error handler with the set_error_handler() function. This function doesn't throw if error reporting is disabled.
kickass_crypto_exit() : void
  2023-04-05 jj5 - this function will exit the process with a suitable error level.
kickass_crypto_change_dir() : void
  2023-04-05 jj5 - this function will change the current directory; if there's any sort of problem the program will be immediately aborted with an appropriate error level; this function is for command-line scripts, not web services.
kickass_crypto_report_error() : void
  2023-04-05 jj5 - this function prints a line of text to STDERR.
kickass_crypto_is_set() : bool
  2023-04-05 jj5 - this function tests to see if a given flag is set within a set of flags.
kickass_crypto_bits_split() : array<int, int>
  2023-04-05 jj5 - this function splits a set of flags into a list of singular flag values.

### Constants

#### KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_OPENSSL_SECRET_CURR

openssl.php : 88

2023-04-05 jj5 - this happens when CONFIG_OPENSSL_SECRET_CURR is defined for the round-trip use case and the OpenSSL module but it is not valid.

`public string KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_OPENSSL_SECRET_CURR = 'config invalid: CONFIG_OPENSSL_SECRET_CURR.'`

#### KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_OPENSSL_SECRET_LIST

openssl.php : 121

2023-04-05 jj5 - this happens when CONFIG_OPENSSL_SECRET_LIST is defined for the at-rest use case and the OpenSSL module but it is not valid.

`public string KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_OPENSSL_SECRET_LIST = 'config invalid: CONFIG_OPENSSL_SECRET_LIST.'`

#### KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_OPENSSL_SECRET_PREV

openssl.php : 99

2023-04-05 jj5 - this happens when CONFIG_OPENSSL_SECRET_PREV is defined for the round-trip use case and the OpenSSL module but it is not valid.

`public string KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_OPENSSL_SECRET_PREV = 'config invalid: CONFIG_OPENSSL_SECRET_PREV.'`

#### KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_SODIUM_SECRET_CURR

sodium.php : 56

2023-04-05 jj5 - this happens when CONFIG_SODIUM_SECRET_CURR is defined for the round-trip use case and the Sodium module but it is not valid.

`public string KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_SODIUM_SECRET_CURR = 'config invalid: CONFIG_SODIUM_SECRET_CURR.'`

#### KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_SODIUM_SECRET_LIST

sodium.php : 89

2023-04-05 jj5 - this happens when CONFIG_SODIUM_SECRET_LIST is defined for the at-rest use case and the Sodium module but it is not valid.

`public string KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_SODIUM_SECRET_LIST = 'config invalid: CONFIG_SODIUM_SECRET_LIST.'`

#### KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_SODIUM_SECRET_PREV

sodium.php : 67

2023-04-05 jj5 - this happens when CONFIG_SODIUM_SECRET_PREV is defined for the round-trip use case and the Sodium module but it is not valid.

`public string KICKASS_CRYPTO_CONFIG_PROBLEM_INVALID_SODIUM_SECRET_PREV = 'config invalid: CONFIG_SODIUM_SECRET_PREV.'`

#### KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_OPENSSL_SECRET_CURR

openssl.php : 77

2023-04-05 jj5 - this happens when CONFIG_OPENSSL_SECRET_CURR is not defined for the round-trip use case and the OpenSSL module.

`public string KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_OPENSSL_SECRET_CURR = 'config missing: CONFIG_OPENSSL_SECRET_CURR.'`

#### KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_OPENSSL_SECRET_LIST

openssl.php : 110

2023-04-05 jj5 - this happens when CONFIG_OPENSSL_SECRET_LIST is not defined for the at-rest use case and the OpenSSL module.

`public string KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_OPENSSL_SECRET_LIST = 'config missing: CONFIG_OPENSSL_SECRET_LIST.'`

#### KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_SODIUM_SECRET_CURR

sodium.php : 45

2023-04-05 jj5 - this happens when CONFIG_SODIUM_SECRET_CURR is not defined for the round-trip use case and the Sodium module.

`public string KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_SODIUM_SECRET_CURR = 'config missing: CONFIG_SODIUM_SECRET_CURR.'`

#### KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_SODIUM_SECRET_LIST

sodium.php : 78

2023-04-05 jj5 - this happens when CONFIG_SODIUM_SECRET_LIST is not defined for the at-rest use case and the Sodium module.

`public string KICKASS_CRYPTO_CONFIG_PROBLEM_MISSING_SODIUM_SECRET_LIST = 'config missing: CONFIG_SODIUM_SECRET_LIST.'`

#### KICKASS_CRYPTO_DATA_ENCODING_JSON

framework.php : 57

2023-04-04 jj5 - the JSON format uses the PHP json_encode() and json_decode() functions; the encoding format strings must be four characters long.

`public string KICKASS_CRYPTO_DATA_ENCODING_JSON = 'json'`

#### KICKASS_CRYPTO_DATA_ENCODING_PHPS

framework.php : 66

2023-04-04 jj5 - uses the PHP serialize() and unserialize() functions (not enabled by default due to potential security issues, enable with CONFIG_ENCRYPTION_PHPS_ENABLE); the encoding format strings must be four characters long.

`public string KICKASS_CRYPTO_DATA_ENCODING_PHPS = 'phps'`

#### KICKASS_CRYPTO_DATA_ENCODING_TEXT

framework.php : 73

2023-04-07 jj5 - encode as text.

`public string KICKASS_CRYPTO_DATA_ENCODING_TEXT = 'text'`

#### KICKASS_CRYPTO_DATA_FORMAT_LENGTH_MAX

framework.php : 114

2023-04-05 jj5 - the data format indicator must meet this maximum character length.

`public int KICKASS_CRYPTO_DATA_FORMAT_LENGTH_MAX = 8`

..

#### KICKASS_CRYPTO_DATA_FORMAT_LENGTH_MIN

framework.php : 107

2023-04-05 jj5 - the data format indicator must meet this minimum character length.

`public int KICKASS_CRYPTO_DATA_FORMAT_LENGTH_MIN = 2`

..

#### KICKASS_CRYPTO_DATA_FORMAT_OPENSSL

framework.php : 92

2023-04-05 jj5 - the OpenSSL data format.

`public string KICKASS_CRYPTO_DATA_FORMAT_OPENSSL = 'KA0'`

..

#### KICKASS_CRYPTO_DATA_FORMAT_SODIUM

framework.php : 100

2023-04-05 jj5 - the Sodium data format.

`public string KICKASS_CRYPTO_DATA_FORMAT_SODIUM = 'KAS0'`

..

#### KICKASS_CRYPTO_DEFAULT_CHUNK_SIZE

framework.php : 122

2023-04-05 jj5 - this is the default chunk size; messages are padded up to the message length modulo the chunk size; 2^12 is 4KiB; this value might be changed in future.

`public int KICKASS_CRYPTO_DEFAULT_CHUNK_SIZE = \pow(2, 12)`

#### KICKASS_CRYPTO_DEFAULT_CHUNK_SIZE_MAX

framework.php : 130

2023-04-05 jj5 - this is the default maximum chunk size; 2^26 is 64 MiB; this value might be changed in future.

`public int KICKASS_CRYPTO_DEFAULT_CHUNK_SIZE_MAX = \pow(2, 26)`

#### KICKASS_CRYPTO_DEFAULT_DATA_ENCODING

framework.php : 137

2023-04-05 jj5 - default data encoding format is JSON.

`public string KICKASS_CRYPTO_DEFAULT_DATA_ENCODING = \KICKASS_CRYPTO_DATA_ENCODING_JSON`

#### KICKASS_CRYPTO_DEFAULT_DATA_LENGTH_MAX

framework.php : 145

2023-04-05 jj5 - this is the maximum data length supported; 2^26 is 64 MiB; this value might be changed in future.

`public int KICKASS_CRYPTO_DEFAULT_DATA_LENGTH_MAX = \pow(2, 26)`

#### KICKASS_CRYPTO_DEFAULT_FALSE_ENABLE

framework.php : 191

2023-04-05 jj5 - by default you can't encrypt false.

`public bool KICKASS_CRYPTO_DEFAULT_FALSE_ENABLE = \false`

..

#### KICKASS_CRYPTO_DEFAULT_JSON_DECODE_OPTIONS

framework.php : 164

2023-04-05 jj5 - these are the default JSON decoding options passed to the PHP json_decode() function.

`public int KICKASS_CRYPTO_DEFAULT_JSON_DECODE_OPTIONS = \JSON_THROW_ON_ERROR`

#### KICKASS_CRYPTO_DEFAULT_JSON_ENCODE_OPTIONS

framework.php : 153

2023-04-05 jj5 - these are the default JSON encoding options passed to the PHP json_encode() function.

`public int KICKASS_CRYPTO_DEFAULT_JSON_ENCODE_OPTIONS = \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE`

#### KICKASS_CRYPTO_DEFAULT_PHPS_ENABLE

framework.php : 184

2023-04-05 jj5 - PHP serialization is disabled by default because it can lead to code execution vulnerabilities... (I don't have a source for this claim, that might be a rumor or not true any more).

`public bool KICKASS_CRYPTO_DEFAULT_PHPS_ENABLE = \false`

2023-04-05 jj5 - also note that you would only deserialize data which was successfully encrypted, so that would presumably make it harder for an attacker to inject code via PHP serialization format.

2023-04-05 jj5 - if you want to enable PHP serialization you will need these two defines in your config file:

define( 'CONFIG_ENCRYPTION_PHPS_ENABLE', true );

define( 'CONFIG_ENCRYPTION_DATA_ENCODING', KICKASS_CRYPTO_DATA_ENCODING_PHPS );

#### KICKASS_CRYPTO_DELAY_NANOSECONDS_MAX

framework.php : 207

2023-04-05 jj5 - the maximum random delay (in nanoseconds) used for timing attack mitigation; this value might be changed in future.

`public int KICKASS_CRYPTO_DELAY_NANOSECONDS_MAX = 10000000000`

#### KICKASS_CRYPTO_DELAY_NANOSECONDS_MIN

framework.php : 199

2023-04-05 jj5 - the minimum random delay (in nanoseconds) used for timing attack mitigation; this value might be changed in future.

`public int KICKASS_CRYPTO_DELAY_NANOSECONDS_MIN = 1000000`

#### KICKASS_CRYPTO_DELAY_SECONDS_MIN

framework.php : 216

2023-04-03 jj5 - this delay is a floating-point value in seconds, it's for comparison of the value returned from the PHP microtime() to check that our delay implementation did actually delay for at least this minimum amount of time.

`public float KICKASS_CRYPTO_DELAY_SECONDS_MIN = 1.0 / (\KICKASS_CRYPTO_DELAY_NANOSECONDS_MIN / 1000)`

#### KICKASS_CRYPTO_DISABLE_CIPHER_VALIDATION

KickassOpenSsl.php : 65

2023-04-07 jj5 - programmers can disable cipher validation by defining this constant as true.

`public bool KICKASS_CRYPTO_DISABLE_CIPHER_VALIDATION = false`

#### KICKASS_CRYPTO_DISABLE_CONFIG_VALIDATION

KickassCrypto.php : 110

2023-04-07 jj5 - programmers can disable config validation by defining this constant as true.

`public bool KICKASS_CRYPTO_DISABLE_CONFIG_VALIDATION = false`

#### KICKASS_CRYPTO_DISABLE_IV_LENGTH_VALIDATION

KickassOpenSsl.php : 77

2023-04-07 jj5 - programmers can disable initialization vector length validation by defining this constant as true.

`public bool KICKASS_CRYPTO_DISABLE_IV_LENGTH_VALIDATION = false`

#### KICKASS_CRYPTO_DISABLE_KEY_HASH_VALIDATION

KickassCrypto.php : 122

2023-04-07 jj5 - programmers can disable secret key hash function validation by defining this constant as true.

`public bool KICKASS_CRYPTO_DISABLE_KEY_HASH_VALIDATION = false`

#### KICKASS_CRYPTO_DISABLE_PHP_VERSION_CHECK

check.php : 47

2023-04-05 jj5 - defines whether the PHP version check is disabled or not.

`public bool KICKASS_CRYPTO_DISABLE_PHP_VERSION_CHECK = false`

#### KICKASS_CRYPTO_DISABLE_RANDOM_BYTES_VALIDATION

KickassCrypto.php : 134

2023-04-07 jj5 - programmers can disable validation of the random_bytes() function by defining this constant as true.

`public bool KICKASS_CRYPTO_DISABLE_RANDOM_BYTES_VALIDATION = false`

#### KICKASS_CRYPTO_ERROR_BASE64_DECODING_FAILED

framework.php : 573
`public string KICKASS_CRYPTO_ERROR_BASE64_DECODING_FAILED = 'base64 decoding failed.'`

#### KICKASS_CRYPTO_ERROR_BASE64_DECODING_FAILED_2

framework.php : 578
`public string KICKASS_CRYPTO_ERROR_BASE64_DECODING_FAILED_2 = 'base64 decoding failed (2).'`

#### KICKASS_CRYPTO_ERROR_BINARY_DATA_INVALID

framework.php : 668
`public string KICKASS_CRYPTO_ERROR_BINARY_DATA_INVALID = 'binary data invalid.'`

#### KICKASS_CRYPTO_ERROR_BINARY_LENGTH_INVALID

framework.php : 613
`public string KICKASS_CRYPTO_ERROR_BINARY_LENGTH_INVALID = 'binary length invalid.'`

#### KICKASS_CRYPTO_ERROR_CANNOT_ENCRYPT_FALSE

framework.php : 583
`public string KICKASS_CRYPTO_ERROR_CANNOT_ENCRYPT_FALSE = 'cannot encrypt false.'`

#### KICKASS_CRYPTO_ERROR_CHUNK_SIZE_INVALID

framework.php : 608
`public string KICKASS_CRYPTO_ERROR_CHUNK_SIZE_INVALID = 'chunk size invalid.'`

#### KICKASS_CRYPTO_ERROR_CIPHERTEXT_INVALID

framework.php : 658
`public string KICKASS_CRYPTO_ERROR_CIPHERTEXT_INVALID = 'ciphertext invalid.'`

#### KICKASS_CRYPTO_ERROR_CIPHERTEXT_INVALID_2

framework.php : 663
`public string KICKASS_CRYPTO_ERROR_CIPHERTEXT_INVALID_2 = 'ciphertext invalid (2).'`

#### KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED

framework.php : 473
`public string KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED = 'data decoding failed.'`

#### KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED_2

framework.php : 478
`public string KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED_2 = 'data decoding failed (2).'`

#### KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED_3

framework.php : 483
`public string KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED_3 = 'data decoding failed (3).'`

#### KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED_4

framework.php : 488
`public string KICKASS_CRYPTO_ERROR_DATA_DECODING_FAILED_4 = 'data decoding failed (4).'`

#### KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED

framework.php : 393
`public string KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED = 'data encoding failed.'`

#### KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED_2

framework.php : 398
`public string KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED_2 = 'data encoding failed (2).'`

#### KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED_3

framework.php : 403
`public string KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED_3 = 'data encoding failed (3).'`

#### KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED_4

framework.php : 408
`public string KICKASS_CRYPTO_ERROR_DATA_ENCODING_FAILED_4 = 'data encoding failed (4).'`

#### KICKASS_CRYPTO_ERROR_DATA_ENCODING_INVALID

framework.php : 373
`public string KICKASS_CRYPTO_ERROR_DATA_ENCODING_INVALID = 'data encoding invalid.'`

#### KICKASS_CRYPTO_ERROR_DATA_ENCODING_INVALID_2

framework.php : 378
`public string KICKASS_CRYPTO_ERROR_DATA_ENCODING_INVALID_2 = 'data encoding invalid (2).'`

#### KICKASS_CRYPTO_ERROR_DATA_ENCODING_INVALID_3

framework.php : 383
`public string KICKASS_CRYPTO_ERROR_DATA_ENCODING_INVALID_3 = 'data encoding invalid (3).'`

#### KICKASS_CRYPTO_ERROR_DATA_ENCODING_TOO_LARGE

framework.php : 388
`public string KICKASS_CRYPTO_ERROR_DATA_ENCODING_TOO_LARGE = 'data encoding too large.'`

#### KICKASS_CRYPTO_ERROR_DECRYPTION_FAILED

framework.php : 648
`public string KICKASS_CRYPTO_ERROR_DECRYPTION_FAILED = 'decryption failed.'`

#### KICKASS_CRYPTO_ERROR_DECRYPTION_FAILED_2

framework.php : 653
`public string KICKASS_CRYPTO_ERROR_DECRYPTION_FAILED_2 = 'decryption failed (2).'`

#### KICKASS_CRYPTO_ERROR_ENCRYPTION_FAILED

framework.php : 638
`public string KICKASS_CRYPTO_ERROR_ENCRYPTION_FAILED = 'encryption failed.'`

#### KICKASS_CRYPTO_ERROR_ENCRYPTION_FAILED_2

framework.php : 643
`public string KICKASS_CRYPTO_ERROR_ENCRYPTION_FAILED_2 = 'encryption failed (2).'`

#### KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED

framework.php : 353
`public string KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED = 'exception raised.'`

#### KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED_2

framework.php : 358
`public string KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED_2 = 'exception raised (2).'`

#### KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED_3

framework.php : 363
`public string KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED_3 = 'exception raised (3).'`

#### KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED_4

framework.php : 368
`public string KICKASS_CRYPTO_ERROR_EXCEPTION_RAISED_4 = 'exception raised (4).'`

#### KICKASS_CRYPTO_ERROR_IV_LENGTH_INVALID

framework.php : 618
`public string KICKASS_CRYPTO_ERROR_IV_LENGTH_INVALID = 'IV length invalid.'`

#### KICKASS_CRYPTO_ERROR_IV_LENGTH_INVALID_2

framework.php : 623
`public string KICKASS_CRYPTO_ERROR_IV_LENGTH_INVALID_2 = 'IV length invalid (2).'`

#### KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED

framework.php : 493
`public string KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED = 'JSON decoding failed.'`

#### KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED_2

framework.php : 498
`public string KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED_2 = 'JSON decoding failed (2).'`

#### KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED_3

framework.php : 503
`public string KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED_3 = 'JSON decoding failed (3).'`

#### KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED_4

framework.php : 508
`public string KICKASS_CRYPTO_ERROR_JSON_DECODING_FAILED_4 = 'JSON decoding failed (4).'`

#### KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED

framework.php : 413
`public string KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED = 'JSON encoding failed.'`

#### KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED_2

framework.php : 418
`public string KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED_2 = 'JSON encoding failed (2).'`

#### KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED_3

framework.php : 423
`public string KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED_3 = 'JSON encoding failed (3).'`

#### KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED_4

framework.php : 428
`public string KICKASS_CRYPTO_ERROR_JSON_ENCODING_FAILED_4 = 'JSON encoding failed (4).'`

#### KICKASS_CRYPTO_ERROR_MESSAGE_DATA_LENGTH_RANGE_INVALID

framework.php : 683
`public string KICKASS_CRYPTO_ERROR_MESSAGE_DATA_LENGTH_RANGE_INVALID = 'message data length range invalid.'`

#### KICKASS_CRYPTO_ERROR_MESSAGE_DATA_LENGTH_SPEC_INVALID

framework.php : 678
`public string KICKASS_CRYPTO_ERROR_MESSAGE_DATA_LENGTH_SPEC_INVALID = 'message data length spec invalid.'`

#### KICKASS_CRYPTO_ERROR_MESSAGE_DECODING_FAILED

framework.php : 558
`public string KICKASS_CRYPTO_ERROR_MESSAGE_DECODING_FAILED = 'message decoding failed.'`

#### KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED

framework.php : 538
`public string KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED = 'message encoding failed.'`

#### KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED_2

framework.php : 543
`public string KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED_2 = 'message encoding failed (2).'`

#### KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED_3

framework.php : 548
`public string KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED_3 = 'message encoding failed (3).'`

#### KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED_4

framework.php : 553
`public string KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_FAILED_4 = 'message encoding failed (4).'`

#### KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_INVALID

framework.php : 563
`public string KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_INVALID = 'message encoding invalid.'`

#### KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_UNKNOWN

framework.php : 568
`public string KICKASS_CRYPTO_ERROR_MESSAGE_ENCODING_UNKNOWN = 'message encoding unknown.'`

#### KICKASS_CRYPTO_ERROR_MESSAGE_FORMAT_INVALID

framework.php : 673
`public string KICKASS_CRYPTO_ERROR_MESSAGE_FORMAT_INVALID = 'message format invalid.'`

#### KICKASS_CRYPTO_ERROR_MESSAGE_LENGTH_INVALID

framework.php : 688
`public string KICKASS_CRYPTO_ERROR_MESSAGE_LENGTH_INVALID = 'message length invalid.'`

#### KICKASS_CRYPTO_ERROR_NO_VALID_KEY

framework.php : 693
`public string KICKASS_CRYPTO_ERROR_NO_VALID_KEY = 'no valid key.'`

#### KICKASS_CRYPTO_ERROR_PASSPHRASE_INVALID

framework.php : 593
`public string KICKASS_CRYPTO_ERROR_PASSPHRASE_INVALID = 'passphrase invalid.'`

#### KICKASS_CRYPTO_ERROR_PASSPHRASE_LENGTH_INVALID

framework.php : 598
`public string KICKASS_CRYPTO_ERROR_PASSPHRASE_LENGTH_INVALID = 'passphrase length invalid.'`

#### KICKASS_CRYPTO_ERROR_PASSPHRASE_LENGTH_INVALID_2

framework.php : 603
`public string KICKASS_CRYPTO_ERROR_PASSPHRASE_LENGTH_INVALID_2 = 'passphrase length invalid (2).'`

#### KICKASS_CRYPTO_ERROR_PASSPHRASE_MISSING

framework.php : 588
`public string KICKASS_CRYPTO_ERROR_PASSPHRASE_MISSING = 'passphrase missing.'`

#### KICKASS_CRYPTO_ERROR_PHPS_DECODING_FAILED

framework.php : 513
`public string KICKASS_CRYPTO_ERROR_PHPS_DECODING_FAILED = 'PHPS decoding failed.'`

#### KICKASS_CRYPTO_ERROR_PHPS_DECODING_FAILED_2

framework.php : 518
`public string KICKASS_CRYPTO_ERROR_PHPS_DECODING_FAILED_2 = 'PHPS decoding failed (2).'`

#### KICKASS_CRYPTO_ERROR_PHPS_ENCODING_DISABLED

framework.php : 448
`public string KICKASS_CRYPTO_ERROR_PHPS_ENCODING_DISABLED = 'PHPS encoding disabled.'`

#### KICKASS_CRYPTO_ERROR_PHPS_ENCODING_DISABLED_2

framework.php : 453
`public string KICKASS_CRYPTO_ERROR_PHPS_ENCODING_DISABLED_2 = 'PHPS encoding disabled (2).'`

#### KICKASS_CRYPTO_ERROR_PHPS_ENCODING_FAILED

framework.php : 433
`public string KICKASS_CRYPTO_ERROR_PHPS_ENCODING_FAILED = 'PHPS encoding failed.'`

#### KICKASS_CRYPTO_ERROR_PHPS_ENCODING_FAILED_2

framework.php : 438
`public string KICKASS_CRYPTO_ERROR_PHPS_ENCODING_FAILED_2 = 'PHPS encoding failed (2).'`

#### KICKASS_CRYPTO_ERROR_PHPS_ENCODING_FAILED_3

framework.php : 443
`public string KICKASS_CRYPTO_ERROR_PHPS_ENCODING_FAILED_3 = 'PHPS encoding failed (3).'`

#### KICKASS_CRYPTO_ERROR_RESULT_INVALID

framework.php : 348
`public string KICKASS_CRYPTO_ERROR_RESULT_INVALID = 'result invalid.'`

#### KICKASS_CRYPTO_ERROR_TAG_LENGTH_INVALID

framework.php : 628
`public string KICKASS_CRYPTO_ERROR_TAG_LENGTH_INVALID = 'tag length invalid.'`

#### KICKASS_CRYPTO_ERROR_TAG_LENGTH_INVALID_2

framework.php : 633
`public string KICKASS_CRYPTO_ERROR_TAG_LENGTH_INVALID_2 = 'tag length invalid (2).'`

#### KICKASS_CRYPTO_ERROR_TEXT_DECODING_FAILED

framework.php : 523
`public string KICKASS_CRYPTO_ERROR_TEXT_DECODING_FAILED = 'text decoding failed.'`

#### KICKASS_CRYPTO_ERROR_TEXT_DECODING_FAILED_2

framework.php : 528
`public string KICKASS_CRYPTO_ERROR_TEXT_DECODING_FAILED_2 = 'text decoding failed (2).'`

#### KICKASS_CRYPTO_ERROR_TEXT_DECODING_FAILED_3

framework.php : 533
`public string KICKASS_CRYPTO_ERROR_TEXT_DECODING_FAILED_3 = 'text decoding failed (3).'`

#### KICKASS_CRYPTO_ERROR_TEXT_ENCODING_FAILED

framework.php : 458
`public string KICKASS_CRYPTO_ERROR_TEXT_ENCODING_FAILED = 'text encoding failed.'`

#### KICKASS_CRYPTO_ERROR_TEXT_ENCODING_FAILED_2

framework.php : 463
`public string KICKASS_CRYPTO_ERROR_TEXT_ENCODING_FAILED_2 = 'text encoding failed (2).'`

#### KICKASS_CRYPTO_ERROR_TEXT_ENCODING_FAILED_3

framework.php : 468
`public string KICKASS_CRYPTO_ERROR_TEXT_ENCODING_FAILED_3 = 'text encoding failed (3).'`

#### KICKASS_CRYPTO_EXCEPTION_INSECURE_RANDOM

framework.php : 304

2023-04-05 jj5 - if the PHP random_bytes() implementation is not using a secure PRNG then this exception is supposed to be raised.

`public int KICKASS_CRYPTO_EXCEPTION_INSECURE_RANDOM = 6000`

#### KICKASS_CRYPTO_EXCEPTION_INVALID_CIPHER

framework.php : 288

2023-04-05 jj5 - if the cipher nominated for the OpenSSL library is not available in the environment this exception is raise.

`public int KICKASS_CRYPTO_EXCEPTION_INVALID_CIPHER = 4000`

#### KICKASS_CRYPTO_EXCEPTION_INVALID_CONFIG

framework.php : 273

2023-04-05 jj5 - this exception is raise if the config is invalid. Modules define what constitutes a valid config based on the use case.

`public int KICKASS_CRYPTO_EXCEPTION_INVALID_CONFIG = 2000`

2023-04-05 jj5 - possible combinations of encryption module and use case are:

- Sodium round-trip
- Sodium at-rest
- OpenSSL round-trip
- OpenSSL at-rest

#### KICKASS_CRYPTO_EXCEPTION_INVALID_ERROR_LIST

framework.php : 312

2023-04-06 jj5 - if we can't get a valid error list from an implementation we bail with an exception.

`public int KICKASS_CRYPTO_EXCEPTION_INVALID_ERROR_LIST = 7000`

#### KICKASS_CRYPTO_EXCEPTION_INVALID_EXCEPTION_CODE

framework.php : 258

2023-04-05 jj5 - if an invalid exception code is passed to the exception raising facility this exception is raised instead.

`public int KICKASS_CRYPTO_EXCEPTION_INVALID_EXCEPTION_CODE = 1000`

#### KICKASS_CRYPTO_EXCEPTION_INVALID_IV_LENGTH

framework.php : 296

2023-04-05 jj5 - if the initialization vector for the OpenSSL library is not what we've been coded to expect then this exception is raise.

`public int KICKASS_CRYPTO_EXCEPTION_INVALID_IV_LENGTH = 5000`

#### KICKASS_CRYPTO_EXCEPTION_INVALID_KEY_HASH

framework.php : 280

2023-04-05 jj5 - if the hash algorithm is invalid or not available this exception is raised.

`public int KICKASS_CRYPTO_EXCEPTION_INVALID_KEY_HASH = 3000`

#### KICKASS_CRYPTO_EXCEPTION_MESSAGE

framework.php : 327

2023-03-30 jj5 - these are the exception messages for each exception code. These exception messages should be stable, you can add new ones but don't change existing ones.

`public array<int, string> KICKASS_CRYPTO_EXCEPTION_MESSAGE = [\KICKASS_CRYPTO_EXCEPTION_INVALID_EXCEPTION_CODE => 'invalid exception code.', \KICKASS_CRYPTO_EXCEPTION_INVALID_CONFIG => 'invalid config.', \KICKASS_CRYPTO_EXCEPTION_INVALID_KEY_HASH => 'invalid key hash.', \KICKASS_CRYPTO_EXCEPTION_INVALID_CIPHER => 'invalid cipher.', \KICKASS_CRYPTO_EXCEPTION_INVALID_IV_LENGTH => 'invalid IV length.', \KICKASS_CRYPTO_EXCEPTION_INSECURE_RANDOM => 'insecure random.', \KICKASS_CRYPTO_EXCEPTION_INVALID_ERROR_LIST => 'invalid error list.', \KICKASS_CRYPTO_EXCEPTION_RECURSION_DETECTED => 'recursion detected.']`

#### KICKASS_CRYPTO_EXCEPTION_RECURSION_DETECTED

framework.php : 319

2023-04-07 jj5 - called if recursion/reentrancy is detected.

`public int KICKASS_CRYPTO_EXCEPTION_RECURSION_DETECTED = 8000`

#### KICKASS_CRYPTO_EXIT_ASSERT

exit.php : 90

2023-04-05 jj5 - the error level to return when the program exits due to an assertion violation.

`public int KICKASS_CRYPTO_EXIT_ASSERT = 83`

##### Tags

link
  https://www.jj5.net/sixsigma/Error_levels#83

#### KICKASS_CRYPTO_EXIT_BAD_ENVIRONMENT

exit.php : 49

2023-04-05 jj5 - the error level to return when the program can't run due to an invalid run-time environment.

`public int KICKASS_CRYPTO_EXIT_BAD_ENVIRONMENT = 60`

##### Tags

link
  https://www.jj5.net/sixsigma/Error_levels#60

#### KICKASS_CRYPTO_EXIT_CANNOT_CONTINUE

exit.php : 39

2023-04-05 jj5 - the error level to return when nothing is broken or wrong but the program cannot continue.

`public int KICKASS_CRYPTO_EXIT_CANNOT_CONTINUE = 10`

##### Tags

link
  https://www.jj5.net/sixsigma/Error_levels#10

#### KICKASS_CRYPTO_EXIT_ERROR

exit.php : 73

2023-04-05 jj5 - the error level to return when the program exits due to an error.

`public int KICKASS_CRYPTO_EXIT_ERROR = 81`

##### Tags

link
  https://www.jj5.net/sixsigma/Error_levels#81

#### KICKASS_CRYPTO_EXIT_EXCEPTION

exit.php : 81

2023-04-05 jj5 - the error level to return when the program exits due to an exception.

`public int KICKASS_CRYPTO_EXIT_EXCEPTION = 82`

##### Tags

link
  https://www.jj5.net/sixsigma/Error_levels#82

#### KICKASS_CRYPTO_EXIT_FILE_MISSING

exit.php : 57

2023-04-05 jj5 - the error level to return when a file is missing.

`public int KICKASS_CRYPTO_EXIT_FILE_MISSING = 61`

##### Tags

link
  https://www.jj5.net/sixsigma/Error_levels#61

#### KICKASS_CRYPTO_EXIT_HELP

exit.php : 125

2023-04-05 jj5 - the error level to return when help (or version) has been requested; this is not an error but it does return a non-zero error level for safety.

`public int KICKASS_CRYPTO_EXIT_HELP = 99`

##### Tags

link
  https://www.jj5.net/sixsigma/Error_levels#99

#### KICKASS_CRYPTO_EXIT_INVALID

exit.php : 107

2023-04-05 jj5 - the error level to return when the program tries to exit with an invalid error level.

`public int KICKASS_CRYPTO_EXIT_INVALID = 89`

##### Tags

link
  https://www.jj5.net/sixsigma/Error_levels#89

#### KICKASS_CRYPTO_EXIT_OPTIONS_LISTED

exit.php : 116

2023-04-05 jj5 - the error level to return when program options have been requested; this is not an error but it does return a non-zero error level for safety.

`public int KICKASS_CRYPTO_EXIT_OPTIONS_LISTED = 98`

##### Tags

link
  https://www.jj5.net/sixsigma/Error_levels#98

#### KICKASS_CRYPTO_EXIT_PROBLEM

exit.php : 65

2023-04-05 jj5 - the error level to return when there's a problem with the program.

`public int KICKASS_CRYPTO_EXIT_PROBLEM = 80`

##### Tags

link
  https://www.jj5.net/sixsigma/Error_levels#80

#### KICKASS_CRYPTO_EXIT_SUCCESS

exit.php : 29

2023-04-05 jj5 - the error level to return upon success.

`public int KICKASS_CRYPTO_EXIT_SUCCESS = 0`

#### KICKASS_CRYPTO_EXIT_TEST_FAILED

exit.php : 98

2023-04-05 jj5 - the error level to return when a unit-test failed.

`public int KICKASS_CRYPTO_EXIT_TEST_FAILED = 84`

##### Tags

link
  https://www.jj5.net/sixsigma/Error_levels#84

#### KICKASS_CRYPTO_KEY_HASH

framework.php : 33

2023-04-05 jj5 - the key has is used to convert a secret key into a 32 byte (256-bit) passphrase for use with either the OpenSSL or Sodium encryption library.

`public string KICKASS_CRYPTO_KEY_HASH = 'sha512/256'`

#### KICKASS_CRYPTO_KEY_LENGTH_MIN

framework.php : 41

2023-04-05 jj5 - the minimum key length is used to ensure that secret keys meet at least a minimal requirement.

`public int KICKASS_CRYPTO_KEY_LENGTH_MIN = 88`

#### KICKASS_CRYPTO_LOG_ERROR_INVALID_PASSPHRASE

framework.php : 702
`public string KICKASS_CRYPTO_LOG_ERROR_INVALID_PASSPHRASE = 'error: invalid passphrase.'`

#### KICKASS_CRYPTO_LOG_PREFIX_EMERGENCY_DELAY

framework.php : 722
`public string KICKASS_CRYPTO_LOG_PREFIX_EMERGENCY_DELAY = 'emergency delay: '`

#### KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_HANDLE

framework.php : 727
`public string KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_HANDLE = 'handled exception: '`

#### KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_IGNORE

framework.php : 737
`public string KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_IGNORE = 'ignored exception: '`

#### KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_NOTIFY

framework.php : 732
`public string KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_NOTIFY = 'caught exception: '`

#### KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_THROW

framework.php : 742
`public string KICKASS_CRYPTO_LOG_PREFIX_EXCEPTION_THROW = 'throwing exception: '`

#### KICKASS_CRYPTO_LOG_WARNING_DELAY

framework.php : 717
`public string KICKASS_CRYPTO_LOG_WARNING_DELAY = 'warning: delayed due to error.'`

#### KICKASS_CRYPTO_LOG_WARNING_SHORT_PASSPHRASE

framework.php : 712
`public string KICKASS_CRYPTO_LOG_WARNING_SHORT_PASSPHRASE = 'warning: passphrase shorter than recommended.'`

#### KICKASS_CRYPTO_LOG_WARNING_SHORT_SECRET

framework.php : 707
`public string KICKASS_CRYPTO_LOG_WARNING_SHORT_SECRET = 'warning: secret shorter than recommended.'`

#### KICKASS_CRYPTO_OPENSSL_CIPHER

openssl.php : 33

2023-04-05 jj5 - this is the OpenSSL cipher we use, this should never be changed... at least not without a lot of support to upgrading to a new cipher.

`public string KICKASS_CRYPTO_OPENSSL_CIPHER = 'aes-256-gcm'`

#### KICKASS_CRYPTO_OPENSSL_IV_LENGTH

openssl.php : 57

2023-04-05 jj5 - this is the length of the initialization vector expected by the openssl_encrypt() and openssl_decrypt() fucntions, this should not be changed.

`public int KICKASS_CRYPTO_OPENSSL_IV_LENGTH = 12`

#### KICKASS_CRYPTO_OPENSSL_OPTIONS

openssl.php : 41

2023-04-05 jj5 - these are the options for the OpenSSL openssl_encrypt() function, these should not be changed.

`public int KICKASS_CRYPTO_OPENSSL_OPTIONS = \OPENSSL_RAW_DATA`

#### KICKASS_CRYPTO_OPENSSL_PASSPHRASE_LENGTH

openssl.php : 49

2023-04-05 jj5 - this is the passphrase length excepted by the openssl_encrypt() function, this should not be changed.

`public int KICKASS_CRYPTO_OPENSSL_PASSPHRASE_LENGTH = 32`

#### KICKASS_CRYPTO_OPENSSL_TAG_LENGTH

openssl.php : 65

2023-04-05 jj5 - this is the tag length of the tag generated by the openssl_encrypt() function and expected by the openssl_decrypt() function, this should not be changed.

`public int KICKASS_CRYPTO_OPENSSL_TAG_LENGTH = 16`

#### KICKASS_CRYPTO_PASSPHRASE_LENGTH_MIN

framework.php : 49

2023-04-05 jj5 - the minimum key length is used to ensure that passphrases meet at least a minimal requirement.

`public int KICKASS_CRYPTO_PASSPHRASE_LENGTH_MIN = 32`

#### KICKASS_CRYPTO_RECURSION_LIMIT

framework.php : 246

2023-04-07 jj5 - this is the limit of recursion that we allow... the Xdebug limit is 256 and PHP by itself has no limit (it will recurse until it runs out of memory); we pick a value less than the Xdebug limit so that we can handle things ourselves.

`public int KICKASS_CRYPTO_RECURSION_LIMIT = 100`

#### KICKASS_CRYPTO_REGEX_BASE64

framework.php : 229

2023-04-05 jj5 - this is our Base64 validation regex; see the link for discussion concerning the previous regex and poor performance.

`public string KICKASS_CRYPTO_REGEX_BASE64 = '/^[a-zA-Z0-9\\/+]{2,}={0,2}$/'`

##### Tags

link
  https://www.progclub.org/blog/2023/04/01/php-preg_match-regex-fail/

#### KICKASS_CRYPTO_SODIUM_PASSPHRASE_LENGTH

sodium.php : 33

2023-04-05 jj5 - this is the length of the passphrase (it's the $key parameter) expected by the sodium_crypto_secretbox() function.

`public int KICKASS_CRYPTO_SODIUM_PASSPHRASE_LENGTH = \SODIUM_CRYPTO_SECRETBOX_KEYBYTES`

### Functions

#### kickass_crypto_autoload()

autoload.php : 32

2023-04-05 jj5 - this function registered with PHP's spl_autoload_register() to provide automatic loading of namespace elements.

`kickass_crypto_autoload(string $class_name) : bool`

##### Parameters

$class_name : string

  the full name of the relevant interface, class, or trait.

##### Return values

bool —

true on success or false on failure (the return value is not used by PHP).

#### kickass_crypto_validate_environment()

framework.php : 36

2023-03-31 jj5 - this function is for validating our run-time environment. If there's a problem then we exit, unless the programmer has overridden that behavior by defining certain constants.

`kickass_crypto_validate_environment() : void`

- to disable PHP version check:

define( 'KICKASS_CRYPTO_DISABLE_PHP_VERSION_CHECK', true );

- to disable PHP 64-bit word size check:

define( 'KICKASS_CRYPTO_DISABLE_WORD_SIZE_CHECK', true );

##### Return values

void —

#### kickass_crypto_validate_environment_openssl()

openssl.php : 32

2023-03-31 jj5 - this function is for validating our run-time environment. If there's a problem then we exit, unless the programmer has overridden that behavior by defining certain constants.

`kickass_crypto_validate_environment_openssl() : void`

- to disable checks for the OpenSSL library functions:

define( 'KICKASS_CRYPTO_DISABLE_OPENSSL_CHECK', true );

##### Return values

void —

#### kickass_crypto_validate_environment_sodium()

sodium.php : 32

2023-04-03 jj5 - this function is for validating our run-time environment. If there's a problem then we exit, unless the programmer has overridden that behavior by defining certain constants.

`kickass_crypto_validate_environment_sodium() : void`

- to disable checks for the Sodium library functions:

define( 'KICKASS_CRYPTO_DISABLE_SODIUM_CHECK', true );

##### Return values

void —

#### main()

unit-test.php : 32

2023-03-31 jj5 - this function hosts a unit test, it's just for convenience. It sets up your environment and then calls run_test() which you should define. If debugging is enabled then no try-catch block is used, otherwise it is. Also we make sure DEBUG is defined before we run your code so you shouldn't have to worry about whether it is defined or not.

`main(array<string|int, mixed> $argv) : void`

##### Parameters

$argv : array<string|int, mixed>

  the command-line options.

##### Return values

void —

#### kickass_crypto_validate_php()

check.php : 30

2023-04-04 jj5 - this function makes sure we're running a supported version of PHP; don't use fancy PHP features because they might not be available in older versions.

`kickass_crypto_validate_php() : void`

##### Return values

void —

#### kickass_round_trip()

openssl.php : 42

2023-04-05 jj5 - this is the round-trip service locator defined for use by the OpenSSL module.

`kickass_round_trip([IKickassCrypto $set = false ]) : IKickassCrypto`

This component will use the round-trip keys defined for the OpenSSL module, those keys are defined with the CONFIG_OPENSSL_SECRET_CURR configuration constant (required) and the CONFIG_OPENSSL_SECRET_PREV configuration constant (optional).

##### Parameters

$set : IKickassCrypto = false

  pass a valid instance to reconfigure the service locator with a new service instance.

##### Tags

throws
  KickassCryptoException

  if the environment is determined to be unsupported during construction.

##### Return values

IKickassCrypto —

the crypto interface.

#### kickass_at_rest()

openssl.php : 71

2023-04-05 jj5 - this is the at-rest service locator defined for use by the OpenSSL module.

`kickass_at_rest([IKickassCrypto $set = false ]) : IKickassCrypto`

This component will use the at-rest keys defined for the OpenSSL module, those keys are defined with the CONFIG_OPENSSL_SECRET_LIST configuration constant.

##### Parameters

$set : IKickassCrypto = false

  pass a valid instance to reconfigure the service locator with a new service instance.

##### Tags

throws
  KickassCryptoException

  if the environment is determined to be unsupported during construction.

##### Return values

IKickassCrypto —

the crypto interface.

#### kickass_round_trip()

sodium.php : 42

2023-04-05 jj5 - this is the round-trip service locator defined for use by the Sodium module.

`kickass_round_trip([IKickassCrypto $set = false ]) : IKickassCrypto`

This component will use the round-trip keys defined for the Sodium module, those keys are defined with the CONFIG_SODIUM_SECRET_CURR configuration constant (required) and the CONFIG_SODIUM_SECRET_PREV configuration constant (optional).

##### Parameters

$set : IKickassCrypto = false

  pass a valid instance to reconfigure the service locator with a new service instance.

##### Tags

throws
  KickassCryptoException

  if the environment is determined to be unsupported during construction.

##### Return values

IKickassCrypto —

the crypto interface.

#### kickass_at_rest()

sodium.php : 71

2023-04-05 jj5 - this is the at-rest service locator defined for use by the Sodium module.

`kickass_at_rest([IKickassCrypto $set = false ]) : IKickassCrypto`

This component will use the at-rest keys defined for the Sodium module, those keys are defined with the CONFIG_SODIUM_SECRET_LIST configuration constant.

##### Parameters

$set : IKickassCrypto = false

  pass a valid instance to reconfigure the service locator with a new service instance.

##### Tags

throws
  KickassCryptoException

  if the environment is determined to be unsupported during construction.

##### Return values

IKickassCrypto —

the crypto interface.

#### kickass_crypto_setup_unit_test_environment()

util.php : 29

2023-04-05 jj5 - this function will set up a test environment.

`kickass_crypto_setup_unit_test_environment() : void`

##### Return values

void —

#### kickass_crypto_get_floats()

util.php : 59

2023-04-05 jj5 - this function will generate a bunch of special purpose floating-point values.

`kickass_crypto_get_floats([float &$nan = null ][, float &$pos_inf = null ][, float &$neg_inf = null ][, float &$pos_zero = null ][, float &$neg_zero = null ][, float &$float_min = null ][, float &$float_max = null ][, float &$epslion = null ]) : void`

##### Parameters

$nan : float = null

  the NaN (Not a Number) floating-point value

$pos_inf : float = null

  the positive infinity floating-point value

$neg_inf : float = null

  the negative infinity floating-point value

$pos_zero : float = null

  the positive zero floating-point value

$neg_zero : float = null

  the negative zero floating-point value

$float_min : float = null

  the minimum floating-point value

$float_max : float = null

  the maximum floating-point value

$epslion : float = null

  the smallest absolute non-zero floating-point value

##### Return values

void —

#### kickass_crypto_setup_environment()

error.php : 27

2023-04-05 jj5 - this function will set up a standard run-time environment.

`kickass_crypto_setup_environment() : void`

##### Return values

void —

#### kickass_crypto_handle_error()

error.php : 50

2023-04-05 jj5 - this function handles a PHP error by throwing it as an ErrorException. This function is called by PHP when it's registered as an error handler with the set_error_handler() function. This function doesn't throw if error reporting is disabled.

`kickass_crypto_handle_error(int $errno, string $errstr, string $errfile, string $errline) : mixed`

##### Parameters

$errno : int

  the error number.

$errstr : string

  the error string.

$errfile : string

  the file the error was triggered from.

$errline : string

  the line in the file the error was triggered from.

##### Tags

throws
  ErrorException

  the PHP ErrorException class.

##### Return values

mixed —

#### kickass_crypto_exit()

exit.php : 136

2023-04-05 jj5 - this function will exit the process with a suitable error level.

`kickass_crypto_exit([int|Exception $error = KICKASS_CRYPTO_EXIT_SUCCESS ][, int $default = KICKASS_CRYPTO_EXIT_PROBLEM ]) : void`

##### Parameters

$error : int|Exception = KICKASS_CRYPTO_EXIT_SUCCESS

  either the integer error level or an exception.

$default : int = KICKASS_CRYPTO_EXIT_PROBLEM

  the error level to use if $error is not valid.

##### Return values

void —

#### kickass_crypto_change_dir()

fs.php : 32

2023-04-05 jj5 - this function will change the current directory; if there's any sort of problem the program will be immediately aborted with an appropriate error level; this function is for command-line scripts, not web services.

`kickass_crypto_change_dir(string $dir) : void`

##### Parameters

$dir : string

  the directory to change into.

##### Return values

void —

#### kickass_crypto_report_error()

io.php : 30

2023-04-05 jj5 - this function prints a line of text to STDERR.

`kickass_crypto_report_error(string $line) : void`

##### Parameters

$line : string

  the line of text to print to STDERR.

##### Return values

void —

#### kickass_crypto_is_set()

twiddle.php : 31

2023-04-05 jj5 - this function tests to see if a given flag is set within a set of flags.

`kickass_crypto_is_set(int $flags, int $flag) : bool`

##### Parameters

$flags : int

  the flags which are specified.

$flag : int

  the flag which you're interested in.

##### Return values

bool —

true if the flag is set.

#### kickass_crypto_bits_split()

twiddle.php : 44

2023-04-05 jj5 - this function splits a set of flags into a list of singular flag values.

`kickass_crypto_bits_split(int $flags) : array<int, int>`

##### Parameters

$flags : int

  the flags which are specified.

##### Return values

array<int, int> —

the list of singular flag values.

## Search results