ChaCha20ParameterSpec

public final class ChaCha20ParameterSpec
extends Object implements AlgorithmParameterSpec

java.lang.Object
   ↳ javax.crypto.spec.ChaCha20ParameterSpec


This class specifies the parameters used with the ChaCha20 algorithm.

The parameters consist of a 12-byte nonce and an initial counter value expressed as a 32-bit integer.

This class can be used to initialize a Cipher object that implements the ChaCha20 algorithm.

Summary

Public constructors

ChaCha20ParameterSpec(byte[] nonce, int counter)

Constructs a parameter set for ChaCha20 from the given nonce and counter.

Public methods

int getCounter()

Returns the configured counter value.

byte[] getNonce()

Returns the nonce value.

Inherited methods

Public constructors

ChaCha20ParameterSpec

Added in API level 35
public ChaCha20ParameterSpec (byte[] nonce, 
                int counter)

Constructs a parameter set for ChaCha20 from the given nonce and counter.

Parameters
nonce byte: a 12-byte nonce value

counter int: the initial counter value

Throws
NullPointerException if nonce is null
IllegalArgumentException if nonce is not 12 bytes in length

Public methods

getCounter

Added in API level 35
public int getCounter ()

Returns the configured counter value.

Returns
int the counter value

getNonce

Added in API level 35
public byte[] getNonce ()

Returns the nonce value.

Returns
byte[] the nonce value. This method returns a new array each time this method is called.