liveBook · Manning

Nimbus

As explained in Software Security for Developers

Nimbus is a Java security library for implementing standards-based cryptographic and authentication protocols.

Nimbus is an open-source Java library for standards-based cryptographic and authentication protocols, including JOSE, JWS, and JWE. It supports Java services and Spring Security integrations for OIDC and OAuth2 logins. section 11.4.2 section 11.5.2

Use Nimbus to:

  • Create and verify signed JWS objects with headers, payloads, and HS256 shared-secret signatures. section 11.4.2
  • Encrypt and decrypt JWE payloads with AES-GCM while the library handles initialization vectors and serialization metadata. section 11.5.2
  • Keep secrets out of source code and properties files; hardcoded keys simplify demonstrations but are unsafe in production. section 11.4.2

Signing and encrypting JSON

A Java service can construct a JWSObject with a JSON payload, sign it using MACSigner, and verify it with MACVerifier. For confidentiality, JWEObject with DirectEncrypter and DirectDecrypter provides a compact AES-GCM workflow. section 11.4.2 section 11.5.2

<dependency>
   <groupId>com.nimbusds</groupId>
   <artifactId>nimbus-jose-jwt</artifactId>
   <version>9.37.3</version>
</dependency>

Use the Maven dependency declaration to add Nimbus JOSE JWT to a Java project. section 11.4.2

How Software Security for Developers covers it

How deep it goes
Provides practical class-level workflows for JWS and JWE, while hiding lower-level cryptographic-library configuration.
Examples
Demonstrates Java signing, verification, encryption, decryption, JSON payloads, compact serialization, and randomly generated keys.
What it assumes
Assumes Java and basic cryptographic concepts, while introducing the required JWS, JWE, payload, key, and signature components.
What you can do after
Apply it via Nimbus to implement JWS signing and verification or JWE encryption and decryption in Java.
How it connects
Connects JWS and JWE with JOSE, Spring Security, OIDC, OAuth2, shared-secret authentication, and AES-GCM encryption.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.