Commit 84aa4021 authored by Dan Pascu's avatar Dan Pascu

Added ZRTP support

parent 9d655b9b
This diff is collapsed.
......@@ -7,7 +7,7 @@ __all__ = ['AccountExtension', 'BonjourAccountExtension']
from sipsimple.account import BonjourMSRPSettings, MessageSummarySettings, MSRPSettings, PresenceSettings, RTPSettings, SIPSettings, TLSSettings, XCAPSettings
from sipsimple.configuration import Setting, SettingsGroup, SettingsObjectExtension, RuntimeSetting
from sipsimple.configuration.datatypes import AudioCodecList, Hostname, MSRPConnectionModel, MSRPTransport, NonNegativeInteger, SIPTransportList, SRTPEncryption, VideoCodecList
from sipsimple.configuration.datatypes import AudioCodecList, Hostname, MSRPConnectionModel, MSRPTransport, NonNegativeInteger, SIPTransportList, VideoCodecList
from sipsimple.util import user_info
from blink.configuration.datatypes import ApplicationDataPath, HTTPURL, IconDescriptor, SoundFile
......@@ -44,8 +44,6 @@ class RTPSettingsExtension(RTPSettings):
audio_codec_order = Setting(type=AudioCodecList, default=None, nillable=True)
video_codec_order = Setting(type=VideoCodecList, default=None, nillable=True)
inband_dtmf = Setting(type=bool, default=True)
srtp_encryption = Setting(type=SRTPEncryption, default='optional')
use_srtp_without_tls = Setting(type=bool, default=True)
class SIPSettingsExtension(SIPSettings):
......
......@@ -223,7 +223,8 @@ class PreferencesWindow(base_class, ui_class):
self.account_video_codecs_list.model().rowsMoved.connect(self._SH_AccountVideoCodecsListModelRowsMoved)
self.reset_account_video_codecs_button.clicked.connect(self._SH_ResetVideoCodecsButtonClicked)
self.inband_dtmf_button.clicked.connect(self._SH_InbandDTMFButtonClicked)
self.srtp_encryption_button.activated[str].connect(self._SH_SRTPEncryptionButtonActivated)
self.rtp_encryption_button.clicked.connect(self._SH_RTPEncryptionButtonClicked)
self.key_negotiation_button.activated[int].connect(self._SH_KeyNegotiationButtonActivated)
# Account server settings
self.always_use_my_proxy_button.clicked.connect(self._SH_AlwaysUseMyProxyButtonClicked)
......@@ -339,6 +340,13 @@ class PreferencesWindow(base_class, ui_class):
def setupUi(self):
super(PreferencesWindow, self).setupUi(self)
# Accounts
self.key_negotiation_button.clear()
self.key_negotiation_button.addItem(u'Opportunistic', 'opportunistic')
self.key_negotiation_button.addItem(u'ZRTP', 'zrtp')
self.key_negotiation_button.addItem(u'SDES optional', 'sdes_optional')
self.key_negotiation_button.addItem(u'SDES mandatory', 'sdes_mandatory')
# Audio
# Hide the tail_length slider as it is only useful for debugging -Dan
......@@ -784,7 +792,9 @@ class PreferencesWindow(base_class, ui_class):
self.reset_account_video_codecs_button.setEnabled(account.rtp.video_codec_order is not None)
self.inband_dtmf_button.setChecked(account.rtp.inband_dtmf)
self.srtp_encryption_button.setCurrentIndex(self.srtp_encryption_button.findText(account.rtp.srtp_encryption))
self.rtp_encryption_button.setChecked(account.rtp.encryption.enabled)
self.key_negotiation_button.setEnabled(account.rtp.encryption.enabled)
self.key_negotiation_button.setCurrentIndex(self.key_negotiation_button.findData(account.rtp.encryption.key_negotiation))
if account is not bonjour_account:
# Server settings tab
......@@ -1118,9 +1128,15 @@ class PreferencesWindow(base_class, ui_class):
account.rtp.inband_dtmf = checked
account.save()
def _SH_SRTPEncryptionButtonActivated(self, text):
def _SH_RTPEncryptionButtonClicked(self, checked):
self.key_negotiation_button.setEnabled(checked)
account = self.selected_account
account.rtp.encryption.enabled = checked
account.save()
def _SH_KeyNegotiationButtonActivated(self, index):
account = self.selected_account
account.rtp.srtp_encryption = text
account.rtp.encryption.key_negotiation = self.key_negotiation_button.itemData(index)
account.save()
# Account server settings
......
This diff is collapsed.
# Copyright (C) 2015 AG Projects. See LICENSE for details.
#
__all__ = ['ZRTPWidget']
from PyQt4 import uic
from PyQt4.QtCore import pyqtSignal
from blink.resources import Resources
ui_class, base_class = uic.loadUiType('resources/zrtp_widget.ui')
class ZRTPWidget(base_class, ui_class):
closed = pyqtSignal()
nameChanged = pyqtSignal()
statusChanged = pyqtSignal()
def __init__(self, parent=None):
super(ZRTPWidget, self).__init__(parent)
with Resources.directory:
self.setupUi(self)
self.peer_name = ''
self.peer_verified = False
self.close_button.clicked.connect(self.hide)
self.peer_name_value.editingFinished.connect(self._check_name_changes)
self.validate_button.clicked.connect(self._SH_ValidateButtonClicked)
def _get_peer_name(self):
return self.peer_name_value.text()
def _set_peer_name(self, name):
self.__dict__['peer_name'] = name
self.peer_name_value.setText(name)
peer_name = property(_get_peer_name, _set_peer_name)
del _get_peer_name, _set_peer_name
def _get_peer_verified(self):
return self.__dict__['peer_verified']
def _set_peer_verified(self, verified):
self.__dict__['peer_verified'] = verified
if verified:
self.validate_button.setText(u'Invalidate')
self.status_value.setText(u'<span style=\"color: #55ff00;\">Verified</span>')
else:
self.validate_button.setText(u'Validate')
self.status_value.setText(u'<span style=\"color: #ff5500;\">Not verified</span>')
self.validate_button.setChecked(verified)
peer_verified = property(_get_peer_verified, _set_peer_verified)
del _get_peer_verified, _set_peer_verified
def _get_sas(self):
return self.sas_value.text()
def _set_sas(self, sas):
self.sas_value.setText(sas)
sas = property(_get_sas, _set_sas)
del _get_sas, _set_sas
def hideEvent(self, event):
if not event.spontaneous():
self.closed.emit()
self._check_name_changes()
def _check_name_changes(self):
peer_name = self.peer_name_value.text()
if peer_name != self.__dict__['peer_name']:
self.__dict__['peer_name'] = peer_name
self.nameChanged.emit()
def _SH_ValidateButtonClicked(self, checked):
self.hide()
self.peer_verified = checked
self.statusChanged.emit()
del ui_class, base_class
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>275</width>
<width>296</width>
<height>62</height>
</rect>
</property>
......@@ -99,13 +99,10 @@
</size>
</property>
<property name="toolTip">
<string>Signaling is encrypted using TLS</string>
<string>Session is encrypted using TLS</string>
</property>
<property name="pixmap">
<pixmap>icons/blue-lock.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
<pixmap>icons/lock-blue-12.svg</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
......@@ -366,13 +363,10 @@
</size>
</property>
<property name="toolTip">
<string>Media is encrypted using sRTP</string>
<string>Media is encrypted using SRTP</string>
</property>
<property name="pixmap">
<pixmap>icons/orange-lock.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
<pixmap>icons/lock-orange-12.svg</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
......@@ -615,6 +609,11 @@ QToolButton:pressed {
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DurationLabel</class>
<extends>QLabel</extends>
<header>blink.widgets.labels</header>
</customwidget>
<customwidget>
<class>SegmentButton</class>
<extends>QToolButton</extends>
......@@ -635,11 +634,6 @@ QToolButton:pressed {
<extends>QLabel</extends>
<header>blink.widgets.labels</header>
</customwidget>
<customwidget>
<class>DurationLabel</class>
<extends>QLabel</extends>
<header>blink.widgets.labels</header>
</customwidget>
<customwidget>
<class>StatusLabel</class>
<extends>QLabel</extends>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="cross-white.svg"
inkscape:version="0.48.5 r10040"
xml:space="preserve"
width="96px"
viewBox="0 0 96 96"
version="1.1"
id="bigger"
height="96px"
enable-background="new 0 0 96 96"><metadata
id="metadata11"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
id="defs9"><linearGradient
id="linearGradient4461"><stop
id="stop4463"
offset="0"
style="stop-color:#ff0000;stop-opacity:0.50196081;" /><stop
id="stop4465"
offset="1"
style="stop-color:#d00000;stop-opacity:0.50196081;" /></linearGradient><linearGradient
id="linearGradient3983"><stop
style="stop-color:#00ff00;stop-opacity:1;"
offset="0"
id="stop3985" /><stop
style="stop-color:#00d000;stop-opacity:1;"
offset="1"
id="stop3987" /></linearGradient><linearGradient
id="linearGradient12315"><stop
style="stop-color:#ff0000;stop-opacity:1;"
offset="0"
id="stop12317" /><stop
style="stop-color:#d30000;stop-opacity:1;"
offset="1"
id="stop12319" /></linearGradient><linearGradient
id="linearGradient11765"><stop
style="stop-color:#ff0000;stop-opacity:1;"
offset="0"
id="stop11767" /><stop
style="stop-color:#d00000;stop-opacity:1;"
offset="1"
id="stop11769" /></linearGradient><linearGradient
id="linearGradient11102"><stop
style="stop-color:#000000;stop-opacity:0.43137255;"
offset="0"
id="stop11104" /><stop
style="stop-color:#464646;stop-opacity:1;"
offset="1"
id="stop11106" /></linearGradient><radialGradient
inkscape:collect="always"
xlink:href="#linearGradient11765"
id="radialGradient11771"
cx="12"
cy="18"
fx="12"
fy="18"
r="29.642775"
gradientUnits="userSpaceOnUse" /><radialGradient
inkscape:collect="always"
xlink:href="#linearGradient12315"
id="radialGradient12321"
cx="48"
cy="48"
fx="48"
fy="48"
r="44"
gradientUnits="userSpaceOnUse" /><radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3983"
id="radialGradient3989"
cx="12"
cy="18"
fx="12"
fy="18"
r="29.642775"
gradientUnits="userSpaceOnUse" /><linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4461"
id="linearGradient4122"
x1="-17.642775"
y1="18"
x2="41.642776"
y2="18"
gradientUnits="userSpaceOnUse" /></defs><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1623"
inkscape:window-height="1075"
id="namedview7"
showgrid="true"
inkscape:zoom="9.0104167"
inkscape:cx="48"
inkscape:cy="48"
inkscape:window-x="114"
inkscape:window-y="10"
inkscape:window-maximized="0"
inkscape:current-layer="g7242"
showguides="true"
inkscape:guide-bbox="true"><inkscape:grid
type="xygrid"
id="grid2988"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" /></sodipodi:namedview><g
inkscape:label="Close white cross"
id="g7242"
inkscape:groupmode="layer"
style="display:inline"><path
inkscape:connector-curvature="0"
id="path7244"
d="M 63.556404,32.443596 32.443596,63.556404"
style="fill:none;stroke:#f0f0f0;stroke-width:7.99999952;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><path
inkscape:connector-curvature="0"
id="path7246"
d="M 63.556404,63.556404 32.443596,32.443596"
style="fill:none;stroke:#f0f0f0;stroke-width:7.99999952;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></svg>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment