# Signature Algorithms

This framework comes with several signature algorithms. These algorithms are in the following namespace: `Jose\Component\Signature\Algorithm`.

*From v1.2, the algorithms have their own sub-packages. To avoid BC breaks, these packages are automatically installed for all v1.x of the framework. Starting at v2.0, you will have to explicitly install the algorithm packages you need.*

* HMAC with SHA-2 Functions. Package `web-token/jwt-signature-algorithm-hmac`
  * `HS256`
  * `HS384`
  * `HS512`
* Elliptic Curve Digital Signature Algorithm (ECDSA). Package `web-token/jwt-signature-algorithm-ecdsa`
  * `ES256`
  * `ES384`
  * `ES512`
* RSASSA-PKCS1 v1\_5. Package `web-token/jwt-signature-algorithm-rsa`
  * `RS256`
  * `RS384`
  * `RS512`
* RSASSA-PSS. Package `web-token/jwt-signature-algorithm-rsa`
  * `PS256`
  * `PS384`
  * `PS512`
* Edwards-curve Digital Signature Algorithm (EdDSA) Package `web-token/jwt-signature-algorithm-eddsa`
  * `EdDSA` (*only with the* `Ed25519` *curve*)
* Unsecured algorithm Package `web-token/jwt-signature-algorithm-none`
  * `none`

**The following signature algorithms are experimental and must not be used in production unless you know what you are doing. They are proposed for testing purpose only.**

They are all part of the package `web-token/jwt-signature-algorithm-experimental`

* `RS1`: RSASSA-PKCS1 v1\_5 with SHA-1 hashing function.
* `HS1`: HMAC with SHA-1 hashing function.

## How To Use

These algorithms have to be used with the [Algorithm Manager](/1.x/components/algorithm-management-jwa.md). They do not need any arguments.

Example:

```php
<?php

use Jose\Component\Core\AlgorithmManager;
use Jose\Component\Signature\Algorithm\PS256;
use Jose\Component\Signature\Algorithm\ES512;
use Jose\Component\Signature\Algorithm\None;

$algorithm_manager = AlgorithmManager::create([
    new PS256(),
    new ES512(),
    new None(),
]);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://web-token.spomky-labs.com/1.x/components/signed-tokens-jws/signature-algorithms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
