PHP Plugin Documentation

PHP’s OpenSSL extension can be used for encryption tasks. This extension is generally enabled by default.

   <?php

   function encryptData($data, $pluginKeyHex) {

   $pluginKey = hex2bin($pluginKeyHex);  // Convert hex key to binary

   $iv = random_bytes(16);  // Generate a random 16-byte IV

   // Encrypt the data using AES-256-CBC

   $encryptedData = openssl_encrypt(json_encode($data), ‘aes-256-cbc’, $pluginKey, OPENSSL_RAW_DATA, $iv);

   // Combine IV and encrypted data, then encode in base64

   $encryptedBlob = base64_encode($iv . $encryptedData);

    return $encryptedBlob;

    }

   // Example usage

   $pluginKey = ‘your_plugin_key_here’;  // Replace with your actual plugin key

   $reportGhostingData = array(

   “email” => “[email protected]”,

   “governmentId” => “ABCDE1234F”,

   “governmentIdType” => “PAN”,

   “jobObject” => array(

   “jobSkills” => array(“nodejs”, “nextjs”),

   “jobRole” => “software”,

   “employmentType”=> “Full-Time”,

   “ghostedReasonByCompany”=> “1”,

  “location”=> “India, Benguluru”

   )

   ); 

  $reportGhostingData = json_encode($reportGhostingData);

  $encryptedData = encryptData($reportGhostingData, $pluginKey);

  echo ‘Encrypted Data: ‘ . $encryptedData;

   ?>