public class SRTPCryptoContext extends Object
Constructor and Description |
---|
SRTPCryptoContext(long ssrcIn)
Construct an empty SRTPCryptoContext using ssrc.
|
SRTPCryptoContext(long ssrcIn,
int rocIn,
long kdr,
byte[] masterK,
byte[] masterS,
SRTPPolicy policyIn)
Construct a normal SRTPCryptoContext based on the given parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the crypto context.
|
SRTPCryptoContext |
deriveContext(long ssrc,
int roc,
long deriveRate)
Derive a new SRTPCryptoContext for use with a new SSRC
This method returns a new SRTPCryptoContext initialized with the data of
this SRTPCryptoContext.
|
void |
deriveSrtpKeys(long index)
Derives the srtp session keys from the master key
|
int |
getAuthTagLength()
Get the authentication tag length of this SRTP cryptographic context
|
int |
getMKILength()
Get the MKI length of this SRTP cryptographic context
|
int |
getROC()
Get the Roll-Over-Counter of this SRTP cryptographic context
|
long |
getSSRC()
Get the SSRC of this SRTP cryptographic context
|
void |
processPacketAESCM(RawPacket pkt)
Perform Counter Mode AES encryption / decryption
|
void |
processPacketAESF8(RawPacket pkt)
Perform F8 Mode AES encryption / decryption
|
boolean |
reverseTransformPacket(RawPacket pkt)
Transform a SRTP packet into a RTP packet.
|
void |
setROC(int rocIn)
Set the Roll-Over-Counter of this SRTP cryptographic context
|
void |
transformPacket(RawPacket pkt)
Transform a RTP packet into a SRTP packet.
|
public SRTPCryptoContext(long ssrcIn)
ssrcIn
- SSRC of this SRTPCryptoContextpublic SRTPCryptoContext(long ssrcIn, int rocIn, long kdr, byte[] masterK, byte[] masterS, SRTPPolicy policyIn)
ssrcIn
- the RTP SSRC that this SRTP cryptographic context protects.rocIn
- 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.kdr
- 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.policyIn
- SRTP policy for this SRTP cryptographic context, defined the
encryption algorithm, the authentication algorithm, etcpublic void close()
public int getAuthTagLength()
public int getMKILength()
public long getSSRC()
public int getROC()
public void setROC(int rocIn)
rocIn
- the Roll-Over-Counter of this SRTP cryptographic contextpublic void transformPacket(RawPacket pkt)
pkt
- the RTP packet that is going to be sent outpublic boolean reverseTransformPacket(RawPacket pkt)
pkt
- the RTP packet that is just receivedpublic void processPacketAESCM(RawPacket pkt)
pkt
- the RTP packet to be encrypted / decryptedpublic void processPacketAESF8(RawPacket pkt)
pkt
- the RTP packet to be encrypted / decryptedpublic void deriveSrtpKeys(long index)
index
- the 48 bit SRTP packet indexpublic SRTPCryptoContext deriveContext(long ssrc, int roc, long deriveRate)
ssrc
- The SSRC for this contextroc
- The Roll-Over-Counter for this contextderiveRate
- The key derivation rate for this contextCopyright © 2017 TeleStax, Inc.. All Rights Reserved.