Skip to main content

5. Cryptographic Algorithms for Content Encryption

5.1 "enc" Header Parameter Values for JWE

Content encryption algorithms supported by JWE:

"enc" Param ValueContent Encryption AlgorithmImplementation Requirements
A128CBC-HS256AES_128_CBC_HMAC_SHA_256Required
A192CBC-HS384AES_192_CBC_HMAC_SHA_384Optional
A256CBC-HS512AES_256_CBC_HMAC_SHA_512Required
A128GCMAES GCM using 128-bit keyRecommended
A192GCMAES GCM using 192-bit keyOptional
A256GCMAES GCM using 256-bit keyRecommended

5.2 AES_CBC_HMAC_SHA2 Algorithms

This is a combined encryption and authentication algorithm that combines:

  • AES CBC mode for encryption
  • HMAC SHA-2 for authentication

Key Features:

  • Provides Authenticated Encryption
  • CEK is used for both encryption and MAC computation
  • Supports three key size configurations

Algorithm Variants:

  • A128CBC-HS256: AES-128-CBC + HMAC-SHA-256 (256-bit CEK)
  • A192CBC-HS384: AES-192-CBC + HMAC-SHA-384 (384-bit CEK)
  • A256CBC-HS512: AES-256-CBC + HMAC-SHA-512 (512-bit CEK)

5.3 AES GCM Content Encryption

AES Galois/Counter Mode (GCM) is an authenticated encryption algorithm:

  • Provides confidentiality and integrity protection
  • Efficient hardware implementation
  • Supports Additional Authenticated Data (AAD)

Algorithm Variants:

  • A128GCM: Using 128-bit key
  • A192GCM: Using 192-bit key
  • A256GCM: Using 256-bit key

GCM Parameters:

  • Initialization Vector: 96-bit random value
  • Authentication Tag: 128-bit authentication tag

Selection Recommendations:

  • Prefer using AES-GCM algorithms (more efficient)
  • AES_CBC_HMAC_SHA2 provides broad compatibility
  • Choose appropriate key lengths based on security requirements