PHP code example of derrickleemy / jwe-decoder

1. Go to this page and download the library: Download derrickleemy/jwe-decoder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

derrickleemy / jwe-decoder example snippets


  $key = file_get_contents('private.pem');
  

try {
    $jwt = \JWEDecoder\JWE::decrypt('abc.def.ghi.klm.nop', $key);
} catch (\JWEDecoder\InvalidTokenException $e) {
    dd($e->getMessage());
}

print $jwt->getHeader('alg');
print $jwt->getPlaintext();
print $jwt->getRtHash();
print $jwt->getNonce();
print $jwt->getAmr();
print $jwt->getIat();
print $jwt->getIss();
print $jwt->getSub();
print $jwt->getAtHash();
print $jwt->getExp();
print $jwt->getAud();