Package moe.kyokobot.koe.internal.crypto
Interface EncryptionMode
- All Known Implementing Classes:
AEADAES256GCMEncryptionMode,AEADAES256GCMRTPSizeEncryptionMode,AEADXChaCha20Poly1305RTPSizeEncryptionMode,PlainEncryptionMode,XSalsa20Poly1305EncryptionMode,XSalsa20Poly1305LiteEncryptionMode,XSalsa20Poly1305LiteRTPSizeEncryptionMode,XSalsa20Poly1305SuffixEncryptionMode
public interface EncryptionMode
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanbox(io.netty.buffer.ByteBuf plain, int len, io.netty.buffer.ByteBuf output, byte[] secretKey) Encryptslenbytes ofplainintooutput, which already holds the unencrypted part of the RTP header.static EncryptionModegetName()default booleanstatic Stringselect(List<String> offered, CipherPreferencePolicy policy) default voidvalidateKey(byte[] secretKey) Checks the key once per session,box(io.netty.buffer.ByteBuf, int, io.netty.buffer.ByteBuf, byte[])assumes it was validated.
-
Field Details
-
SECURE_RANDOM
-
TAG_BYTES_LENGTH
static final int TAG_BYTES_LENGTH- See Also:
-
SECRET_KEY_LENGTH
static final int SECRET_KEY_LENGTH- See Also:
-
-
Method Details
-
validateKey
default void validateKey(byte[] secretKey) Checks the key once per session,box(io.netty.buffer.ByteBuf, int, io.netty.buffer.ByteBuf, byte[])assumes it was validated.- Throws:
IllegalArgumentException- if the key can't be used with this mode
-
box
boolean box(io.netty.buffer.ByteBuf plain, int len, io.netty.buffer.ByteBuf output, byte[] secretKey) Encryptslenbytes ofplainintooutput, which already holds the unencrypted part of the RTP header. -
isRtpSize
default boolean isRtpSize()- Returns:
- true if the header extension preamble is part of the unencrypted RTP header, false if it is encrypted along with the payload
-
getName
String getName() -
select
static String select(List<String> offered, CipherPreferencePolicy policy) throws UnsupportedEncryptionModeException - Parameters:
offered- modes offered by the voice server- Returns:
- the mode picked by the policy
- Throws:
UnsupportedEncryptionModeException- if the policy picked nothing, or a mode that isn't both offered and supported
-
supportedModes
-
get
-