public final class Noise
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_PACKET_LEN
Maximum length for Noise packets.
|
Constructor and Description |
---|
Noise() |
Modifier and Type | Method and Description |
---|---|
static CipherState |
createCipher(java.lang.String name)
Creates a cipher object from its Noise protocol name.
|
static DHState |
createDH(java.lang.String name)
Creates a Diffie-Hellman object from its Noise protocol name.
|
static java.security.MessageDigest |
createHash(java.lang.String name)
Creates a hash object from its Noise protocol name.
|
static void |
random(byte[] data)
Generates random data using the system random number generator.
|
static void |
setForceFallbacks(boolean force)
Force the use of plain Java fallback crypto implementations.
|
public static final int MAX_PACKET_LEN
public static void random(byte[] data)
data
- The data buffer to fill with random data.public static void setForceFallbacks(boolean force)
force
- Set to true for force fallbacks, false to
try to use the system implementation before falling back.
This function is intended for testing purposes to toggle between
the system JCA/JCE implementations and the plain Java fallback
reference implementations.public static DHState createDH(java.lang.String name) throws java.security.NoSuchAlgorithmException
name
- The name of the DH algorithm; e.g. "25519", "448", etc.java.security.NoSuchAlgorithmException
- The name is not recognized as a
valid Noise protocol name, or there is no cryptography provider
in the system that implements the algorithm.public static CipherState createCipher(java.lang.String name) throws java.security.NoSuchAlgorithmException
name
- The name of the cipher algorithm; e.g. "AESGCM", "ChaChaPoly", etc.java.security.NoSuchAlgorithmException
- The name is not recognized as a
valid Noise protocol name, or there is no cryptography provider
in the system that implements the algorithm.public static java.security.MessageDigest createHash(java.lang.String name) throws java.security.NoSuchAlgorithmException
name
- The name of the hash algorithm; e.g. "SHA256", "BLAKE2s", etc.java.security.NoSuchAlgorithmException
- The name is not recognized as a
valid Noise protocol name, or there is no cryptography provider
in the system that implements the algorithm.