Skip to content

Instantly share code, notes, and snippets.

@000pp
Created April 28, 2024 03:10
Show Gist options
  • Save 000pp/bf5573d3956ee97f4ac9ce62b9200831 to your computer and use it in GitHub Desktop.
Save 000pp/bf5573d3956ee97f4ac9ce62b9200831 to your computer and use it in GitHub Desktop.
Decrypt GLPI encrypted values with glpicrypt.key
<?php
$encoded_value = base64_decode('Enconded_Base64_String');
$nonce = substr($encoded_value, 0, SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES);
$ciphertext = substr($encoded_value, SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES);
$private_key = file_get_contents('glpicrypt.key');
$decrypted = sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($ciphertext, $nonce, $nonce, $private_key);
echo "Result: " . $decrypted;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment