Grima  2018-08
Whispering into Alma's ear
Variables
encrypt.php File Reference

Go to the source code of this file.

Variables

  $plaintext = "message to be encrypted"
 
  $cipher = "aes-128-ocb"
 
  $key = random_bytes(32)
 
  $ivlen = openssl_cipher_iv_length($cipher)
 
  $iv = random_bytes($ivlen)
 
  $ciphertext = openssl_encrypt($plaintext, $cipher, $key, $options=0, $iv, $tag)
 
  $original_plaintext = openssl_decrypt($ciphertext, $cipher, $key, $options=0, $iv, $tag)
 
  $other_plaintext = sodium_crypto_secretbox_open( $ciphertext, $iv, $key)
 

Variable Documentation

◆ $cipher

$cipher = "aes-128-ocb"

Definition at line 3 of file encrypt.php.

◆ $ciphertext

$ciphertext = openssl_encrypt($plaintext, $cipher, $key, $options=0, $iv, $tag)

Definition at line 11 of file encrypt.php.

Referenced by EncryptedCookieSession\read(), and EncryptedCookieSession\write().

◆ $iv

$iv = random_bytes($ivlen)

Definition at line 10 of file encrypt.php.

◆ $ivlen

$ivlen = openssl_cipher_iv_length($cipher)

Definition at line 6 of file encrypt.php.

◆ $key

$key = random_bytes(32)

◆ $original_plaintext

$original_plaintext = openssl_decrypt($ciphertext, $cipher, $key, $options=0, $iv, $tag)

Definition at line 17 of file encrypt.php.

◆ $other_plaintext

$other_plaintext = sodium_crypto_secretbox_open( $ciphertext, $iv, $key)

Definition at line 21 of file encrypt.php.

◆ $plaintext

$plaintext = "message to be encrypted"

Definition at line 2 of file encrypt.php.

Referenced by EncryptedCookieSession\read().