Skip to content

Drupal

Drupal

CHOCOLATECHIPSSL=NGJiYzVjYjAxMjllNWExYzA0MWYyZGE1MjYxNGViMmIxZTYyNjQ5MjMzMTRjMmUzYzdkNjEwOGNkYWYxM2VkZe5BZcXYX8qsG9XaNbCc6SlmR6aivm29xnrLauW%2Bp1f%2FOn6BGJxEj8PAKVLLw0de7%2Bx7SQn5dFuADICyMo%2FrkjNmR6aivm29xnrLauW%2Bp1f%2FOn6BGJxEj8PAKVLLw0de72WiIhGLgOLXnm45Oj5LgIHMnJNPIkS2857u%2FIfnejdaCNkFTlw5USyae%2BmPbuv%2BjSsTePL8M6Z3JzCrFg8VsoUfEFBYm1fUYO%2FvWR%2FinW%2BNTAz3akGeaI9aSC6ee%2BRl1MGyEy2xsBSIW3FfNqZG57scoQENXMoiszVglEZPyVKkND1JlfdY4Gj45G7RcBecC3s9qJDSERZ%2FDyKcaqV%2Fv6gHRPcvVKZpUmPqp%2FtX2pERkoqzk7a5BQje7tKjrMTm3kT8oNF4BsoL6N%2BaVtbLa2Snpj2CvQOhcpJMt%2BFjBiFgDbWVIKLppSBahPztVtajy%2Bxht3lS8CS%2BdZD2s0giuHEzj9mNSgmdP%2Fu5dn9jJiNiOziRmACfpZRU2d6q%2FRYb1eF0eB6GQfhRsjizw%2B0Ojri1foqc01YsObITzmjtXoIBvkeO6G1OZaN17%2FrvpJgkPmOSMaZ8FdmgScqJSSk23NDuF7UMDF12uYrOUjDqCalu

First 64 characters are the signature of the encrypted data
4bbc5cb0129e5a1c041f2da52614eb2b1e6264923314c2e3c7d6108cdaf13ede

Signature Uses Sha-256 HMAC

function bakery_validate_data($data, $type = NULL) {
  $key = variable_get('bakery_key', '');
  $data = base64_decode($data);
  $signature = substr($data, 0, 64);
  $encrypted_data = substr($data, 64);
  if ($signature !== hash_hmac('sha256', $encrypted_data, $key)) {
    return FALSE;
  }

Encryption Uses AES 128 ECB Mode

function bakery_decrypt($text) {
  $key = variable_get('bakery_key', '');

  $td = mcrypt_module_open('rijndael-128', '', 'ecb', '');
  $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);

  $key = substr($key, 0, mcrypt_enc_get_key_size($td));

  mcrypt_generic_init($td, $key, $iv);

  $data = mdecrypt_generic($td, $text);

  mcrypt_generic_deinit($td);
  mcrypt_module_close($td);

  return $data;
}