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

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

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.