> 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

`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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
