XChaCha20Poly1305 (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.crypto.modes

## Class XChaCha20Poly1305

- java.lang.Object
- - org.bouncycastle.crypto.modes.ChaCha20Poly1305
  - - org.bouncycastle.crypto.modes.XChaCha20Poly1305

- All Implemented Interfaces:
    AEADCipher

      public class XChaCha20Poly1305
      extends ChaCha20Poly1305

  XChaCha20-Poly1305 AEAD construction as described in draft-irtf-cfrg-xchacha-03 sec. 2.4.

  Identical to `ChaCha20Poly1305` except that the underlying stream cipher is `XChaCha20Engine` (192 bit nonce instead of 96 bit). The extended nonce makes random-nonce strategies safe at scale: with a 192 bit nonce, collisions remain negligibly likely up to 2^80 messages per key, removing the per-key counter / deterministic-nonce constraint that standard ChaCha20-Poly1305 imposes.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XChaCha20Poly1305()`
    `XChaCha20Poly1305(Mac poly1305)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getAlgorithmName()` Return the name of the algorithm.

    - ### Methods inherited from class org.bouncycastle.crypto.modes.ChaCha20Poly1305

      `doFinal, getMac, getOutputSize, getUpdateOutputSize, init, processAADByte, processAADBytes, processByte, processBytes, reset`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XChaCha20Poly1305

          public XChaCha20Poly1305()

    - #### XChaCha20Poly1305

          public XChaCha20Poly1305(Mac poly1305)

  - ### Method Detail

    - #### getAlgorithmName

          public java.lang.String getAlgorithmName()

      Description copied from interface: `AEADCipher`
      Return the name of the algorithm.
      Specified by:
        `getAlgorithmName` in interface `AEADCipher`
      Overrides:
        `getAlgorithmName` in class `ChaCha20Poly1305`
      Returns:
        the algorithm name.