PHPackages                             randrei98/josephp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. randrei98/josephp

ActiveLibrary[Security](/categories/security)

randrei98/josephp
=================

JSON Object Signing and Encryption

2.0.0(3y ago)118MITPHPPHP &gt;=8.1

Since Jan 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/AndreiR98/JOSE-PHP)[ Packagist](https://packagist.org/packages/randrei98/josephp)[ RSS](/packages/randrei98-josephp/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (2)Versions (8)Used By (0)

JOSE(JSON Object Signing and Ecryption)
=======================================

[](#josejson-object-signing-and-ecryption)

JOSE is analogue to COSE(CBOR Object Signing and Encryption)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

Introduction
------------

[](#introduction)

For now you only have one option and it's 'Sign1Message', Sign1Messages are used when there is a single signature attached to the structure, consisting of headers and payload, Receivers must know the public key to verify the message.

The basic structure of Sign1Message: \['Sign1Message', {phdr}, {uhdr}, {payload}, {signature}\]

phdr = Protected header, this field contains informations that needs to be protected.This information is taken into account during signing. uhdr = Unprotected header, this field contains information that DO NOT needs to be protected therefor is not taken in consideration while signing. Payload = Contains the main message body taken in consideration while signing Signature = (r, s) paire signature

Install
-------

[](#install)

Install with [composer](https://getcomposer.org/).

```
$ composer require randrei98/josephp
```

Signing and encoding
--------------------

[](#signing-and-encoding)

```
use \ECDSA\Curves;
use \ECDSA\Algorithms;
use \JOSE\JOSEmessage;
use \JOSE\Sign1Message;
use \JOSE\Keys;

//Set information for protected header
$phdr = 'JON DOE';
$uhdr = '';

//Set the paylaod
$payload = 'This is a test';

$pem = 'PRIVATE EC KEY HERE';

//Set params
$curve = Curves::NIST256P();
$algo = Algorithms::ES256();

//Set the Key ID
$KID = '';

$key = new Keys($pem, $KID, $curve, $algo);

$message = new Sign1Message($phdr, $uhdr, $payload);

//Assign the key to the message
$message->key = $key;

//Encode the message
$encoded = $message->encode();

var_dump($encoded);
```

Decoding and Signature verification
-----------------------------------

[](#decoding-and-signature-verification)

```
use \ECDSA\Curves;
use \ECDSA\Algorithms;
use \JOSE\JOSEmessage;
use \JOSE\Sign1Message;
use \JOSE\Keys;

$curve = Curves::NIST256P();
$algo = Algorithms::ES256();

$publicKey_pem = 'PUBLIC EC KEY HERE';

$key = $key = new Keys($pem, '', $curve, $algo);

$decoded = JOSEmessage::decode($encoded);
$decoded->key = $key;

var_dump($decoded->Verify_Signature());
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~123 days

Total

5

Last Release

1129d ago

Major Versions

1.0.3 → 2.0.02023-05-31

PHP version history (2 changes)1.0.0PHP &gt;=7.2

2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/89095452?v=4)[AndreiR98](/maintainers/AndreiR98)[@AndreiR98](https://github.com/AndreiR98)

---

Top Contributors

[![AndreiR98](https://avatars.githubusercontent.com/u/89095452?v=4)](https://github.com/AndreiR98 "AndreiR98 (13 commits)")

### Embed Badge

![Health badge](/badges/randrei98-josephp/health.svg)

```
[![Health](https://phpackages.com/badges/randrei98-josephp/health.svg)](https://phpackages.com/packages/randrei98-josephp)
```

###  Alternatives

[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k18.7M143](/packages/mews-purifier)[paragonie/ecc

PHP Elliptic Curve Cryptography library

24820.0k38](/packages/paragonie-ecc)[laravelgems/blade-escape

Custom blade directives to figth against XSS

1212.5k](/packages/laravelgems-blade-escape)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
