This repository is a Java library for JSON Web Token (JWT) handling per RFC 7519. It provides comprehensive functionality for creating, signing, verifying, and decoding JWTs, supporting multiple cryptographic algorithms including HMAC (HS256/384/512), RSA (RS256/384/512, PS256/384/512), EC (ES256/384/512), and EdDSA (Ed25519/Ed448). The library also includes utilities for JSON Web Key (JWK) management, PEM encoding/decoding of keys and certificates, and ASN.1 DER parsing for low-level cryptographic operations. Architecturally, the library follows a modular structure with clear separation of concerns: core JWT operations in the `jwt` package, JWK handling in `jwks`, PEM utilities in `pem`, and DER parsing in `der`. Cryptographic operations are abstracted through `Signer` and `Verifier` interfaces, enabling the Strategy pattern for pluggable algorithm implementations. Object creation uses the Builder pattern for immutable, fluent APIs (e.g., `JWT.addClaim()`, `KeyPair.build()`). JSON processing is centralized via a configured Jackson `Mapper` with custom serializers/deserializers for Java 8+ date-time types. The design minimizes coupling, allowing components like `JWTUtils` or `HMACSigner` to be reused independently. The library is actively maintained, with recent commits (2026-07-15) and ongoing security updates (e.g., patches for CVE-2022-21449). Dependencies are managed via Maven/Savant, relying primarily on Jackson for JSON processing with optional Bouncy Castle for certain algorithms. The codebase demonstrates strong engineering practices: comprehensive unit tests cover all algorithms and edge cases, clear exception hierarchies provide specific error handling, and Java 9+ module system support is included. It serves as a robust, reusable foundation for any Java application requiring secure token-based authentication or authorization.
JSON::JWT is a Ruby library implementing the JSON Web Token (JWT) family of standards, including JWS (JSON Web Signature), JWE (JSON Web Encryption), and JWK (JSON Web Key). It provides comprehensive cryptographic operations for signing, verifying, encrypting, and decrypting tokens using various algorithms (HMAC, RSA, ECDSA, RSA-PSS, and symmetric encryption). The library also includes JWK Set management with remote fetching and caching capabilities. The architecture is modular: JSON::JWT serves as the main entry point, delegating to JSON::JWS for signing/verification and JSON::JWE for encryption/decryption. JSON::JWK handles key representation and conversion between OpenSSL keys and JWK format. The JWK Set Fetcher provides a configurable HTTP client with pluggable caching, suitable for OpenID Connect discovery. The code demonstrates strong security practices, including constant-time comparison for MAC verification, protection against padding oracle attacks in CBC mode, and proper validation of algorithm headers to prevent algorithm confusion attacks. The test suite covers interop with other JWT libraries (Nimbus JOSE, jsrsasign) and RFC examples, ensuring correctness. Key external dependencies include OpenSSL for cryptographic primitives, Faraday for HTTP, and ActiveSupport for hash extensions. The library is actively maintained with support for Ruby 3.2-4.0 and recent security fixes.