Package moe.kyokobot.libdave
Interface Decryptor
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
NettyDecryptor
Handles the decryption of inbound media frames using DAVE.
The Decryptor uses a KeyRatchet to derive the specific keys needed to decrypt
individual RTP packets/frames for a specific sender.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intDecrypts an encrypted frame.intdecrypt(MediaType mediaType, ByteBuffer encryptedFrame, ByteBuffer frame) Decrypts an encrypted frame into NIO ByteBuffer.default intgetMaxPlaintextByteSize(MediaType mediaType, int encryptedFrameSize) Calculates the maximum possible size of the plaintext (decrypted) frame for a given encrypted frame size.voidtransitionToKeyRatchet(KeyRatchet keyRatchet) Transitions the decryptor to use a specific key ratchet.voidtransitionToPassthroughMode(boolean passthroughMode) Sets whether the decryptor should operate in passthrough mode.
-
Method Details
-
transitionToKeyRatchet
Transitions the decryptor to use a specific key ratchet.This links the decryptor to a specific sender's key chain.
- Parameters:
keyRatchet- The key ratchet to use.
-
transitionToPassthroughMode
void transitionToPassthroughMode(boolean passthroughMode) Sets whether the decryptor should operate in passthrough mode.In passthrough mode, the decryptor typically copies the input to the output without attempting decryption, or performs minimal processing.
- Parameters:
passthroughMode-trueto enable passthrough,falseto disable.
-
getMaxPlaintextByteSize
Calculates the maximum possible size of the plaintext (decrypted) frame for a given encrypted frame size.- Parameters:
mediaType- The type of media (audio/video).encryptedFrameSize- The size of the encrypted frame.- Returns:
- The maximum size of the plaintext frame in bytes.
-
decrypt
Decrypts an encrypted frame.- Parameters:
mediaType- The type of media.encryptedFrame- The input buffer containing the encrypted frame.frame- The output buffer to write the decrypted frame into.- Returns:
- The number of bytes written to
frameon success, or a negative error code (seeDecryptorResultCode) on failure.
-
decrypt
Decrypts an encrypted frame into NIO ByteBuffer.- Parameters:
mediaType- The type of media.encryptedFrame- The input ByteBuffer containing the encrypted frame.frame- The output ByteBuffer to write the decrypted frame into.- Returns:
- The number of bytes written to
frameon success, or a negative error code on failure.
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-