2026-04-06 11:44:59 +02:00
2026-04-05 17:14:02 +02:00
2026-04-05 17:14:02 +02:00
2026-04-05 17:14:02 +02:00
2026-04-05 17:26:09 +02:00
2026-04-06 11:44:59 +02:00

TrizTech Security JWT Library

Java JWT JJWT Version

Internal Java library dedicated to the generation and validation of JWT tokens signed with RSA (RS256), intended to be shared across applications within the TrizTech ecosystem.


1. Overview

TrizTech Security JWT Library is a utility Java library that allows you to:

  • generate JWT tokens signed with RS256
  • validate JWT tokens using an RSA public key
  • load RSA keys from PEM format

2. Use Cases in the TrizTech Ecosystem

  • auth-triz — holds the RSA private key and generates JWT tokens
  • trizstock — holds the RSA public key and validates tokens
  • trizdistribution — holds the RSA public key and validates tokens

This approach ensures that only auth-triz can sign tokens. The other applications can only verify them.


3. Features

  • JWT generation signed with RSA / RS256
  • JWT validation using an RSA public key
  • Loading private and public RSA keys from PEM files
  • Support for custom claims
  • Simple API with static methods
  • Compatible with Java EE / Spring (non-Spring Boot)

4. Project Structure

Class Role
JwtUtils JWT token generation and validation
KeyLoader RSA key loading from PEM files

5. Requirements

  • Java 8+ (recommended: Java 17)
  • JJWT 0.12.x
  • Valid RSA keys in PEM format

6. Generate RSA Key Pair with OpenSSL

1) Generate the private key

Run this command in Terminal / Git Bash / PowerShell:

openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048

This creates:

  • private_key.pem

Example format:

-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBK...
-----END PRIVATE KEY----- 

This is exactly the format your KeyLoader.loadPrivateKey(...) expects:

  • header: -----BEGIN PRIVATE KEY-----

2) Generate the public key from the private key

openssl rsa -pubout -in private_key.pem -out public_key.pem

This creates:

  • public_key.pem

Example format:

-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgK...
-----END PUBLIC KEY-----

This is exactly the format your KeyLoader.loadPublicKey(...) expects:

  • header: -----BEGIN PUBLIC KEY-----

7. Auteur

Developed for the TrizTech ecosystem — to centralize and share JWT logic between auth-triz, trizstock, and trizdistribution.

S
Description
No description provided
Readme
103 KiB
0 Stars 1 Watchers 0 Forks
Languages
Java 100%