Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia
Class ZrtpControlImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.neomedia.ZrtpControlImpl
All Implemented Interfaces:
SrtpControl, ZrtpControl

public class ZrtpControlImpl
extends Object
implements ZrtpControl

Controls zrtp in the MediaStream.

Author:
Damian Minkov

Nested Class Summary
static class ZrtpControlImpl.ZRTPCustomInfoCodes
          Additional info codes for and data to support ZRTP4J.
 
Constructor Summary
ZrtpControlImpl()
          Creates the control.
 
Method Summary
 void cleanup()
          Cleans up the current zrtp control and its engine.
 String getHelloHash()
          Return the zrtp hello hash String.
 String[] getHelloHashSep()
          Get the ZRTP Hello Hash data - separate strings.
 byte[] getPeerZid()
          Get other party's ZID (ZRTP Identifier) data This functions returns the other party's ZID that was receivied during ZRTP processing.
 String getPeerZidString()
          Get other party's ZID (ZRTP Identifier) data as String This functions returns the other party's ZID that was receivied during ZRTP processing.
 boolean getSecureCommunicationStatus()
          Method for getting the default secure status value for communication
 String getSecurityString()
          Gets the SAS for the current media stream.
 SrtpListener getSrtpListener()
          Returns the ZrtpListener which listens for security events.
 long getTimeoutValue()
          Returns the timeout value that will we will wait and fire timeout secure event if call is not secured.
 ZRTPTransformEngine getTransformEngine()
          Returns the zrtp engine currently used by this stream.
 boolean isSecurityVerified()
          Gets the status of the SAS verification.
 boolean requiresSecureSignalingTransport()
          Returns false, ZRTP exchanges is keys over the media path.
 void setConnector(AbstractRTPConnector connector)
          Sets the RTPConnector which is to use or uses this ZRTP engine.
 void setMasterSession(boolean masterSession)
          When in multistream mode, enables the master session.
 void setMultistream(SrtpControl master)
          Start multi-stream ZRTP sessions.
 void setSASVerification(boolean verified)
          Sets the SAS verification
 void setSrtpListener(SrtpListener zrtpListener)
          Sets a ZrtpListener that will listen for zrtp security events.
 void start(MediaType mediaType)
          Starts and enables zrtp in the stream holding this control.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZrtpControlImpl

ZrtpControlImpl()
Creates the control.

Method Detail

cleanup

public void cleanup()
Cleans up the current zrtp control and its engine.

Specified by:
cleanup in interface SrtpControl

setSrtpListener

public void setSrtpListener(SrtpListener zrtpListener)
Sets a ZrtpListener that will listen for zrtp security events.

Specified by:
setSrtpListener in interface SrtpControl
Parameters:
zrtpListener - the ZrtpListener to set

getSrtpListener

public SrtpListener getSrtpListener()
Returns the ZrtpListener which listens for security events.

Specified by:
getSrtpListener in interface SrtpControl
Returns:
the ZrtpListener which listens for security events

getSecureCommunicationStatus

public boolean getSecureCommunicationStatus()
Method for getting the default secure status value for communication

Specified by:
getSecureCommunicationStatus in interface SrtpControl
Returns:
the default enabled/disabled status value for secure communication

setSASVerification

public void setSASVerification(boolean verified)
Sets the SAS verification

Specified by:
setSASVerification in interface ZrtpControl
Parameters:
verified - the new SAS verification status

getTransformEngine

public ZRTPTransformEngine getTransformEngine()
Returns the zrtp engine currently used by this stream.

Specified by:
getTransformEngine in interface SrtpControl
Returns:
the zrtp engine

setMasterSession

public void setMasterSession(boolean masterSession)
When in multistream mode, enables the master session.

Specified by:
setMasterSession in interface SrtpControl
Parameters:
masterSession - whether current control, controls the master session.

start

public void start(MediaType mediaType)
Starts and enables zrtp in the stream holding this control.

Specified by:
start in interface SrtpControl
Parameters:
mediaType - the media type of the stream this control controls.

setMultistream

public void setMultistream(SrtpControl master)
Start multi-stream ZRTP sessions. After the ZRTP Master (DH) session reached secure state the SCCallback calls this method to start the multi-stream ZRTP sessions. enable auto-start mode (auto-sensing) to the engine.

Specified by:
setMultistream in interface SrtpControl
Parameters:
master - master SRTP data

getHelloHash

public String getHelloHash()
Return the zrtp hello hash String.

Specified by:
getHelloHash in interface ZrtpControl
Returns:
String the zrtp hello hash.

getHelloHashSep

public String[] getHelloHashSep()
Get the ZRTP Hello Hash data - separate strings.

Specified by:
getHelloHashSep in interface ZrtpControl
Returns:
String array containing the version string at offset 0, the Hello hash value as hex-digits at offset 1. Hello hash is available immediately after class instantiation. Returns null if ZRTP is not available.

setConnector

public void setConnector(AbstractRTPConnector connector)
Sets the RTPConnector which is to use or uses this ZRTP engine.

Specified by:
setConnector in interface SrtpControl
Parameters:
connector - the RTPConnector which is to use or uses this ZRTP engine

getSecurityString

public String getSecurityString()
Description copied from interface: ZrtpControl
Gets the SAS for the current media stream.

Specified by:
getSecurityString in interface ZrtpControl
Returns:
the four character ZRTP SAS.

isSecurityVerified

public boolean isSecurityVerified()
Description copied from interface: ZrtpControl
Gets the status of the SAS verification.

Specified by:
isSecurityVerified in interface ZrtpControl
Returns:
true when the SAS has been verified.

getPeerZid

public byte[] getPeerZid()
Description copied from interface: ZrtpControl
Get other party's ZID (ZRTP Identifier) data This functions returns the other party's ZID that was receivied during ZRTP processing. The ZID data can be retrieved after ZRTP receive the first Hello packet from the other party.

Specified by:
getPeerZid in interface ZrtpControl
Returns:
the ZID data as byte array.

getPeerZidString

public String getPeerZidString()
Description copied from interface: ZrtpControl
Get other party's ZID (ZRTP Identifier) data as String This functions returns the other party's ZID that was receivied during ZRTP processing. The ZID data can be retrieved after ZRTP receive the first Hello packet from the other party.

Specified by:
getPeerZidString in interface ZrtpControl
Returns:
the ZID data as String.

requiresSecureSignalingTransport

public boolean requiresSecureSignalingTransport()
Returns false, ZRTP exchanges is keys over the media path.

Specified by:
requiresSecureSignalingTransport in interface SrtpControl
Returns:
false

getTimeoutValue

public long getTimeoutValue()
Returns the timeout value that will we will wait and fire timeout secure event if call is not secured. The value is in milliseconds.

Specified by:
getTimeoutValue in interface ZrtpControl
Returns:
the timeout value that will we will wait and fire timeout secure event if call is not secured.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.