- All Implemented Interfaces:
Serializable, Comparable<NoiseInit.PatternID>, java.lang.constant.Constable
- Enclosing class:
NoiseInit
Pattern identifiers for Noise protocol handshake patterns.
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E>Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionRatchetHybrid Ratchet MLKEM1024Hybrid Ratchet MLKEM512Hybrid Ratchet MLKEM768TunnelsTunnels, no response expectedNTCP2SSU2Hybrid NTCP2 MLKEM1024Hybrid NTCP2 MLKEM512Hybrid SSU2 MLKEM512Hybrid NTCP2 MLKEM768Hybrid SSU2 MLKEM768Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]The initial chaining key.private final StringThe Diffie-Hellman cipher name.private final byte[]The initial handshake hash.private short[]The token list of the pattern.private final StringThe name identifying the pattern.private final StringThe name prefix of the pattern.private final StringThe protocol name for the handshake.private final StringThe symmetric cipher name.private final StringThe hash algorithm name.Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionstatic NoiseInit.PatternIDbyPatternId(String pid) Lookup PatternID by string pattern IDReports which AEAD cipher this protocol uses.getDH()Reports which Diffie-Hellman method this protocol uses.getHash()Reports which hash function this protocol uses.byte[]The chaining key every handshake of this pattern starts from, made by hashing the protocol name.byte[]The hash of the initial chaining key: the value the handshake's hash chain starts from, before any handshake message is mixed in.short[]Reports the message and flag tokens of the handshake pattern.Reports which handshake pattern this protocol name selected.Reports whether this is the Noise or NoisePSK family.Reports the full protocol name this entry was parsed from.static NoiseInit.PatternIDReturns the enum constant of this class with the specified name.static NoiseInit.PatternID[]values()Returns an array containing the constants of this enum class, in the order they are declared.
Enum Constant Details
XK
NTCP2IK
RatchetN
TunnelsN_NO_RESPONSE
Tunnels, no response expectedXK_SSU2
SSU2IKHFS_512
Hybrid Ratchet MLKEM512IKHFS_768
Hybrid Ratchet MLKEM768IKHFS_1024
Hybrid Ratchet MLKEM1024XKHFS_512
Hybrid NTCP2 MLKEM512XKHFS_768
Hybrid NTCP2 MLKEM768XKHFS_1024
Hybrid NTCP2 MLKEM1024XKHFS_512_SSU2
Hybrid SSU2 MLKEM512XKHFS_768_SSU2
Hybrid SSU2 MLKEM768
Field Details
prefix
The name prefix of the pattern.patternId
The name identifying the pattern.protoName
The protocol name for the handshake.dh
The Diffie-Hellman cipher name.scipher
The symmetric cipher name.shash
The hash algorithm name.pattern
private short[] patternThe token list of the pattern.ck
private final byte[] ckThe initial chaining key.h
private final byte[] hThe initial handshake hash.
Constructor Details
PatternID
Method Details
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
getPrefix
Reports whether this is the Noise or NoisePSK family.- Returns:
- the noise protocol family prefix, "Noise" or "NoisePSK"
getPatternID
Reports which handshake pattern this protocol name selected.- Returns:
- the pattern name as it appeared in the protocol name, e.g. "XX" or "XK"
getProtocolName
Reports the full protocol name this entry was parsed from.- Returns:
- the full underscore-separated protocol name, e.g. "Noise_XKaes2gcm"
getDH
Reports which Diffie-Hellman method this protocol uses.- Returns:
- the Diffie-Hellman method named by the protocol name, e.g. "25519" or "MLKEM768"
getCipher
Reports which AEAD cipher this protocol uses.- Returns:
- the AEAD cipher named by the protocol name, e.g. "chacha20poly1305"
getHash
Reports which hash function this protocol uses.- Returns:
- the hash function named by the protocol name, e.g. "SHA256" or "SHA512"
getPattern
public short[] getPattern()Reports the message and flag tokens of the handshake pattern.- Returns:
- the message and flag tokens making up the handshake pattern
getInitialCK
public byte[] getInitialCK()The chaining key every handshake of this pattern starts from, made by hashing the protocol name. Returned as a copy so a restarted handshake cannot corrupt the state this pattern holds for the next one.- Returns:
- a fresh copy of the pattern's initial chaining key, which the caller may mix into without disturbing this pattern
getInitialH
public byte[] getInitialH()The hash of the initial chaining key: the value the handshake's hash chain starts from, before any handshake message is mixed in. Returned as a copy so a restarted handshake cannot corrupt this pattern's state.- Returns:
- a fresh copy of the pattern's initial handshake hash, which the caller may mix into without disturbing this pattern
byPatternId
Lookup PatternID by string pattern ID- Parameters:
pid- the pattern name to look up, e.g. "XK"- Returns:
- the enum constant whose pattern name equals pid
- Throws:
IllegalArgumentException- if not found