> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-framework/modularity/jwt/reference/algorithms.md).

# Algorithms

Supported JWS signing and JWE encryption algorithms for the bx-jwt module.

`bx-jwt` follows RFC 7518 (JSON Web Algorithms). The tables below summarize every algorithm registered by the module — including key requirements — so you can pick the right one for your use case.

## Signing (JWS)

| Algorithm | Type     | Min Key Size        | Notes                                                |
| --------- | -------- | ------------------- | ---------------------------------------------------- |
| `HS256`   | HMAC     | 256 bits (32 bytes) | Symmetric — same key signs and verifies.             |
| `HS384`   | HMAC     | 384 bits (48 bytes) | Symmetric.                                           |
| `HS512`   | HMAC     | 512 bits (64 bytes) | Symmetric.                                           |
| `RS256`   | RSA      | 2048-bit            | Asymmetric — private key signs, public key verifies. |
| `RS384`   | RSA      | 2048-bit            | Asymmetric.                                          |
| `RS512`   | RSA      | 4096-bit            | Asymmetric.                                          |
| `ES256`   | EC P-256 | —                   | Asymmetric, smaller keys than RSA.                   |
| `ES384`   | EC P-384 | —                   | Asymmetric.                                          |
| `ES512`   | EC P-521 | —                   | Asymmetric.                                          |

{% hint style="info" %}
HMAC minimum key lengths are enforced at parse time per RFC 7518 §3.2. Use [`jwtGenerateSecret( bits )`](/boxlang-framework/modularity/jwt/reference/built-in-functions/jwtgeneratesecret.md) to always produce a compliant key.
{% endhint %}

## Encryption (JWE)

| Key Algorithm  | Content Encryption | Key Type                         |
| -------------- | ------------------ | -------------------------------- |
| `RSA-OAEP-256` | `A256GCM`          | RSA public/private key pair.     |
| `dir`          | `A256GCM`          | 256-bit symmetric secret (32 B). |

## `alg:none` is Unconditionally Rejected

The module **always rejects** unsigned tokens (`alg:none`). Passing such a token to `jwtVerify()` or `jwtRefresh()` throws `bxjwt.JWTVerificationException`.

## Restricting Algorithms

Use the `allowedAlgorithms` setting in your `ModuleConfig.bx` to lock down the algorithms your application accepts:

```javascript
allowedAlgorithms = [ "HS256", "RS256", "ES256" ]
```

See [Security Best Practices](/boxlang-framework/modularity/jwt/security-best-practices.md) for guidance on choosing an allowlist.

## Related

* [JWTGenerateSecret()](/boxlang-framework/modularity/jwt/reference/built-in-functions/jwtgeneratesecret.md)
* [JWTGenerateKeyPair()](/boxlang-framework/modularity/jwt/reference/built-in-functions/jwtgeneratekeypair.md)
* [Signing (JWS) Guide](/boxlang-framework/modularity/jwt/signing-jws.md)
* [Encryption (JWE) Guide](/boxlang-framework/modularity/jwt/encryption-jwe.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/boxlang-framework/modularity/jwt/reference/algorithms.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
