Class SRTPTransformer

  • All Implemented Interfaces:
    PacketTransformer

    public class SRTPTransformer
    extends SinglePacketTransformer
    SRTPTransformer implements PacketTransformer and provides implementations for RTP packet to SRTP packet transformation and SRTP packet to RTP packet transformation logic. It will first find the corresponding SRTPCryptoContext for each packet based on their SSRC and then invoke the context object to perform the transformation and reverse transformation operation.
    Author:
    Bing SU (nova.su@gmail.com)
    • Constructor Detail

      • SRTPTransformer

        public SRTPTransformer​(org.jitsi.srtp.SrtpContextFactory factory)
        Initializes a new SRTPTransformer instance.
        Parameters:
        factory - the context factory to be used by the new instance for both directions.
      • SRTPTransformer

        public SRTPTransformer​(org.jitsi.srtp.SrtpContextFactory forwardFactory,
                               org.jitsi.srtp.SrtpContextFactory reverseFactory)
        Constructs a SRTPTransformer object.
        Parameters:
        forwardFactory - The associated context factory for forward transformations.
        reverseFactory - The associated context factory for reverse transformations.
    • Method Detail

      • setContextFactory

        public void setContextFactory​(org.jitsi.srtp.SrtpContextFactory factory,
                                      boolean forward)
        Sets a new key factory when key material has changed.
        Parameters:
        factory - The associated context factory for transformations.
        forward - true if the supplied factory is for forward transformations, false for the reverse transformation factory.
      • close

        public void close()
        Closes this SRTPTransformer and the underlying transform engines.It closes all stored crypto contexts. It deletes key data and forces a cleanup of the crypto contexts.
        Specified by:
        close in interface PacketTransformer
        Overrides:
        close in class SinglePacketTransformer
      • reverseTransform

        public RawPacket reverseTransform​(RawPacket pkt)
        Reverse-transforms a specific packet (i.e. transforms a transformed packet back).
        Specified by:
        reverseTransform in class SinglePacketTransformer
        Parameters:
        pkt - the transformed packet to be restored
        Returns:
        the restored packet