|
ILIAS
trunk Revision v13.0_alpha-62-g3b72d83f2e5
|
Encodes the opaque token the session reminder sends to sessioncheck.php.
More...
Collaboration diagram for ILIAS\Authentication\SessionReminder\TokenCipher:Public Member Functions | |
| __construct (private string $key) | |
| encode (int $user_id, string $session_hash) | |
| decode (string $token) | |
Static Public Member Functions | |
| static | fromKeyFile () |
Private Member Functions | |
| deriveSubkey (string $salt) | |
Private Attributes | |
| const string | CIPHER = 'aes-256-gcm' |
| const int | KEY_LENGTH = 32 |
| const int | SALT_LENGTH = 16 |
| const int | NONCE_LENGTH = 12 |
| const int | TAG_LENGTH = 16 |
| const string | CONTEXT = 'ilias_session_reminder_v1' |
| Binds the subkeys and the ciphertext to their purpose, a token of another context cannot be decrypted. More... | |
| const string | USER_ID = 'u' |
| const string | SESSION_HASH = 'h' |
Encodes the opaque token the session reminder sends to sessioncheck.php.
The token is encrypted (authenticated encryption, AES-256-GCM), so the client can neither read nor modify the contained user id and session hash.
Each token is encrypted with its own subkey, derived from the secret key and a random salt (HKDF). This way the limited number of encryptions per key (because of the 96 bit nonce of GCM) does not apply to the secret key, which is never replaced.
Token format (base64url): salt (16 bytes) | nonce (12 bytes) | ciphertext | authentication tag (16 bytes)
Definition at line 36 of file TokenCipher.php.
| ILIAS\Authentication\SessionReminder\TokenCipher::__construct | ( | private string | $key | ) |
| string | $key | Binary key |
Definition at line 53 of file TokenCipher.php.
| ILIAS\Authentication\SessionReminder\TokenCipher::decode | ( | string | $token | ) |
Definition at line 113 of file TokenCipher.php.
References $data, $token, ILIAS\Authentication\SessionReminder\TokenCipher\deriveSubkey(), ILIAS\Authentication\SessionReminder\TokenCipher\SESSION_HASH, and ILIAS\Authentication\SessionReminder\TokenCipher\USER_ID.
Here is the call graph for this function:
|
private |
Definition at line 154 of file TokenCipher.php.
Referenced by ILIAS\Authentication\SessionReminder\TokenCipher\decode(), and ILIAS\Authentication\SessionReminder\TokenCipher\encode().
Here is the caller graph for this function:| ILIAS\Authentication\SessionReminder\TokenCipher::encode | ( | int | $user_id, |
| string | $session_hash | ||
| ) |
Definition at line 85 of file TokenCipher.php.
References $user_id, and ILIAS\Authentication\SessionReminder\TokenCipher\deriveSubkey().
Here is the call graph for this function:
|
static |
SessionReminderKeyCreatedObjective), or the cipher is not available Definition at line 65 of file TokenCipher.php.
References $data, ILIAS\Authentication\Setup\SessionReminderKeyCreatedObjective\KEY, and ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\PATH().
Here is the call graph for this function:
|
private |
Definition at line 38 of file TokenCipher.php.
|
private |
Binds the subkeys and the ciphertext to their purpose, a token of another context cannot be decrypted.
Definition at line 46 of file TokenCipher.php.
|
private |
Definition at line 39 of file TokenCipher.php.
|
private |
Definition at line 41 of file TokenCipher.php.
|
private |
Definition at line 40 of file TokenCipher.php.
|
private |
Definition at line 48 of file TokenCipher.php.
Referenced by ILIAS\Authentication\SessionReminder\TokenCipher\decode().
|
private |
Definition at line 42 of file TokenCipher.php.
|
private |
Definition at line 47 of file TokenCipher.php.
Referenced by ILIAS\Authentication\SessionReminder\TokenCipher\decode().