derrickleemy/jwe-decoder 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

derrickleemy/jwe-decoder

最新稳定版本:v1.0.0

Composer 安装命令:

composer require derrickleemy/jwe-decoder

包简介

An simple JSON Web Token library for PHP.

README 文档

README

JWEDecoder is a lightweight encrypted JWT decoder library written in PHP. It was originally written by Kevin Mo (all credits goes to him), and dialed down for a very specific use case for internal use.

Features

  • JSON web encryption RFC7516
  • Supported Algorithms
    • RSAES with OAEP (RSA-OAEP-256)

Requirements

  • PHP 5.4.0 or later
  • hash extension
  • openssl extension

Installation

You can install via Composer.

composer require derrickleemy/jwe-decoder
{
    "require": {
        "derrickleemy/jwe-decoder": "1.0.*"
    }
}

Usage

Private Key

Private key is required to decode the JWE token. You can add your key by doing the following:

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

Decrypting a JWE

To decrypt a JWE, use the decrypt function:

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();

Authors

Credits

统计信息

  • 总下载量: 292
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2020-03-19