Skip to content
Snippets Groups Projects
Commit ef9fad9c authored by Ingo Bauersachs's avatar Ingo Bauersachs
Browse files

Let ZRTP childstreams report the verification status of the main stream

parent 291d28a0
No related branches found
No related tags found
No related merge requests found
...@@ -58,14 +58,14 @@ public class SecurityEventManager extends ZrtpUserCallback ...@@ -58,14 +58,14 @@ public class SecurityEventManager extends ZrtpUserCallback
private final ZrtpControlImpl zrtpControl; private final ZrtpControlImpl zrtpControl;
/** /**
* A callback to the instance that created us. * The event manager that belongs to the ZRTP master session.
*/ */
private SrtpListener securityListener; private SecurityEventManager masterEventManager;
/** /**
* Is this a ZRTP DH (Master) session? * A callback to the instance that created us.
*/ */
private boolean isDHSession = false; private SrtpListener securityListener;
/** /**
* The type of this session. * The type of this session.
...@@ -89,7 +89,7 @@ public class SecurityEventManager extends ZrtpUserCallback ...@@ -89,7 +89,7 @@ public class SecurityEventManager extends ZrtpUserCallback
/** /**
* The class constructor. * The class constructor.
* *
* @param zrtpControl that this manager is to be associated with. * @param zrtpControl that this manager is to be associated with.
*/ */
public SecurityEventManager(ZrtpControlImpl zrtpControl) public SecurityEventManager(ZrtpControlImpl zrtpControl)
...@@ -109,13 +109,12 @@ public void setSessionType(MediaType sessionType) ...@@ -109,13 +109,12 @@ public void setSessionType(MediaType sessionType)
} }
/** /**
* Set the DH session flag. * Sets the event manager that belongs to the ZRTP master session.
* * @param master the event manager that belongs to the ZRTP master session.
* @param isDHSession the DH session flag.
*/ */
public void setDHSession(boolean isDHSession) void setMasterEventManager(SecurityEventManager master)
{ {
this.isDHSession = isDHSession; this.masterEventManager = master;
} }
/* /*
...@@ -164,7 +163,7 @@ public void showSAS(String sas, boolean isVerified) ...@@ -164,7 +163,7 @@ public void showSAS(String sas, boolean isVerified)
*/ */
public void setSASVerified(boolean isVerified) public void setSASVerified(boolean isVerified)
{ {
this.isSasVerified = sas != null && isVerified; this.isSasVerified = getSecurityString() != null && isVerified;
} }
/** /**
...@@ -209,17 +208,8 @@ public void showMessage(ZrtpCodes.MessageSeverity sev, ...@@ -209,17 +208,8 @@ public void showMessage(ZrtpCodes.MessageSeverity sev,
// Multi-stream session don't have own SAS data // Multi-stream session don't have own SAS data
if (inf == ZrtpCodes.InfoCodes.InfoSecureStateOn) if (inf == ZrtpCodes.InfoCodes.InfoSecureStateOn)
{ {
if (isDHSession) securityListener.securityTurnedOn(sessionType, cipher,
{
securityListener.securityTurnedOn(
sessionType, cipher,
zrtpControl); zrtpControl);
}
else
{
securityListener.securityTurnedOn(sessionType, cipher,
zrtpControl);
}
} }
} }
else if (msgCode instanceof ZrtpCodes.WarningCodes) else if (msgCode instanceof ZrtpCodes.WarningCodes)
...@@ -311,8 +301,7 @@ else if (msgCode instanceof ZrtpCodes.ZrtpErrorCodes) ...@@ -311,8 +301,7 @@ else if (msgCode instanceof ZrtpCodes.ZrtpErrorCodes)
logger.debug( logger.debug(
sessionTypeToString(sessionType) sessionTypeToString(sessionType)
+ ": ZRTP message: severity: " + sev + ", sub code: " + ": ZRTP message: severity: " + sev + ", sub code: "
+ msgCode + ", DH session: " + isDHSession + ", multi: " + msgCode + ", multi: " + multiStreams);
+ multiStreams);
} }
} }
...@@ -440,6 +429,11 @@ public void setSrtpListener(SrtpListener securityListener) ...@@ -440,6 +429,11 @@ public void setSrtpListener(SrtpListener securityListener)
*/ */
public String getSecurityString() public String getSecurityString()
{ {
if (masterEventManager != null && masterEventManager != this)
{
return masterEventManager.sas;
}
return sas; return sas;
} }
...@@ -460,6 +454,11 @@ public String getCipherString() ...@@ -460,6 +454,11 @@ public String getCipherString()
*/ */
public boolean isSecurityVerified() public boolean isSecurityVerified()
{ {
if (masterEventManager != null && masterEventManager != this)
{
return masterEventManager.isSasVerified;
}
return isSasVerified; return isSasVerified;
} }
......
...@@ -302,11 +302,13 @@ public void setMultistream(SrtpControl master) ...@@ -302,11 +302,13 @@ public void setMultistream(SrtpControl master)
if(!(master instanceof ZrtpControlImpl)) if(!(master instanceof ZrtpControlImpl))
throw new IllegalArgumentException("master is no ZRTP control"); throw new IllegalArgumentException("master is no ZRTP control");
ZrtpControlImpl zm = (ZrtpControlImpl)master;
ZRTPTransformEngine engine = getTransformEngine(); ZRTPTransformEngine engine = getTransformEngine();
engine.setMultiStrParams(((ZrtpControlImpl) master) engine.setMultiStrParams(zm.getTransformEngine().getMultiStrParams());
.getTransformEngine().getMultiStrParams());
engine.setEnableZrtp(true); engine.setEnableZrtp(true);
engine.getUserCallback().setMasterEventManager(
zm.getTransformEngine().getUserCallback());
} }
/** /**
...@@ -350,7 +352,6 @@ public void start(MediaType mediaType) ...@@ -350,7 +352,6 @@ public void start(MediaType mediaType)
if (masterSession) if (masterSession)
{ {
zrtpAutoStart = true; zrtpAutoStart = true;
securityEventManager.setDHSession(true);
// we know that audio is considered as master for zrtp // we know that audio is considered as master for zrtp
securityEventManager.setSessionType(mediaType); securityEventManager.setSessionType(mediaType);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment