aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java
diff options
context:
space:
mode:
authorIngo Bauersachs <ingo@jitsi.org>2011-10-04 12:46:30 +0000
committerIngo Bauersachs <ingo@jitsi.org>2011-10-04 12:46:30 +0000
commitb4f81df16d5630eaef5ac92cbc7c3d332b8ff353 (patch)
treeae6a352781c46ba2ca0642117e30aec7095c62e5 /src/net/java
parent37cc390fdcfe7a092a7365d0da5e96e952ded2b1 (diff)
downloadjitsi-b4f81df16d5630eaef5ac92cbc7c3d332b8ff353.zip
jitsi-b4f81df16d5630eaef5ac92cbc7c3d332b8ff353.tar.gz
jitsi-b4f81df16d5630eaef5ac92cbc7c3d332b8ff353.tar.bz2
Adapt Call UI to multiple encryption methods
Diffstat (limited to 'src/net/java')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/CallPeerAdapter.java44
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/CallPeerRenderer.java40
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPeerPanel.java123
-rw-r--r--[-rwxr-xr-x]src/net/java/sip/communicator/impl/gui/main/call/SecurityPanel.java194
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/ZrtpSecurityPanel.java123
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/conference/BasicConferenceParticipantPanel.java75
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceFocusPanel.java151
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/conference/ConferencePeerPanel.java78
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java29
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/transform/sdes/SDesControlImpl.java11
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/transform/zrtp/SecurityEventManager.java26
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java14
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java12
-rw-r--r--src/net/java/sip/communicator/service/neomedia/SrtpControl.java17
-rw-r--r--src/net/java/sip/communicator/service/neomedia/ZrtpControl.java21
-rw-r--r--src/net/java/sip/communicator/service/neomedia/event/SrtpListener.java13
-rw-r--r--src/net/java/sip/communicator/service/protocol/AbstractCallPeer.java19
-rw-r--r--src/net/java/sip/communicator/service/protocol/OperationSetSecureTelephony.java10
-rw-r--r--[-rwxr-xr-x]src/net/java/sip/communicator/service/protocol/event/CallPeerSecurityOnEvent.java57
-rw-r--r--src/net/java/sip/communicator/service/protocol/event/CallPeerSecurityStatusEvent.java4
-rw-r--r--src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java20
-rw-r--r--src/net/java/sip/communicator/service/protocol/media/MediaAwareCallPeer.java23
22 files changed, 444 insertions, 660 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallPeerAdapter.java b/src/net/java/sip/communicator/impl/gui/main/call/CallPeerAdapter.java
index e27525c..38e6099 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/CallPeerAdapter.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/CallPeerAdapter.java
@@ -256,39 +256,19 @@ public class CallPeerAdapter
/**
* Creates the security panel, when a <tt>securityOnEvent</tt> is received.
- * @param securityOnEvent the event we received
+ * @param evt the event we received
*/
- public void securityOn(CallPeerSecurityOnEvent securityOnEvent)
+ public void securityOn(CallPeerSecurityOnEvent evt)
{
- CallPeer peer = (CallPeer) securityOnEvent.getSource();
+ CallPeer peer = (CallPeer) evt.getSource();
if (!peer.equals(callPeer))
return;
- OperationSetSecureTelephony secure
- = callPeer.getProtocolProvider().getOperationSet(
- OperationSetSecureTelephony.class);
+ renderer.securityOn(evt);
- if (secure != null)
- {
- renderer.securityOn(securityOnEvent.getSecurityString(),
- securityOnEvent.isSecurityVerified());
-
- renderer.setEncryptionCipher(securityOnEvent.getCipher());
-
- switch (securityOnEvent.getSessionType())
- {
- case CallPeerSecurityOnEvent.AUDIO_SESSION:
- renderer.setAudioSecurityOn(true);
- break;
- case CallPeerSecurityOnEvent.VIDEO_SESSION:
- renderer.setVideoSecurityOn(true);
- break;
- }
-
- NotificationManager.fireNotification(
- NotificationManager.CALL_SECURITY_ON);
- }
+ NotificationManager.fireNotification(
+ NotificationManager.CALL_SECURITY_ON);
}
/**
@@ -302,17 +282,7 @@ public class CallPeerAdapter
if (!peer.equals(callPeer))
return;
- renderer.securityOff();
-
- switch (securityOffEvent.getSessionType())
- {
- case CallPeerSecurityOnEvent.AUDIO_SESSION:
- renderer.setAudioSecurityOn(false);
- break;
- case CallPeerSecurityOnEvent.VIDEO_SESSION:
- renderer.setVideoSecurityOn(false);
- break;
- }
+ renderer.securityOff(securityOffEvent);
}
/**
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallPeerRenderer.java b/src/net/java/sip/communicator/impl/gui/main/call/CallPeerRenderer.java
index db6d166..61a9b99 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/CallPeerRenderer.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/CallPeerRenderer.java
@@ -8,6 +8,9 @@ package net.java.sip.communicator.impl.gui.main.call;
import java.awt.*;
+import net.java.sip.communicator.service.protocol.event.CallPeerSecurityOffEvent;
+import net.java.sip.communicator.service.protocol.event.CallPeerSecurityOnEvent;
+
/**
* The <tt>CallPeerRenderer</tt> interface is meant to be implemented by
* different renderers of <tt>CallPeer</tt>s. Through this interface they would
@@ -63,44 +66,17 @@ public interface CallPeerRenderer
public void setOnHold(boolean isOnHold);
/**
- * Indicates that the security is turned on by specifying the
- * <tt>securityString</tt> and whether it has been already verified.
+ * Indicates that the security is turned on.
*
- * @param securityString the security string
- * @param isSecurityVerified indicates if the security string has been
- * already verified by the underlying <tt>CallPeer</tt>
+ * @param evt Details about the event that caused this message.
*/
- public void securityOn( String securityString,
- boolean isSecurityVerified);
+ public void securityOn(CallPeerSecurityOnEvent evt);
/**
* Indicates that the security is turned off.
+ * @param evt Details about the event that caused this message.
*/
- public void securityOff();
-
- /**
- * Sets the audio security on or off.
- *
- * @param isAudioSecurityOn indicates if the audio security is turned on or
- * off.
- */
- public void setAudioSecurityOn(boolean isAudioSecurityOn);
-
- /**
- * Sets the video security on or off.
- *
- * @param isVideoSecurityOn indicates if the video security is turned on or
- * off.
- */
- public void setVideoSecurityOn(boolean isVideoSecurityOn);
-
- /**
- * Sets the cipher used for the encryption of the current call.
- *
- * @param encryptionCipher the cipher used for the encryption of the
- * current call.
- */
- public void setEncryptionCipher(String encryptionCipher);
+ public void securityOff(CallPeerSecurityOffEvent evt);
/**
* Sets the call peer adapter that manages all related listeners.
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPeerPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPeerPanel.java
index c881004..f8a4a9b 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPeerPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPeerPanel.java
@@ -461,36 +461,13 @@ public class OneToOneCallPeerPanel
*/
private void initSecuritySettings()
{
- OperationSetSecureTelephony secure
- = callPeer.getProtocolProvider().getOperationSet(
- OperationSetSecureTelephony.class);
+ CallPeerSecurityStatusEvent securityEvent
+ = callPeer.getCurrentSecuritySettings();
- if (secure != null)
+ if (securityEvent != null
+ && securityEvent instanceof CallPeerSecurityOnEvent)
{
- CallPeerSecurityStatusEvent securityEvent
- = callPeer.getCurrentSecuritySettings();
-
- if (securityEvent != null
- && securityEvent instanceof CallPeerSecurityOnEvent)
- {
- CallPeerSecurityOnEvent securityOnEvt
- = (CallPeerSecurityOnEvent) securityEvent;
-
- securityOn( securityOnEvt.getSecurityString(),
- securityOnEvt.isSecurityVerified());
-
- setEncryptionCipher(securityOnEvt.getCipher());
-
- switch (securityOnEvt.getSessionType())
- {
- case CallPeerSecurityOnEvent.AUDIO_SESSION:
- setAudioSecurityOn(true);
- break;
- case CallPeerSecurityOnEvent.VIDEO_SESSION:
- setVideoSecurityOn(true);
- break;
- }
- }
+ securityOn((CallPeerSecurityOnEvent) securityEvent);
}
}
@@ -1233,21 +1210,31 @@ public class OneToOneCallPeerPanel
* <p>
* Sets the secured status icon to the status panel and initializes/updates
* the corresponding security details.
- * @param securityString the security string
- * @param isSecurityVerified indicates if the security string has been
- * already verified by the underlying <tt>CallPeer</tt>
+ * @param evt Details about the event that caused this message.
*/
- public void securityOn( String securityString,
- boolean isSecurityVerified)
+ public void securityOn(CallPeerSecurityOnEvent evt)
{
securityStatusLabel.setIcon(new ImageIcon(ImageLoader
.getImage(ImageLoader.SECURE_BUTTON_ON)));
securityImageID = ImageLoader.SECURE_BUTTON_ON;
+ //set common encryption properties
+ securityStatusLabel.setEncryptionCipher(evt.getCipher());
+ switch (evt.getSessionType())
+ {
+ case CallPeerSecurityStatusEvent.AUDIO_SESSION:
+ securityStatusLabel.setAudioSecurityOn(true);
+ break;
+ case CallPeerSecurityStatusEvent.VIDEO_SESSION:
+ securityStatusLabel.setVideoSecurityOn(true);
+ break;
+ }
+
+ //set encryption specific options
if (securityPanel == null)
{
- securityPanel = new SecurityPanel(callPeer);
+ securityPanel = SecurityPanel.create(evt.getSecurityController());
GridBagConstraints constraints = new GridBagConstraints();
@@ -1259,13 +1246,37 @@ public class OneToOneCallPeerPanel
constraints.insets = new Insets(5, 0, 0, 0);
this.add(securityPanel, constraints);
}
-
- securityPanel.refreshStates(securityString, isSecurityVerified);
+ securityPanel.refreshStates();
this.revalidate();
}
/**
+ * Indicates that the security has gone off.
+ */
+ public void securityOff(CallPeerSecurityOffEvent evt)
+ {
+ securityImageID = ImageLoader.SECURE_BUTTON_OFF;
+ securityStatusLabel.setIcon(new ImageIcon(ImageLoader
+ .getImage(securityImageID)));
+
+ switch (evt.getSessionType())
+ {
+ case CallPeerSecurityStatusEvent.AUDIO_SESSION:
+ securityStatusLabel.setAudioSecurityOn(true);
+ break;
+ case CallPeerSecurityStatusEvent.VIDEO_SESSION:
+ securityStatusLabel.setVideoSecurityOn(true);
+ break;
+ }
+
+ if (securityPanel != null)
+ {
+ securityPanel.getParent().remove(securityPanel);
+ }
+ }
+
+ /**
* Determines whether a specific <tt>Container</tt> is an ancestor of a
* specific <tt>Component</tt> (in the UI hierarchy).
*
@@ -1293,46 +1304,6 @@ public class OneToOneCallPeerPanel
}
/**
- * Indicates that the security has gone off.
- */
- public void securityOff()
- {
- securityStatusLabel.setIcon(new ImageIcon(ImageLoader
- .getImage(ImageLoader.SECURE_BUTTON_OFF)));
-
- securityImageID = ImageLoader.SECURE_BUTTON_OFF;
- }
-
- /**
- * Updates all related components to fit the new value.
- * @param isAudioSecurityOn indicates if the audio security is turned on
- * or off.
- */
- public void setAudioSecurityOn(boolean isAudioSecurityOn)
- {
- securityStatusLabel.setAudioSecurityOn(isAudioSecurityOn);
- }
-
- /**
- * Updates all related components to fit the new value.
- * @param encryptionCipher the encryption cipher to show
- */
- public void setEncryptionCipher(String encryptionCipher)
- {
- securityStatusLabel.setEncryptionCipher(encryptionCipher);
- }
-
- /**
- * Updates all related components to fit the new value.
- * @param isVideoSecurityOn indicates if the video security is turned on
- * or off.
- */
- public void setVideoSecurityOn(boolean isVideoSecurityOn)
- {
- securityStatusLabel.setVideoSecurityOn(isVideoSecurityOn);
- }
-
- /**
* Sets the call peer adapter managing all related listeners.
* @param adapter the adapter to set
*/
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/SecurityPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/SecurityPanel.java
index d9cd529..e917f91 100755..100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/SecurityPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/SecurityPanel.java
@@ -1,143 +1,51 @@
-/*
- * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.sip.communicator.impl.gui.main.call;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-
-import net.java.sip.communicator.impl.gui.*;
-import net.java.sip.communicator.impl.gui.utils.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.util.skin.*;
-import net.java.sip.communicator.util.swing.*;
-
-/**
- * The panel containing details about call security.
- *
- * @author Werner Dittman
- * @author Lubomir Marinov
- * @author Yana Stamcheva
- */
-public class SecurityPanel
- extends TransparentPanel
- implements Skinnable
-{
- private final CallPeer peer;
-
- private Image iconEncr;
- private Image iconEncrVerified;
-
- private boolean sasVerified = false;
-
- private SIPCommButton sasVerificationButton;
-
- private final JLabel securityStringLabel = new JLabel();
-
- /**
- * Creates an instance of <tt>SecurityPanel</tt> by specifying the
- * corresponding <tt>peer</tt>.
- * @param peer the <tt>CallPeer</tt>, with which we established an
- * encrypted call
- */
- public SecurityPanel(CallPeer peer)
- {
- this.peer = peer;
-
- this.setBorder(null);
- this.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0));
-
- this.setToolTipText(GuiActivator.getResources().getI18NString(
- "service.gui.COMPARE_WITH_PARTNER"));
-
- loadSkin();
- }
-
- /**
- * Adds security related components to this panel.
- */
- private void addComponentsToPane()
- {
- this.add(sasVerificationButton);
- this.add(securityStringLabel);
-
- securityStringLabel
- .setFont(securityStringLabel.getFont().deriveFont(14f));
-
- // Action to trigger SAS verification
- sasVerificationButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- Call call = peer.getCall();
-
- if (call != null)
- {
- OperationSetSecureTelephony secure
- = call
- .getProtocolProvider()
- .getOperationSet(
- OperationSetSecureTelephony.class);
-
- if (secure != null)
- {
- secure.setSasVerified( peer, !sasVerified);
- }
-
- if (sasVerified)
- {
- sasVerified = false;
- sasVerificationButton.setImage(iconEncr);
- }
- else
- {
- sasVerified = true;
- sasVerificationButton.setImage(iconEncrVerified);
- }
- }
- }
- });
- }
-
- /**
- * Refreshes the state of the <tt>securityString</tt> and the
- * <tt>isSecurityVerified</tt> corresponding components.
- *
- * @param securityString the security string
- * @param isSecurityVerified indicates if the security string has been
- * already verified
- */
- public void refreshStates(String securityString, boolean isSecurityVerified)
- {
- if (securityString != null)
- {
- securityStringLabel.setText(GuiActivator.getResources().
- getI18NString("service.gui.COMPARE_WITH_PARTNER_SHORT",
- new String[] {securityString}));
- }
-
- sasVerificationButton
- .setImage(isSecurityVerified ? iconEncrVerified : iconEncr);
-
- revalidate();
- repaint();
- }
-
- /**
- * Reloads icons and components.
- */
- public void loadSkin()
- {
- this.removeAll();
- iconEncrVerified = ImageLoader.getImage(ImageLoader.ENCR_VERIFIED);
- iconEncr = ImageLoader.getImage(ImageLoader.ENCR);
- sasVerificationButton = new SIPCommButton(iconEncr);
-
- this.addComponentsToPane();
- }
-}
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.gui.main.call;
+
+import net.java.sip.communicator.service.neomedia.*;
+import net.java.sip.communicator.util.skin.*;
+import net.java.sip.communicator.util.swing.*;
+
+/**
+ * Base class for security panels that show encryption specific UI controls.
+ *
+ * @author Ingo Bauersachs
+ */
+public abstract class SecurityPanel
+ extends TransparentPanel
+ implements Skinnable
+{
+ /**
+ * Creates the security panel depending on the concrete implementation of
+ * the passed security controller.
+ *
+ * @param srtpControl the security controller that provides the information
+ * to be shown on the UI
+ * @return An instance of a {@link SecurityPanel} for the security
+ * controller or an {@link TransparentPanel} if the controller is
+ * unknown or does not have any controls to show.
+ */
+ public static SecurityPanel create(SrtpControl srtpControl)
+ {
+ if(srtpControl instanceof ZrtpControl)
+ return new ZrtpSecurityPanel((ZrtpControl)srtpControl);
+
+ return new SecurityPanel()
+ {
+ public void loadSkin()
+ {}
+ public void refreshStates()
+ {}
+ };
+ }
+
+ /**
+ * Forces the panel to update the security information presented to the
+ * user.
+ */
+ public abstract void refreshStates();
+}
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/ZrtpSecurityPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/ZrtpSecurityPanel.java
new file mode 100644
index 0000000..22d70ba
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/gui/main/call/ZrtpSecurityPanel.java
@@ -0,0 +1,123 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.gui.main.call;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import javax.swing.*;
+
+import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.impl.gui.utils.*;
+import net.java.sip.communicator.service.neomedia.*;
+import net.java.sip.communicator.util.swing.*;
+
+/**
+ * The panel containing details about ZRTP call security.
+ *
+ * @author Werner Dittman
+ * @author Lubomir Marinov
+ * @author Yana Stamcheva
+ */
+public class ZrtpSecurityPanel
+ extends SecurityPanel
+{
+ private SIPCommButton sasVerificationButton;
+ private Image iconEncr;
+ private Image iconEncrVerified;
+ private final JLabel securityStringLabel = new JLabel();
+
+ private final ZrtpControl zrtpControl;
+
+ /**
+ * Creates an instance of <tt>SecurityPanel</tt> by specifying the
+ * corresponding <tt>peer</tt>.
+ *
+ * @param zrtpControl the ZRTP security controller that provides information
+ * for this panel and receives the user input
+ */
+ public ZrtpSecurityPanel(ZrtpControl zrtpControl)
+ {
+ this.zrtpControl = zrtpControl;
+
+ this.setBorder(null);
+ this.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0));
+
+ this.setToolTipText(GuiActivator.getResources().getI18NString(
+ "service.gui.COMPARE_WITH_PARTNER"));
+
+ loadSkin();
+ }
+
+ /**
+ * Adds security related components to this panel.
+ */
+ private void addComponentsToPane()
+ {
+ this.add(sasVerificationButton);
+ this.add(securityStringLabel);
+
+ securityStringLabel
+ .setFont(securityStringLabel.getFont().deriveFont(14f));
+
+ // Action to trigger SAS verification
+ sasVerificationButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ zrtpControl.setSASVerification(!zrtpControl
+ .isSecurityVerified());
+
+ if (zrtpControl.isSecurityVerified())
+ sasVerificationButton.setImage(iconEncr);
+ else
+ sasVerificationButton.setImage(iconEncrVerified);
+ }
+ });
+ }
+
+ /**
+ * Refreshes the state of the SAS and the SAS verified padlock.
+ */
+ public void refreshStates()
+ {
+ String securityString = zrtpControl.getSecurityString();
+ boolean isSecurityVerified = zrtpControl.isSecurityVerified();
+ if (securityString != null)
+ {
+ securityStringLabel.setText(
+ GuiActivator.getResources().getI18NString(
+ "service.gui.COMPARE_WITH_PARTNER_SHORT",
+ new String[] {securityString}
+ )
+ );
+ }
+ else
+ {
+ securityStringLabel.setText(null);
+ }
+
+ sasVerificationButton
+ .setImage(isSecurityVerified ? iconEncrVerified : iconEncr);
+
+ revalidate();
+ repaint();
+ }
+
+ /**
+ * Reloads icons and components.
+ */
+ public void loadSkin()
+ {
+ this.removeAll();
+ iconEncrVerified = ImageLoader.getImage(ImageLoader.ENCR_VERIFIED);
+ iconEncr = ImageLoader.getImage(ImageLoader.ENCR);
+ sasVerificationButton = new SIPCommButton(iconEncr);
+
+ this.addComponentsToPane();
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/conference/BasicConferenceParticipantPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/conference/BasicConferenceParticipantPanel.java
index 9c9936b..8c08fa8 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/conference/BasicConferenceParticipantPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/conference/BasicConferenceParticipantPanel.java
@@ -26,7 +26,7 @@ import net.java.sip.communicator.util.swing.*;
* @author Yana Stamcheva
* @author Adam Netocny
*/
-public class BasicConferenceParticipantPanel
+public abstract class BasicConferenceParticipantPanel
extends TransparentPanel
implements Skinnable
{
@@ -415,54 +415,51 @@ public class BasicConferenceParticipantPanel
}
/**
- * Indicates that the security has gone off.
+ * Indicates that the security is turned on.
+ * <p>
+ * Sets the secured status icon to the status panel and initializes/updates
+ * the corresponding security details.
+ *
+ * @param evt Details about the event that caused this message.
*/
- public void securityOff()
+ public void securityOn(CallPeerSecurityOnEvent evt)
{
- securityImageID = ImageLoader.SECURE_OFF_CONF_CALL;
-
+ securityImageID = ImageLoader.SECURE_ON_CONF_CALL;
securityStatusLabel.setIcon(new ImageIcon(ImageLoader
- .getImage(ImageLoader.SECURE_OFF_CONF_CALL)));
- }
-
- public void setAudioSecurityOn(boolean isAudioSecurityOn)
- {
- securityStatusLabel.setAudioSecurityOn(isAudioSecurityOn);
- }
+ .getImage(securityImageID)));
- /**
- * Updates all related components to fit the new value.
- * @param encryptionCipher the encryption cipher to show
- */
- public void setEncryptionCipher(String encryptionCipher)
- {
- securityStatusLabel.setEncryptionCipher(encryptionCipher);
- }
-
- /**
- * Updates all related components to fit the new value.
- * @param isVideoSecurityOn indicates if the video security is turned on
- * or off.
- */
- public void setVideoSecurityOn(boolean isVideoSecurityOn)
- {
- securityStatusLabel.setVideoSecurityOn(isVideoSecurityOn);
+ securityStatusLabel.setEncryptionCipher(evt.getCipher());
+ switch (evt.getSessionType())
+ {
+ case CallPeerSecurityStatusEvent.AUDIO_SESSION:
+ securityStatusLabel.setAudioSecurityOn(true);
+ break;
+ case CallPeerSecurityStatusEvent.VIDEO_SESSION:
+ securityStatusLabel.setVideoSecurityOn(true);
+ break;
+ }
}
/**
- * Indicates that the security is turned on.
- * <p>
- * Sets the secured status icon to the status panel and initializes/updates
- * the corresponding security details.
- * @param securityString the security string
- * @param isSecurityVerified indicates if the security string has been
- * already verified by the underlying <tt>CallPeer</tt>
+ * Indicates that the security has gone off.
+ *
+ * @param evt Details about the event that caused this message.
*/
- public void securityOn()
+ public void securityOff(CallPeerSecurityOffEvent evt)
{
+ securityImageID = ImageLoader.SECURE_OFF_CONF_CALL;
securityStatusLabel.setIcon(new ImageIcon(ImageLoader
- .getImage(ImageLoader.SECURE_ON_CONF_CALL)));
+ .getImage(securityImageID)));
- securityImageID = ImageLoader.SECURE_ON_CONF_CALL;
+ securityStatusLabel.setEncryptionCipher(null);
+ switch (evt.getSessionType())
+ {
+ case CallPeerSecurityStatusEvent.AUDIO_SESSION:
+ securityStatusLabel.setAudioSecurityOn(false);
+ break;
+ case CallPeerSecurityStatusEvent.VIDEO_SESSION:
+ securityStatusLabel.setVideoSecurityOn(false);
+ break;
+ }
}
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceFocusPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceFocusPanel.java
index 897466e..abcfa45 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceFocusPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceFocusPanel.java
@@ -149,7 +149,7 @@ public class ConferenceFocusPanel
this.add(memberPanel, constraints);
- initSecurity();
+ initSecuritySettings();
}
/**
@@ -292,106 +292,30 @@ public class ConferenceFocusPanel
}
/**
- * Indicates that the security is turned on by specifying the
- * <tt>securityString</tt> and whether it has been already verified.
+ * Indicates that the security is turned on.
*
- * @param securityString the security string
- * @param isSecurityVerified indicates if the security string has been
- * already verified by the underlying <tt>CallPeer</tt>
+ * @param evt Details about the event that caused this message.
*/
- public void securityOn(String securityString, boolean isSecurityVerified)
+ public void securityOn(CallPeerSecurityOnEvent evt)
{
- focusPeerPanel.securityOn(securityString, isSecurityVerified);
-
- Iterator<ConferenceMemberPanel> memberPanelsIter
- = conferenceMembersPanels.values().iterator();
-
- while (memberPanelsIter.hasNext())
+ focusPeerPanel.securityOn(evt);
+ for (ConferenceMemberPanel member : conferenceMembersPanels.values())
{
- ConferenceMemberPanel memberPanel = memberPanelsIter.next();
-
- memberPanel.securityOn();
+ member.securityOn(evt);
}
}
/**
* Indicates that the security is turned off.
+ *
+ * @param evt Details about the event that caused this message.
*/
- public void securityOff()
- {
- focusPeerPanel.securityOff();
-
- Iterator<ConferenceMemberPanel> memberPanelsIter
- = conferenceMembersPanels.values().iterator();
-
- while (memberPanelsIter.hasNext())
- {
- ConferenceMemberPanel memberPanel = memberPanelsIter.next();
-
- memberPanel.securityOff();
- }
- }
-
- /**
- * Sets the audio security on or off.
- *
- * @param isAudioSecurityOn indicates if the audio security is turned on or
- * off.
- */
- public void setAudioSecurityOn(boolean isAudioSecurityOn)
- {
- focusPeerPanel.setAudioSecurityOn(isAudioSecurityOn);
-
- Iterator<ConferenceMemberPanel> memberPanelsIter
- = conferenceMembersPanels.values().iterator();
-
- while (memberPanelsIter.hasNext())
- {
- ConferenceMemberPanel memberPanel = memberPanelsIter.next();
-
- memberPanel.setAudioSecurityOn(isAudioSecurityOn);
- }
- }
-
- /**
- * Sets the video security on or off.
- *
- * @param isVideoSecurityOn indicates if the video security is turned on or
- * off.
- */
- public void setVideoSecurityOn(boolean isVideoSecurityOn)
- {
- focusPeerPanel.setVideoSecurityOn(isVideoSecurityOn);
-
- Iterator<ConferenceMemberPanel> memberPanelsIter
- = conferenceMembersPanels.values().iterator();
-
- while (memberPanelsIter.hasNext())
- {
- ConferenceMemberPanel memberPanel = memberPanelsIter.next();
-
- memberPanel.setVideoSecurityOn(isVideoSecurityOn);
- }
- }
-
- /**
- * Sets the cipher used for the encryption of the current call.
- *
- * @param encryptionCipher the cipher used for the encryption of the
- * current call.
- */
- public void setEncryptionCipher(String encryptionCipher)
+ public void securityOff(CallPeerSecurityOffEvent evt)
{
- focusPeerPanel.setEncryptionCipher(encryptionCipher);
-
- Iterator<ConferenceMemberPanel> memberPanelsIter
- = conferenceMembersPanels.values().iterator();
-
- while (memberPanelsIter.hasNext())
+ focusPeerPanel.securityOff(evt);
+ for (ConferenceMemberPanel member : conferenceMembersPanels.values())
{
- ConferenceMemberPanel memberPanel = memberPanelsIter.next();
-
- memberPanel.setEncryptionCipher(encryptionCipher);
+ member.securityOff(evt);
}
}
@@ -525,6 +449,17 @@ public class ConferenceFocusPanel
if (a.equals(b))
return true;
+ //TODO: this doesn't belong here
+ if(a.startsWith("sip:"))
+ a = a.substring(4);
+ if(a.startsWith("sips:"))
+ a = a.substring(5);
+
+ if(b.startsWith("sip:"))
+ b = b.substring(4);
+ if(b.startsWith("sips:"))
+ b = b.substring(5);
+
int aServiceBegin = a.indexOf('@');
String aUserID;
String aService;
@@ -612,41 +547,17 @@ public class ConferenceFocusPanel
/**
* Initializes security.
*/
- private void initSecurity()
+ private void initSecuritySettings()
{
- OperationSetSecureTelephony secure
- = focusPeer.getProtocolProvider().getOperationSet(
- OperationSetSecureTelephony.class);
+ CallPeerSecurityStatusEvent securityEvent
+ = focusPeer.getCurrentSecuritySettings();
- if (secure != null)
+ if (securityEvent instanceof CallPeerSecurityOnEvent)
{
- CallPeerSecurityStatusEvent securityEvent
- = focusPeer.getCurrentSecuritySettings();
-
- CallPeerSecurityOnEvent securityOnEvent = null;
- if (securityEvent instanceof CallPeerSecurityOnEvent)
- securityOnEvent = (CallPeerSecurityOnEvent) securityEvent;
+ securityOn((CallPeerSecurityOnEvent) securityEvent);
- if (securityOnEvent != null)
- {
- securityOn( securityOnEvent.getSecurityString(),
- securityOnEvent.isSecurityVerified());
-
- setEncryptionCipher(securityOnEvent.getCipher());
-
- switch (securityOnEvent.getSessionType())
- {
- case CallPeerSecurityOnEvent.AUDIO_SESSION:
- setAudioSecurityOn(true);
- break;
- case CallPeerSecurityOnEvent.VIDEO_SESSION:
- setVideoSecurityOn(true);
- break;
- }
-
- NotificationManager.fireNotification(
- NotificationManager.CALL_SECURITY_ON);
- }
+ NotificationManager.fireNotification(
+ NotificationManager.CALL_SECURITY_ON);
}
}
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferencePeerPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferencePeerPanel.java
index 5626e22..d43fd74 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferencePeerPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferencePeerPanel.java
@@ -187,77 +187,59 @@ public class ConferencePeerPanel
*/
private void initSecuritySettings()
{
- OperationSetSecureTelephony secure
- = callPeer.getProtocolProvider().getOperationSet(
- OperationSetSecureTelephony.class);
+ CallPeerSecurityStatusEvent securityEvent
+ = callPeer.getCurrentSecuritySettings();
- if (secure != null)
+ if (securityEvent != null
+ && securityEvent instanceof CallPeerSecurityOnEvent)
{
- CallPeerSecurityStatusEvent securityEvent
- = callPeer.getCurrentSecuritySettings();
+ CallPeerSecurityOnEvent securityOnEvt
+ = (CallPeerSecurityOnEvent) securityEvent;
- if (securityEvent != null
- && securityEvent instanceof CallPeerSecurityOnEvent)
- {
- CallPeerSecurityOnEvent securityOnEvt
- = (CallPeerSecurityOnEvent) securityEvent;
-
- securityOn( securityOnEvt.getSecurityString(),
- securityOnEvt.isSecurityVerified());
-
- setEncryptionCipher(securityOnEvt.getCipher());
-
- switch (securityOnEvt.getSessionType())
- {
- case CallPeerSecurityOnEvent.AUDIO_SESSION:
- setAudioSecurityOn(true);
- break;
- case CallPeerSecurityOnEvent.VIDEO_SESSION:
- setVideoSecurityOn(true);
- break;
- }
- }
+ securityOn(securityOnEvt);
}
}
/**
- * Indicates that the security has gone off.
- */
- public void securityOff()
- {
- super.securityOff();
- }
-
- /**
* Indicates that the security is turned on.
* <p>
* Sets the secured status icon to the status panel and initializes/updates
* the corresponding security details.
- * @param securityString the security string
- * @param isSecurityVerified indicates if the security string has been
- * already verified by the underlying <tt>CallPeer</tt>
+ *
+ * @param evt Details about the event that caused this message.
*/
- public void securityOn( String securityString,
- boolean isSecurityVerified)
+ @Override
+ public void securityOn(CallPeerSecurityOnEvent evt)
{
- super.securityOn();
+ super.securityOn(evt);
- if ((securityPanel == null) && (callPeer != null))
+ if (securityPanel == null)
{
- securityPanel = new SecurityPanel(callPeer);
-
+ securityPanel = SecurityPanel.create(evt.getSecurityController());
securityPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
-
this.addToCenter(securityPanel);
}
-
- if (securityPanel != null)
- securityPanel.refreshStates(securityString, isSecurityVerified);
+ securityPanel.refreshStates();
callPanel.refreshContainer();
}
/**
+ * Indicates that the security has gone off.
+ *
+ * @param evt Details about the event that caused this message.
+ */
+ @Override
+ public void securityOff(CallPeerSecurityOffEvent evt)
+ {
+ super.securityOff(evt);
+ if(securityPanel != null)
+ {
+ securityPanel.getParent().remove(securityPanel);
+ }
+ }
+
+ /**
* Sets the mute status icon to the status panel.
*
* @param isMute indicates if the call with this peer is
diff --git a/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java b/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java
index ae1d8e4..f4d98b6 100644
--- a/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java
+++ b/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java
@@ -133,6 +133,7 @@ public class ZrtpControlImpl
"GNUZRTP4J.zid",
false,
ZrtpConfigureUtils.getZrtpConfiguration());
+ zrtpEngine.setUserCallback(new SecurityEventManager(this));
}
return zrtpEngine;
}
@@ -144,14 +145,13 @@ public class ZrtpControlImpl
*/
public void start(boolean masterSession)
{
- // Create security user callback for each peer.
- SecurityEventManager securityEventManager
- = new SecurityEventManager(this);
boolean zrtpAutoStart = false;
// ZRTP engine initialization
ZRTPTransformEngine engine = getTransformEngine();
+ // Create security user callback for each peer.
+ SecurityEventManager securityEventManager = engine.getUserCallback();
// Decide if this will become the ZRTP Master session:
// - Statement: audio media session will be started before video
@@ -190,7 +190,7 @@ public class ZrtpControlImpl
engine.setConnector(zrtpConnector);
- engine.setUserCallback(securityEventManager);
+ securityEventManager.setSrtpListener(zrtpListener);
engine.sendInfo(
ZrtpCodes.MessageSeverity.Info,
@@ -207,11 +207,18 @@ public class ZrtpControlImpl
* enable auto-start mode (auto-sensing) to the engine.
* @param multiStreamData
*/
- public void setMultistream(byte[] multiStreamData)
+ public void setMultistream(SrtpControl master)
{
+ if(master == null)
+ return;
+
+ if(!(master instanceof ZrtpControlImpl))
+ throw new IllegalArgumentException("master is no ZRTP control");
+
ZRTPTransformEngine engine = getTransformEngine();
- engine.setMultiStrParams(multiStreamData);
+ engine.setMultiStrParams(((ZrtpControlImpl) master)
+ .getTransformEngine().getMultiStrParams());
engine.setEnableZrtp(true);
}
@@ -248,4 +255,14 @@ public class ZrtpControlImpl
{
zrtpConnector = connector;
}
+
+ public String getSecurityString()
+ {
+ return getTransformEngine().getUserCallback().getSecurityString();
+ }
+
+ public boolean isSecurityVerified()
+ {
+ return getTransformEngine().getUserCallback().isSecurityVerified();
+ }
}
diff --git a/src/net/java/sip/communicator/impl/neomedia/transform/sdes/SDesControlImpl.java b/src/net/java/sip/communicator/impl/neomedia/transform/sdes/SDesControlImpl.java
index bd874d5..e3c6fb7 100644
--- a/src/net/java/sip/communicator/impl/neomedia/transform/sdes/SDesControlImpl.java
+++ b/src/net/java/sip/communicator/impl/neomedia/transform/sdes/SDesControlImpl.java
@@ -17,7 +17,8 @@ import net.java.sip.communicator.service.neomedia.event.*;
import net.java.sip.communicator.service.protocol.event.*;
/**
- * Default implementation of {@link SDesControl}.
+ * Default implementation of {@link SDesControl} that supports the crypto suites
+ * of the original RFC4568 and the KDR parameter, but nothing else.
*
* @author Ingo Bauersachs
*/
@@ -76,20 +77,16 @@ public class SDesControlImpl
return engine != null;
}
- public void setSASVerification(boolean verified)
- {
- }
-
public void start(boolean masterSession)
{
srtpListener.securityTurnedOn(
masterSession ?
CallPeerSecurityStatusEvent.AUDIO_SESSION :
CallPeerSecurityStatusEvent.VIDEO_SESSION,
- selectedInAttribute.getCryptoSuite().encode(), null, true, null);
+ selectedInAttribute.getCryptoSuite().encode(), this);
}
- public void setMultistream(byte[] multiStreamData)
+ public void setMultistream(SrtpControl master)
{
}
diff --git a/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/SecurityEventManager.java b/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/SecurityEventManager.java
index 38b19b2..5f3aa21 100644
--- a/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/SecurityEventManager.java
+++ b/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/SecurityEventManager.java
@@ -23,9 +23,8 @@ import net.java.sip.communicator.util.*;
* associated ZRTP multi-stream sessions.
*
* Coordinate this callback class with the associated GUI implementation class
- * net.java.sip.communicator.impl.gui.main.call.ZrtpPanel
*
- * @see net.java.sip.communicator.impl.gui.main.call.SecurityPanel
+ * @see net.java.sip.communicator.impl.gui.main.call.ZrtpSecurityPanel
*
* @author Emanuel Onica
* @author Werner Dittmann
@@ -71,7 +70,7 @@ public class SecurityEventManager extends ZrtpUserCallback
/**
* A callback to the instance that created us.
*/
- private final SrtpListener securityListener;
+ private SrtpListener securityListener;
/**
* Is this a ZRTP DH (Master) session?
@@ -211,13 +210,13 @@ public class SecurityEventManager extends ZrtpUserCallback
if (isDHSession)
{
securityListener.securityTurnedOn(
- sessionType, cipher, sas, isSasVerified,
- zrtpControl.getTransformEngine().getMultiStrParams());
+ sessionType, cipher,
+ zrtpControl);
}
else
{
securityListener.securityTurnedOn(sessionType, cipher,
- null, false, null);
+ null);
}
}
}
@@ -402,4 +401,19 @@ public class SecurityEventManager extends ZrtpUserCallback
return NeomediaActivator.getResources().getI18NString(key, params);
}
+
+ public void setSrtpListener(SrtpListener securityListener)
+ {
+ this.securityListener = securityListener;
+ }
+
+ public String getSecurityString()
+ {
+ return sas;
+ }
+
+ public boolean isSecurityVerified()
+ {
+ return isSasVerified;
+ }
}
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java
index 0078937..21a578e 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java
@@ -1166,20 +1166,6 @@ public class OperationSetBasicTelephonyJabberImpl
}
/**
- * Sets the SAS verifications state of the call session in which a specific
- * peer is involved
- *
- * @param peer the peer who toggled (or for whom is remotely
- * toggled) the SAS verified flag
- * @param verified the new SAS verification status
- */
- public void setSasVerified(CallPeer peer, boolean verified)
- {
- ((MediaAwareCallPeer<?, ?, ?>) peer).getMediaHandler().setSasVerified(
- verified);
- }
-
- /**
* Transfers (in the sense of call transfer) a specific <tt>CallPeer</tt> to
* a specific callee address which already participates in an active
* <tt>Call</tt>.
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
index b8ba363..df4f4b3 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
@@ -1778,18 +1778,6 @@ public class OperationSetBasicTelephonySipImpl
}
/**
- * Sets the SAS verification property value for the given call peer.
- *
- * @param peer the call peer, for which we set the
- * @param isVerified indicates whether the SAS string is verified or not
- * for the given peer.
- */
- public void setSasVerified( CallPeer peer, boolean isVerified )
- {
- ((CallPeerSipImpl) peer).getMediaHandler().setSasVerified(isVerified);
- }
-
- /**
* Transfers (in the sense of call transfer) a specific
* <tt>CallPeer</tt> to a specific callee address.
*
diff --git a/src/net/java/sip/communicator/service/neomedia/SrtpControl.java b/src/net/java/sip/communicator/service/neomedia/SrtpControl.java
index 64503a3..a4f553e 100644
--- a/src/net/java/sip/communicator/service/neomedia/SrtpControl.java
+++ b/src/net/java/sip/communicator/service/neomedia/SrtpControl.java
@@ -23,10 +23,10 @@ public interface SrtpControl
public void cleanup();
/**
- * Sets a <tt>SrtpListener</tt> that will listen for
- * srtp security events.
- *
- * @param srtpListener the <tt>SrtpListener</tt> to set
+ * Sets a <tt>SrtpListener</tt> that will listen for security events.
+ *
+ * @param srtpListener the <tt>SrtpListener</tt> that will receive the
+ * events
*/
public void setSrtpListener(SrtpListener srtpListener);
@@ -47,13 +47,6 @@ public interface SrtpControl
public boolean getSecureCommunicationStatus();
/**
- * Sets the SAS verification
- *
- * @param verified the new SAS verification status
- */
- public void setSASVerification(boolean verified);
-
- /**
* Starts and enables zrtp in the stream holding this control.
* @param masterSession whether this stream is master for the current
* media session.
@@ -67,7 +60,7 @@ public interface SrtpControl
* @param multiStreamData the multistream data comming from master stream
* needed to start rest of the streams in the session.
*/
- public void setMultistream(byte[] multiStreamData);
+ public void setMultistream(SrtpControl master);
/**
* Returns the transform engine currently used by this stream.
diff --git a/src/net/java/sip/communicator/service/neomedia/ZrtpControl.java b/src/net/java/sip/communicator/service/neomedia/ZrtpControl.java
index 187c9ea..355ffcb 100644
--- a/src/net/java/sip/communicator/service/neomedia/ZrtpControl.java
+++ b/src/net/java/sip/communicator/service/neomedia/ZrtpControl.java
@@ -30,4 +30,25 @@ public interface ZrtpControl
* if ZRTP is not available.
*/
public String[] getHelloHashSep();
+
+ /**
+ * Gets the SAS for the current media stream.
+ *
+ * @return the four character ZRTP SAS.
+ */
+ public String getSecurityString();
+
+ /**
+ * Gets the status of the SAS verification.
+ *
+ * @return true when the SAS has been verified.
+ */
+ public boolean isSecurityVerified();
+
+ /**
+ * Sets the SAS verification
+ *
+ * @param verified the new SAS verification status
+ */
+ public void setSASVerification(boolean verified);
}
diff --git a/src/net/java/sip/communicator/service/neomedia/event/SrtpListener.java b/src/net/java/sip/communicator/service/neomedia/event/SrtpListener.java
index a455343..61383c6 100644
--- a/src/net/java/sip/communicator/service/neomedia/event/SrtpListener.java
+++ b/src/net/java/sip/communicator/service/neomedia/event/SrtpListener.java
@@ -6,6 +6,8 @@
*/
package net.java.sip.communicator.service.neomedia.event;
+import net.java.sip.communicator.service.neomedia.SrtpControl;
+
/**
* The <tt>ZrtpListener</tt> is meant to be used by the media stream
* creator, as the name indicates in order to be notified when a security event
@@ -23,17 +25,12 @@ public interface SrtpListener
* event on non master stream the multiStreamData is null.
*
* @param sessionType the type of the call session - audio or video.
- * @param cipher the cipher
- * @param securityString the SAS
- * @param isVerified indicates if the SAS has been verified
- * @param multiStreamData the data for the multistream
- * used by non master streams.
+ * @param cipher the security cipher that encrypts the call
+ * @param sender the control that initiated the event.
*/
public void securityTurnedOn( int sessionType,
String cipher,
- String securityString,
- boolean isVerified,
- byte[] multiStreamData);
+ SrtpControl sender);
/**
* Indicates that the security has been turned off.
diff --git a/src/net/java/sip/communicator/service/protocol/AbstractCallPeer.java b/src/net/java/sip/communicator/service/protocol/AbstractCallPeer.java
index 5cd6885..d39223c 100644
--- a/src/net/java/sip/communicator/service/protocol/AbstractCallPeer.java
+++ b/src/net/java/sip/communicator/service/protocol/AbstractCallPeer.java
@@ -282,17 +282,10 @@ public abstract class AbstractCallPeer<T extends Call,
*
* @param sessionType the type of the session - audio or video
* @param cipher the cipher associated with the event.
- * @param securityString the security string associated with this event.
- * @param isVerified <tt>true</tt> if the session is verified and
- * <tt>false</tt> otherwise.
+ * @param evt the event object with details to pass on to the consumers
*/
- protected void fireCallPeerSecurityOnEvent(int sessionType, String cipher,
- String securityString, boolean isVerified)
+ protected void fireCallPeerSecurityOnEvent(CallPeerSecurityOnEvent evt)
{
- CallPeerSecurityOnEvent evt
- = new CallPeerSecurityOnEvent(
- this, sessionType, cipher, securityString, isVerified);
-
lastSecurityEvent = evt;
if (logger.isDebugEnabled())
@@ -300,17 +293,15 @@ public abstract class AbstractCallPeer<T extends Call,
+ callPeerSecurityListeners.size()
+" listeners. event is: " + evt.toString());
- Iterator<CallPeerSecurityListener> listeners = null;
+ List<CallPeerSecurityListener> listeners = null;
synchronized (callPeerSecurityListeners)
{
listeners = new ArrayList<CallPeerSecurityListener>(
- callPeerSecurityListeners).iterator();
+ callPeerSecurityListeners);
}
- while (listeners.hasNext())
+ for(CallPeerSecurityListener listener : listeners)
{
- CallPeerSecurityListener listener = listeners.next();
-
listener.securityOn(evt);
}
}
diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetSecureTelephony.java b/src/net/java/sip/communicator/service/protocol/OperationSetSecureTelephony.java
index 0b9896a..f407de9 100644
--- a/src/net/java/sip/communicator/service/protocol/OperationSetSecureTelephony.java
+++ b/src/net/java/sip/communicator/service/protocol/OperationSetSecureTelephony.java
@@ -24,14 +24,4 @@ public interface OperationSetSecureTelephony
* @return the call state
*/
public boolean isSecure(CallPeer peer);
-
- /**
- * Sets the SAS verifications state of the call session in which a specific
- * peer is involved
- *
- * @param peer the peer who toggled (or for whom is remotely
- * toggled) the SAS verified flag
- * @param verified the new SAS verification status
- */
- public void setSasVerified(CallPeer peer, boolean verified);
}
diff --git a/src/net/java/sip/communicator/service/protocol/event/CallPeerSecurityOnEvent.java b/src/net/java/sip/communicator/service/protocol/event/CallPeerSecurityOnEvent.java
index c02b24c..8464213 100755..100644
--- a/src/net/java/sip/communicator/service/protocol/event/CallPeerSecurityOnEvent.java
+++ b/src/net/java/sip/communicator/service/protocol/event/CallPeerSecurityOnEvent.java
@@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.service.protocol.event;
+import net.java.sip.communicator.service.neomedia.*;
import net.java.sip.communicator.service.protocol.*;
/**
@@ -23,44 +24,28 @@ public class CallPeerSecurityOnEvent
*/
private static final long serialVersionUID = 0L;
- private final String securityString;
-
- private final boolean isVerified;
-
private final String cipher;
+ private final SrtpControl srtpControl;
+
/**
* The event constructor
- *
+ *
* @param callPeer the call peer associated with this event
- * @param sessionType the type of the session, either AUDIO_SESSION or
- * VIDEO_SESSION
+ * @param sessionType the type of the session, either
+ * {@link CallPeerSecurityStatusEvent#AUDIO_SESSION} or
+ * {@link CallPeerSecurityStatusEvent#VIDEO_SESSION}
* @param cipher the cipher used for the encryption
- * @param securityString the security string (SAS)
- * @param isVerified indicates if the security string has already been
- * verified
+ * @param srtpControl the security controller that caused this event
*/
public CallPeerSecurityOnEvent( CallPeer callPeer,
int sessionType,
String cipher,
- String securityString,
- boolean isVerified)
+ SrtpControl srtpControl)
{
super(callPeer, sessionType);
-
+ this.srtpControl = srtpControl;
this.cipher = cipher;
- this.securityString = securityString;
- this.isVerified = isVerified;
- }
-
- /**
- * Returns the <tt>CallPeer</tt> for which this event occurred.
- *
- * @return the <tt>CallPeer</tt> for which this event occurred.
- */
- public CallPeer getCallPeer()
- {
- return (CallPeer) getSource();
}
/**
@@ -74,24 +59,12 @@ public class CallPeerSecurityOnEvent
}
/**
- * Returns the security string.
- *
- * @return the security string.
- */
- public String getSecurityString()
- {
- return securityString;
- }
-
- /**
- * Returns <code>true</code> if the security string was already verified
- * and <code>false</code> - otherwise.
- *
- * @return <code>true</code> if the security string was already verified
- * and <code>false</code> - otherwise.
+ * Gets the security controller that caused this event.
+ *
+ * @return the security controller that caused this event.
*/
- public boolean isSecurityVerified()
+ public SrtpControl getSecurityController()
{
- return isVerified;
+ return srtpControl;
}
}
diff --git a/src/net/java/sip/communicator/service/protocol/event/CallPeerSecurityStatusEvent.java b/src/net/java/sip/communicator/service/protocol/event/CallPeerSecurityStatusEvent.java
index d36297b..c92b83e 100644
--- a/src/net/java/sip/communicator/service/protocol/event/CallPeerSecurityStatusEvent.java
+++ b/src/net/java/sip/communicator/service/protocol/event/CallPeerSecurityStatusEvent.java
@@ -32,8 +32,8 @@ public abstract class CallPeerSecurityStatusEvent
public static final int VIDEO_SESSION = 2;
/**
- * Session type of the event <code>AUDIO_SESSION</code> or
- * <code>VIDEO_SESSION</code>.
+ * Session type of the event {@link #AUDIO_SESSION} or
+ * {@link #VIDEO_SESSION}.
*/
private final int sessionType;
diff --git a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java
index 7d29b8d..c7499d0 100644
--- a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java
+++ b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java
@@ -97,7 +97,7 @@ public abstract class CallPeerMediaHandler<
* A reference to the object that would be responsible for SRTP control
* and which most often would be the peer itself.
*/
- public final SrtpListener srtpListener;
+ private final SrtpListener srtpListener;
/**
* The RTP stream that this media handler uses to send audio.
@@ -670,20 +670,6 @@ public abstract class CallPeerMediaHandler<
}
/**
- * Sets the SAS verifications state of the call.
- *
- * @param isVerified the new SAS verification status
- */
- public void setSasVerified(boolean isVerified )
- {
- if(audioStream != null)
- audioStream.getSrtpControl().setSASVerification(isVerified);
-
- if(videoStream != null)
- videoStream.getSrtpControl().setSASVerification(isVerified);
- }
-
- /**
* Returns the secure state of the call. If both audio and video is secured.
*
* @return the call secure state
@@ -719,10 +705,10 @@ public abstract class CallPeerMediaHandler<
* @param multiStreamData the data that we are supposed to pass to our
* video stream.
*/
- public void startSrtpMultistream(byte[] multiStreamData)
+ public void startSrtpMultistream(SrtpControl master)
{
if(videoStream != null)
- videoStream.getSrtpControl().setMultistream(multiStreamData);
+ videoStream.getSrtpControl().setMultistream(master);
}
/**
diff --git a/src/net/java/sip/communicator/service/protocol/media/MediaAwareCallPeer.java b/src/net/java/sip/communicator/service/protocol/media/MediaAwareCallPeer.java
index d7ab5cd..12d94b5 100644
--- a/src/net/java/sip/communicator/service/protocol/media/MediaAwareCallPeer.java
+++ b/src/net/java/sip/communicator/service/protocol/media/MediaAwareCallPeer.java
@@ -9,6 +9,7 @@ package net.java.sip.communicator.service.protocol.media;
import java.beans.*;
import java.util.*;
+import net.java.sip.communicator.service.neomedia.SrtpControl;
import net.java.sip.communicator.service.neomedia.event.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
@@ -674,23 +675,15 @@ public abstract class MediaAwareCallPeer
*
* @param sessionType the type of the call session - audio or video.
* @param cipher the cipher
- * @param securityString the SAS
- * @param isVerified indicates if the SAS has been verified
- * @param multiStreamData the data for the multistream
- * used by non master streams.
+ * @param sender the security controller that caused the event
*/
- public void securityTurnedOn(
- int sessionType,
- String cipher, String securityString, boolean isVerified,
- byte[] multiStreamData)
+ public void securityTurnedOn(int sessionType, String cipher,
+ SrtpControl sender)
{
- if(multiStreamData != null)
- {
- getMediaHandler().startSrtpMultistream(multiStreamData);
- }
-
- fireCallPeerSecurityOnEvent(
- sessionType, cipher, securityString, isVerified);
+ getMediaHandler().startSrtpMultistream(sender);
+ CallPeerSecurityOnEvent evt =
+ new CallPeerSecurityOnEvent(this, sessionType, cipher, sender);
+ fireCallPeerSecurityOnEvent(evt);
}
/**