Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.
/ jose Public archive

🔐 JSON Object Signing and Encryption Framework (JWT, JWS, JWE, JWA, JWK, JWKSet and more)

License

Notifications You must be signed in to change notification settings

Spomky-Labs/jose

Repository files navigation

PHP JOSE Library

Join the chat at https://gitter.im/Spomky-Labs/jose

Scrutinizer Code Quality Coverage Status Build Status

HHVM Status PHP 7 ready

SensioLabsInsight

Latest Stable Version Total Downloads Latest Unstable Version License

This library aims to provide an implementation of:

Tests vectors from RFC 7520 are fully implemented and all test pass.

This library supports JSON Web Key Thumbprint (RFC 7638).

The RFC7797 (SON Web Signature (JWS) Unencoded Payload Option) is not yet supported.

Provided Features

Supported Input Types:

JWS or JWE objects support every input that can be serialized:

  • Plain text
  • Array
  • jwk+json content type (JWKInterface object)
  • jwkset+json content type (JWKSetInterface object)

The detached content is also supported.

Supported Serialization Modes

  • Compact JSON Serialization Syntax (JWS/JWE creation and loading)
  • Flattened JSON Serialization Syntax (JWS/JWE creation and loading)
  • General JSON Serialization Syntax (JWS/JWE creation and loading)

Supported Compression Methods

  • Deflate —DEF—
  • GZip —GZ— (this compression method is not described in the specification)
  • ZLib —ZLIB— (this compression method is not described in the specification)

Supported Key Types (JWK)

  • None keys (none)
  • Symmetric keys (oct)
  • Asymmetric keys based on RSA keys (RSA)
  • Asymmetric keys based on Elliptic Curves (EC)
  • Asymmetric keys based on Octet Key Pair (OKP)

JWK objects support JSON Web Key Thumbprint (RFC 7638).

Key Sets (JWKSet)

JWKSet is fully supported.

Supported Signature Algorithms

Supported Key Encryption Algorithms

Supported Content Encryption Algorithms

The Release Process

The release process is described here.

Prerequisites

This library needs at least:

  • PHP 5.5.9+,
  • OpenSSL extension.

Please consider the following optional requirements:

  • For AES-GCM based algorithms (AxxxGCM and AxxxGCMKW): PHP Crypto Extension (at least v0.2.1) is highly recommended as encryption/decryption is faster than the pure PHP implementation.
  • For ECC based algorithms: PHP ECC (v0.3 only).
  • For Ed25519 algorithm: php-ed25519-ext required
  • For X25519 algorithm: php-curve25519-ext required

Please read performance test results below concerning the ECC based algorithms. As the time needed to perform operation is very long compared to the other algorithms, we do not recommend their use.

Continuous Integration

It has been successfully tested using PHP 5.5.9, PHP 5.6 and PHP 7 and HHVM with all algorithms.

We also track bugs and code quality using Scrutinizer-CI and Sensio Insight.

Coding Standards are verified by StyleCI.

Code coverage is analyzed by Coveralls.io.

Installation

The preferred way to install this library is to rely on Composer:

{
    ....
    "require": {
        "spomky-labs/jose": "^3.0",
        "fgrosse/phpasn1": "dev-compat/php5-5 as v1.3.1"
    },
    ...
}

Then, you have to update your project dependencies:

composer update

How to use

Have a look at How to use to know how to load your JWT and discover all possibilities provided by this library.

Performances

Please read the performance page to know how fast are the algorithms supported by this library.

Contributing

Requests for new features, bug fixed and all other ideas to make this library useful are welcome. Please follow these best practices.

Licence

This software is release under MIT licence.