wzul

Validate X Signature CHIP Send

Aug 29th, 2024 (edited)
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2.  
  3. $content = file_get_contents('php://input');
  4.  
  5. // chip collect
  6. //if ( openssl_verify( $content,  base64_decode($_SERVER['HTTP_X_SIGNATURE']), 'public_key', 'sha256WithRSAEncryption' ) != 1 ) {
  7.  
  8. // chip send
  9. if ( openssl_verify( $content,  base64_decode($_SERVER['HTTP_X_SIGNATURE']), 'public_key', 'sha512WithRSAEncryption' ) != 1 ) {
  10.   exit('wrong signature');
  11. }
  12.  
  13. $content_decoded = json_decode($content, true);
  14.  
  15. if ($content_decoded['status'] == 'completed') {
  16.   // do something here
  17. }
Add Comment
Please, Sign In to add comment