@ThreadSafe public class XC20P extends Object
The eXtended-nonce ChaCha cipher construction (XChaCha) allows for ChaCha-based cipher suites to accept a 192-bit nonce with similar guarantees to the original construction, except with a much lower probability of nonce misuse occurring.
This class is thread-safe.
| Modifier and Type | Field and Description |
|---|---|
static int |
AUTH_TAG_BIT_LENGTH
The standard authentication tag length (128 bits).
|
static int |
IV_BIT_LENGTH
The standard Initialisation Vector (IV) length (192 bits).
|
| Constructor and Description |
|---|
XC20P() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decryptAuthenticated(SecretKey secretKey,
byte[] iv,
byte[] cipherText,
byte[] authData,
byte[] authTag)
Decrypts the specified cipher text using XChaCha20_Poly1305.
|
static AuthenticatedCipherText |
encryptAuthenticated(SecretKey secretKey,
Container<byte[]> ivContainer,
byte[] plainText,
byte[] authData)
Encrypts the specified plain text using XChaCha20_Poly1305.
|
public static final int AUTH_TAG_BIT_LENGTH
public static final int IV_BIT_LENGTH
public XC20P()
public static AuthenticatedCipherText encryptAuthenticated(SecretKey secretKey, Container<byte[]> ivContainer, byte[] plainText, byte[] authData) throws JOSEException
secretKey - The AES key. Must not be null.plainText - The plain text. Must not be null.ivContainer - The initialisation vector (IV).
This is output parameter. On output, it carries
the nonce the cipher actually used.authData - The authenticated data. Must not be null.JOSEException - If encryption failed.public static byte[] decryptAuthenticated(SecretKey secretKey, byte[] iv, byte[] cipherText, byte[] authData, byte[] authTag) throws JOSEException
secretKey - The AES key. Must not be null.iv - The initialisation vector (IV). Must not be
null.cipherText - The cipher text. Must not be null.authData - The authenticated data. Must not be null.authTag - The authentication tag. Must not be null.JOSEException - If decryption failed.Copyright © 2021 Connect2id Ltd.. All rights reserved.