public class SRTPCryptoContext extends BaseSRTPCryptoContext
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CHECK_REPLAY_PNAME
The name of the boolean ConfigurationService property
which indicates whether protection against replay attacks is to be
activated.
|
authKey, cipherCtr, cipherF8, encKey, ivStore, mac, masterKey, masterSalt, policy, rbStore, REPLAY_WINDOW_SIZE, replayWindow, saltKey, ssrc, tagStore, tempStore
Constructor and Description |
---|
SRTPCryptoContext(boolean sender,
int ssrc)
Constructs an empty SRTPCryptoContext using ssrc.
|
SRTPCryptoContext(boolean sender,
int ssrc,
int roc,
long keyDerivationRate,
byte[] masterK,
byte[] masterS,
SRTPPolicy policy)
Constructs a normal SRTPCryptoContext based on the given parameters.
|
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
checkReplay(int seqNo,
long guessedIndex)
Checks if a packet is a replayed based on its sequence number.
|
SRTPCryptoContext |
deriveContext(int ssrc,
int roc,
long deriveRate)
Derives a new SRTPCryptoContext for use with a new SSRC.
|
void |
deriveSrtpKeys(long index)
Derives the srtp session keys from the master key
|
void |
processPacketAESCM(RawPacket pkt)
Performs Counter Mode AES encryption/decryption
|
void |
processPacketAESF8(RawPacket pkt)
Performs F8 Mode AES encryption/decryption
|
boolean |
reverseTransformPacket(RawPacket pkt)
Transforms an SRTP packet into an RTP packet.
|
boolean |
transformPacket(RawPacket pkt)
Transforms an RTP packet into an SRTP packet.
|
authenticatePacketHMAC, close, getAuthTagLength, getMKILength, getSSRC
public static final java.lang.String CHECK_REPLAY_PNAME
public SRTPCryptoContext(boolean sender, int ssrc)
sender
- true if the new instance is to be used by an SRTP
sender; false if the new instance is to be used by an SRTP
receiverssrc
- SSRC of this SRTPCryptoContextpublic SRTPCryptoContext(boolean sender, int ssrc, int roc, long keyDerivationRate, byte[] masterK, byte[] masterS, SRTPPolicy policy)
sender
- true if the new instance is to be used by an SRTP
sender; false if the new instance is to be used by an SRTP
receiverssrc
- the RTP SSRC that this SRTP cryptographic context protects.roc
- the initial Roll-Over-Counter according to RFC 3711. These
are the upper 32 bit of the overall 48 bit SRTP packet index. Refer to
chapter 3.2.1 of the RFC.keyDerivationRate
- the key derivation rate defines when to
recompute the SRTP session keys. Refer to chapter 4.3.1 in the RFC.masterK
- byte array holding the master key for this SRTP
cryptographic context. Refer to chapter 3.2.1 of the RFC about the role
of the master key.masterS
- byte array holding the master salt for this SRTP
cryptographic context. It is used to computer the initialization vector
that in turn is input to compute the session key, session authentication
key and the session salt.policy
- SRTP policy for this SRTP cryptographic context, defined
the encryption algorithm, the authentication algorithm, etcboolean checkReplay(int seqNo, long guessedIndex)
seqNo
- sequence number of the packetguessedIndex
- guessed ROCpublic SRTPCryptoContext deriveContext(int ssrc, int roc, long deriveRate)
ssrc
- The SSRC for this contextroc
- The Roll-Over-Counter for this contextderiveRate
- The key derivation rate for this contextpublic void deriveSrtpKeys(long index)
index
- the 48 bit SRTP packet indexpublic void processPacketAESCM(RawPacket pkt)
pkt
- the RTP packet to be encrypted/decryptedpublic void processPacketAESF8(RawPacket pkt)
pkt
- the RTP packet to be encrypted/decryptedpublic boolean reverseTransformPacket(RawPacket pkt)
pkt
- the RTP packet that is just receivedpublic boolean transformPacket(RawPacket pkt)
pkt
- the RTP packet that is going to be sent out
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.