From 5cf2efbed424989bbebc0a01041ecc59fbf5f509 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandresavard@alexandresavard-desktop.(none)>
Date: Wed, 13 Jan 2010 15:10:28 -0500
Subject: [PATCH] [#1722] Fix mkiLifetime mkiKeyLength separator

---
 sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp | 2 +-
 sflphone-common/src/sip/SdesNegotiator.cpp              | 2 +-
 sflphone-common/test/sdesnegotiatorTest.cpp             | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp b/sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
index e60546ee23..b4a7213aac 100644
--- a/sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
+++ b/sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
@@ -73,7 +73,7 @@ std::string AudioSrtpSession::getLocalCryptoInfo() {
     std::string srtp_keys = "inline:";
     // srtp_keys.append("16/14/");
     srtp_keys += getBase64ConcatenatedKeys();
-    srtp_keys.append("/2^20/1:32");
+    srtp_keys.append("|2^20|1:32");
 
     std::string crypto = tag.append(" ");
     crypto += crypto_suite.append(" ");
diff --git a/sflphone-common/src/sip/SdesNegotiator.cpp b/sflphone-common/src/sip/SdesNegotiator.cpp
index e8618e3ab8..6720df78d9 100644
--- a/sflphone-common/src/sip/SdesNegotiator.cpp
+++ b/sflphone-common/src/sip/SdesNegotiator.cpp
@@ -74,7 +74,7 @@ void SdesNegotiator::parse (void)
 
         keyParamsPattern = new Pattern (
             "(?P<srtpKeyMethod>inline|[A-Za-z0-9_]+)\\:" \
-            "(?P<srtpKeyInfo>[A-Za-z0-9\x2B\x2F\x3D]+)\\|" \
+            "(?P<srtpKeyInfo>[A-Za-z0-9\x2B\x2F\x3D]+|[\w\x2B\x2F\x3D]+)\\|" \
             "2\\^(?P<lifetime>[0-9]+)\\|" \
             "(?P<mkiValue>[0-9]+)\\:" \
             "(?P<mkiLength>[0-9]{1,3})\\;?", "g");
diff --git a/sflphone-common/test/sdesnegotiatorTest.cpp b/sflphone-common/test/sdesnegotiatorTest.cpp
index ec20866452..71b429a5ea 100644
--- a/sflphone-common/test/sdesnegotiatorTest.cpp
+++ b/sflphone-common/test/sdesnegotiatorTest.cpp
@@ -41,9 +41,9 @@ using std::endl;
 void SdesNegotiatorTest::setUp()
 {
 
-    // std::string attr("1 AES_CM_128_HMAC_SHA1_32 srtp inline:16/14/AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwd/2^20/1:32");
+  std::string attr("a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwd|2^20|1:32");
 
-    std::string attr("a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32");
+  // std::string attr("a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32");
 
     remoteOffer = new std::vector<std::string>();
     remoteOffer->push_back(attr);
@@ -149,7 +149,7 @@ void SdesNegotiatorTest::testNegotiation()
     CPPUNIT_ASSERT(sdesnego->negotiate());
     CPPUNIT_ASSERT(sdesnego->getCryptoSuite().compare("AES_CM_128_HMAC_SHA1_80") == 0);
     CPPUNIT_ASSERT(sdesnego->getKeyMethod().compare("inline") == 0);
-    CPPUNIT_ASSERT(sdesnego->getKeyInfo().compare("d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj") == 0);
+    CPPUNIT_ASSERT(sdesnego->getKeyInfo().compare("AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwd") == 0);
     CPPUNIT_ASSERT(sdesnego->getLifeTime().compare("20") == 0);
     CPPUNIT_ASSERT(sdesnego->getMkiValue().compare("1") == 0);
     CPPUNIT_ASSERT(sdesnego->getMkiLength().compare("32") == 0);
-- 
GitLab