|
SIP Communicator: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.impl.media.transform.zrtp.ZRTPTransformEngine
public class ZRTPTransformEngine
JMF extension/connector to support GNU ZRTP4J. ZRTP was developed by Phil Zimmermann and provides functions to negotiate keys and other necessary data (crypto data) to set-up the Secure RTP (SRTP) crypto context. Refer to Phil's ZRTP specification at his Zfone project site to get more detailed information about the capabilities of ZRTP.
+---------------------------+
| ZrtpTransformConnector |
| extends TransformConnector|
| implements RTPConnector |
+---------------------------+
|
| uses
|
+----------------+ +-----+---------------+
| Application | | | +----------------+
| instantiates | uses | ZRTPTransformEngine | uses | |
| a ZRTP Session +------+ implements +------+ GNU ZRTP4J |
| and provides | | ZrtpCallback | | core |
|ZrtpUserCallback| | | | implementation |
+----------------+ +---------------------+ | (ZRtp et al) |
| |
+----------------+
The following short code snippets show how an application could instantiate a
ZrtpTransformConnector, get the ZRTP4J engine and initialize it. Then the
code get a RTP manager instance and initializes it with the
ZRTPTransformConnector. Plase note: setting the target must be done with the
connector, not with the RTP manager.
...
transConnector = (ZrtpTransformConnector)TransformManager
.createZRTPConnector(sa);
zrtpEngine = transConnector.getEngine();
zrtpEngine.setUserCallback(new MyCallback());
if (!zrtpEngine.initialize("test_t.zid"))
System.out.println("iniatlize failed");
// initialize the RTPManager using the ZRTP connector
mgr = RTPManager.newInstance();
mgr.initialize(transConnector);
mgr.addSessionListener(this);
mgr.addReceiveStreamListener(this);
transConnector.addTarget(target);
zrtpEngine.startZrtp();
...
The demo folder contains a small example that shows how to use GNU
ZRTP4J.
This ZRTPTransformEngine documentation shows the ZRTP specific extensions and
describes overloaded methods and a possible different behaviour.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface gnu.java.zrtp.ZrtpCallback |
|---|
gnu.java.zrtp.ZrtpCallback.EnableSecurity, gnu.java.zrtp.ZrtpCallback.Role |
| Field Summary | |
|---|---|
protected static int |
ZRTP_PACKET_HEADER
Each ZRTP packet has a fixed header of 12 bytes. |
| Constructor Summary | |
|---|---|
ZRTPTransformEngine()
Construct a ZRTPTransformEngine. |
|
| Method Summary | |
|---|---|
void |
acceptEnrollment(boolean accepted)
Used to accept a PBX enrollment request (The PBX part needs further development) |
int |
activateTimer(int time)
|
int |
cancelTimer()
|
boolean |
checkSASSignature(String sas)
|
void |
cleanup()
Cleanup function for any remaining timers |
String |
getHelloHash()
Gets the Hello packet Hash |
byte[] |
getMultiStrParams()
Gets the multistream params |
PacketTransformer |
getRTCPTransformer()
Returns an instance of ZRTPCTransformer. |
PacketTransformer |
getRTPTransformer()
Returns this RTPTransformer. |
byte[] |
getSignatureData()
Gets signature data |
int |
getSignatureLength()
Gets signature length |
SecurityEventManager |
getUserCallback()
Gets the user callback used to manage the GUI part of ZRTP |
byte[] |
getZid()
Get other party's ZID (ZRTP Identifier) data This functions returns the other party's ZID that was receivied during ZRTP processing. |
void |
handleGoClear()
Method called by the Zrtp class as result of a GoClear request from the other peer. |
void |
handleTimeout()
Timeout handling function. |
boolean |
initialize(String zidFilename)
Default engine initialization method. |
boolean |
initialize(String zidFilename,
boolean autoEnable)
Engine initialization method. |
boolean |
initialize(String zidFilename,
boolean autoEnable,
gnu.java.zrtp.ZrtpConfigure config)
Custom engine initialization method. |
boolean |
initialize(String zidFilename,
gnu.java.zrtp.ZrtpConfigure config)
Engine initialization method. |
boolean |
isEnableZrtp()
Returns the enableZrtp flag. |
boolean |
isMultiStream()
Gets the multistream flag (The multistream part needs further development) |
boolean |
isStarted()
Returns the current status of the ZRTP engine |
void |
requestGoClear()
Method called when the user requests through GUI to switch a secured call to unsecure mode. |
void |
requestGoSecure()
Method called when the user requests through GUI to switch a previously unsecured call back to secure mode. |
void |
resetSASVerified()
Resets the internal engine SAS verified flag |
RawPacket |
reverseTransform(RawPacket pkt)
The input data stream calls this method to transform incoming packets. |
void |
SASVerified()
Set the SAS as verified internally if the user confirms it |
boolean |
sendDataZRTP(byte[] data)
The callback method required by the ZRTP implementation. |
void |
sendInfo(gnu.java.zrtp.ZrtpCodes.MessageSeverity severity,
EnumSet<?> subCode)
|
void |
setAuxSecret(byte[] data)
Sets the auxilliary secret data |
void |
setClientId(String id)
Sets the client ID |
void |
setConnector(TransformConnector connector)
Sets the RTP connector using this ZRTP engine (This method should be changed to an addConnector to a connector array managed by the engine for implementing multistream mode) |
void |
setEnableZrtp(boolean onOff)
Sets the enableZrtp flag. |
void |
setMultiStrParams(byte[] parameters)
Sets the multistream params (The multistream part needs further development) |
void |
setOwnSSRC(long ssrc)
Set the SSRC of the RTP transmitter stream. |
void |
setPBXEnrollment(boolean yesNo)
Sets the PBX enrollment flag (see chapter 8.3 of ZRTP standards) (The PBX part needs further development) |
void |
setPbxSecret(byte[] data)
Sets the PBX secret data |
boolean |
setSignatureData(byte[] data)
Sets signature data for the Confirm packets |
void |
setUserCallback(SecurityEventManager ub)
Sets the user callback class used to maintain the GUI ZRTP part |
void |
signSAS(String sas)
|
void |
srtpSecretsOff(gnu.java.zrtp.ZrtpCallback.EnableSecurity part)
|
void |
srtpSecretsOn(String c,
String s,
boolean verified)
|
boolean |
srtpSecretsReady(gnu.java.zrtp.ZrtpSrtpSecrets secrets,
gnu.java.zrtp.ZrtpCallback.EnableSecurity part)
|
void |
startZrtp()
Start the ZRTP stack immediately, not autosensing mode. |
void |
stopZrtp()
Stop ZRTP engine. |
RawPacket |
transform(RawPacket pkt)
The data output stream calls this method to transform outgoing packets. |
void |
zrtpAskEnrollment(String info)
|
void |
zrtpInformEnrollment(String info)
|
void |
zrtpNegotiationFailed(gnu.java.zrtp.ZrtpCodes.MessageSeverity severity,
EnumSet<?> subCode)
|
void |
zrtpNotSuppOther()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int ZRTP_PACKET_HEADER
| Constructor Detail |
|---|
public ZRTPTransformEngine()
| Method Detail |
|---|
public PacketTransformer getRTCPTransformer()
getRTCPTransformer in interface TransformEngineTransformEngine.getRTCPTransformer()public PacketTransformer getRTPTransformer()
getRTPTransformer in interface TransformEngineTransformEngine.getRTPTransformer()
public boolean initialize(String zidFilename,
gnu.java.zrtp.ZrtpConfigure config)
zidFilename - The ZID file nameconfig - The configuration data
public boolean initialize(String zidFilename,
boolean autoEnable)
zidFilename - The ZID file nameautoEnable - If true start with auto-sensing mode.
public boolean initialize(String zidFilename)
zidFilename - The ZID file name
public boolean initialize(String zidFilename,
boolean autoEnable,
gnu.java.zrtp.ZrtpConfigure config)
zidFilename - The ZID file nameautoEnable - Set this true to start with auto-sensing and false to
disable it.
public void startZrtp()
public void stopZrtp()
public void cleanup()
public void setOwnSSRC(long ssrc)
ssrc - public RawPacket transform(RawPacket pkt)
transform in interface PacketTransformerpkt - The packet to be transformed
PacketTransformer.transform(RawPacket)public RawPacket reverseTransform(RawPacket pkt)
reverseTransform in interface PacketTransformerpkt - The transformed packet to be restored
PacketTransformer.reverseTransform(RawPacket)public boolean sendDataZRTP(byte[] data)
sendDataZRTP in interface gnu.java.zrtp.ZrtpCallbackdata - The ZRTP packet data
public boolean srtpSecretsReady(gnu.java.zrtp.ZrtpSrtpSecrets secrets,
gnu.java.zrtp.ZrtpCallback.EnableSecurity part)
srtpSecretsReady in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.srtpSecretsReady(
gnu.java.zrtp.ZrtpSrtpSecrets,
gnu.java.zrtp.ZrtpCallback.EnableSecurity)
public void srtpSecretsOn(String c,
String s,
boolean verified)
srtpSecretsOn in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.srtpSecretsOn(java.lang.String,
java.lang.String, boolean)public void srtpSecretsOff(gnu.java.zrtp.ZrtpCallback.EnableSecurity part)
srtpSecretsOff in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.srtpSecretsOff(
gnu.java.zrtp.ZrtpCallback.EnableSecurity)public int activateTimer(int time)
activateTimer in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.activateTimer(int)public int cancelTimer()
cancelTimer in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.cancelTimer()public void handleTimeout()
public void sendInfo(gnu.java.zrtp.ZrtpCodes.MessageSeverity severity,
EnumSet<?> subCode)
sendInfo in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.sendInfo(
gnu.java.zrtp.ZrtpCodes.MessageSeverity,
java.util.EnumSet)
public void zrtpNegotiationFailed(gnu.java.zrtp.ZrtpCodes.MessageSeverity severity,
EnumSet<?> subCode)
zrtpNegotiationFailed in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.zrtpNegotiationFailed(
gnu.java.zrtp.ZrtpCodes.MessageSeverity,
java.util.EnumSet)public void zrtpNotSuppOther()
zrtpNotSuppOther in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.zrtpNotSuppOther()public void zrtpAskEnrollment(String info)
zrtpAskEnrollment in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.zrtpAskEnrollment(java.lang.String)public void zrtpInformEnrollment(String info)
zrtpInformEnrollment in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.zrtpInformEnrollment(java.lang.String)public void signSAS(String sas)
signSAS in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.signSAS(java.lang.String)public boolean checkSASSignature(String sas)
checkSASSignature in interface gnu.java.zrtp.ZrtpCallbackZrtpCallback.checkSASSignature(java.lang.String)public void setEnableZrtp(boolean onOff)
onOff - The value for the enableZrtp flag.public boolean isEnableZrtp()
public void SASVerified()
public void resetSASVerified()
public void requestGoClear()
public void requestGoSecure()
public void setAuxSecret(byte[] data)
data - The auxilliary secret datapublic void setPbxSecret(byte[] data)
data - The PBX secret datapublic void setClientId(String id)
id - The client IDpublic String getHelloHash()
public byte[] getMultiStrParams()
public void setMultiStrParams(byte[] parameters)
parameters - the multistream paramspublic boolean isMultiStream()
public void acceptEnrollment(boolean accepted)
accepted - The boolean value indicating if the request is acceptedpublic boolean setSignatureData(byte[] data)
data - the signature data
public byte[] getSignatureData()
public int getSignatureLength()
public void setPBXEnrollment(boolean yesNo)
yesNo - The PBX enrollment flagpublic void handleGoClear()
handleGoClear in interface gnu.java.zrtp.ZrtpCallbackpublic void setConnector(TransformConnector connector)
connector - the connector to setpublic void setUserCallback(SecurityEventManager ub)
ub - The user callback classpublic boolean isStarted()
public SecurityEventManager getUserCallback()
public byte[] getZid()
|
SIP Communicator: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||