Interface Decryptor

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
NettyDecryptor

public interface Decryptor extends AutoCloseable
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 Type
    Method
    Description
    void
     
    int
    decrypt(MediaType mediaType, byte[] encryptedFrame, byte[] frame)
    Decrypts an encrypted frame.
    int
    decrypt(MediaType mediaType, ByteBuffer encryptedFrame, ByteBuffer frame)
    Decrypts an encrypted frame into NIO ByteBuffer.
    default int
    getMaxPlaintextByteSize(MediaType mediaType, int encryptedFrameSize)
    Calculates the maximum possible size of the plaintext (decrypted) frame for a given encrypted frame size.
    void
    Transitions the decryptor to use a specific key ratchet.
    void
    transitionToPassthroughMode(boolean passthroughMode)
    Sets whether the decryptor should operate in passthrough mode.
  • Method Details

    • transitionToKeyRatchet

      void transitionToKeyRatchet(KeyRatchet keyRatchet)
      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 - true to enable passthrough, false to disable.
    • getMaxPlaintextByteSize

      default int getMaxPlaintextByteSize(MediaType mediaType, int encryptedFrameSize)
      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

      int decrypt(MediaType mediaType, byte[] encryptedFrame, byte[] frame)
      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 frame on success, or a negative error code (see DecryptorResultCode) on failure.
    • decrypt

      int decrypt(MediaType mediaType, ByteBuffer encryptedFrame, ByteBuffer frame)
      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 frame on success, or a negative error code on failure.
    • close

      void close()
      Specified by:
      close in interface AutoCloseable