Index: /trunk/aria.h
===================================================================
--- /trunk/aria.h	(revision 12)
+++ /trunk/aria.h	(revision 13)
@@ -16,4 +16,8 @@
 	byte			dk[17][16 /* 128-bits */];
 } CHEV_ARIA_INFO;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* function */
@@ -38,2 +42,5 @@
 						 int			* outSize);
 
+#ifdef __cplusplus
+}
+#endif
Index: /trunk/crypto.cpp
===================================================================
--- /trunk/crypto.cpp	(revision 12)
+++ /trunk/crypto.cpp	(revision 13)
@@ -11,5 +11,5 @@
 void crypto::setKey(cf::bin & key)
 {
-	CHEV_ARIA_Initialize(&info, CHEV_ARIA_256, key.buffer(), key.size());
+	::CHEV_ARIA_Initialize(&info, CHEV_ARIA_256, key.buffer(), key.size());
 }
 
@@ -20,5 +20,5 @@
 	out.resize(SHA256_DIGEST_VALUELEN);
 
-	SHA256_Encrpyt(input.buffer(), input.size(), out.buffer());
+	::SHA256_Encrpyt(input.buffer(), input.size(), out.buffer());
 
 	return out;
@@ -35,5 +35,5 @@
 	out.resize(plain.size());
 
-	CHEV_ARIA_Encrypt(&info, plain.buffer(), plain.size(), out.buffer(), &outSize);
+	::CHEV_ARIA_Encrypt(&info, plain.buffer(), plain.size(), out.buffer(), &outSize);
 
 	return out;
@@ -49,5 +49,5 @@
 	out.resize(input.size());
 
-	CHEV_ARIA_Decrypt(&info, input.buffer(), input.size(), out.buffer(), &outSize);
+	::CHEV_ARIA_Decrypt(&info, input.buffer(), input.size(), out.buffer(), &outSize);
 
 	paddingSize = out[outSize - 1];
Index: /trunk/msgsrv.cpp
===================================================================
--- /trunk/msgsrv.cpp	(revision 12)
+++ /trunk/msgsrv.cpp	(revision 13)
@@ -4,4 +4,5 @@
 #include "cf/codec.h"
 #include "cf/file.h"
+#include "crypto.h"
 
 #include "msg.hpp"
@@ -283,18 +284,4 @@
 }
 
-static bool command(const Protocol::Message & parser)
-{
-	bool isContinued = true;
-	std::string command = parser.get<std::string>("command");
-
-	if (command == "logout")
-		isContinued = false;
-	/*
-	else if (...)
-	*/
-
-	return isContinued;
-}
-
 static std::string getRandomCode()
 {
@@ -333,9 +320,9 @@
 	throw (cf::exception)
 {
-	if (sms != parser.get<std::string>("sms"))
+	if (sms != parser.get<std::string>(ProtocolType::SMS))
 		THROW_EXCEPTION("SMS is not same");
 
-	std::string id = parser.get<std::string>("id");
-	std::string pw = parser.get<std::string>("pw");
+	std::string id = parser.get<std::string>(ProtocolType::ID);
+	std::string pw = parser.get<std::string>(ProtocolType::PW);
 		
 	return dbmgr.join(id, pw, sms, address);
@@ -345,6 +332,6 @@
 	throw (cf::exception)
 {
-	std::string id = parser.get<std::string>("id");
-	std::string pw = parser.get<std::string>("pw");
+	std::string id = parser.get<std::string>(ProtocolType::ID);
+	std::string pw = parser.get<std::string>(ProtocolType::PW);
 
 	return dbmgr.login(id, pw);
@@ -355,5 +342,5 @@
 {
 	bool result = false;
-	std::string to = parser.get<std::string>("to");
+	std::string to = parser.get<std::string>(ProtocolType::TO);
 
 	if (isOnline(to))
@@ -366,9 +353,43 @@
 }
 
+static std::string createSessionID(std::string & idList)
+{
+	cf::bin sessid;
+
+	sessid = crypto().sha256(cf::bin(idList));
+
+	return cf::codec::hex::getInstance()->encode(sessid);
+}
+
+static bool opensession(const Protocol::Message & parser)
+{
+	bool result = false;
+	std::string sessid;
+	std::vector<std::string> idList = parser.getList<std::string>(ProtocolType::ID_LIST);
+	std::string concat = idList[0];
+
+	for (size_t iter = 1; iter < concat.size(); iter++)
+		concat += idList[iter];	
+
+	sessid = createSessionID(concat);
+
+	for (size_t iter = 0; iter < idList.size(); iter++)
+	{
+		if (isOnline(idList[iter]))
+			gOnlineUsers[idList[iter]].sock->send(sessid);
+
+		result = true;
+	}
+
+	return result;
+}
+
 static std::string keyExchange(const std::string sms, const std::string address)
 {
-	std::string sessionKey;
-
-
+	cf::bin sessKey;
+
+	sessKey = crypto().sha256(cf::bin(sms + address));
+
+	return cf::codec::hex::getInstance()->encode(sessKey);
 }
 
@@ -391,11 +412,11 @@
 			{
 				if (join(parser, sms, sock.peer().address()))
-					THROW_EXCEPTION("user(" << parser.get<std::string>("id") << ") cannot join");
+					THROW_EXCEPTION("user(" << parser.get<std::string>(ProtocolType::ID) << ") cannot join");
 			}
 			else if (parser.type() == "login")
 			{
 				if (login(parser))
-					return parser.get<std::string>("id");
-			}
+					parser.get<std::string>(ProtocolType::ID);
+			}			
 		}
 	}
@@ -428,8 +449,10 @@
 			LOG(message);
 
-			if (parser.type() == "command")
-				result = command(parser);
-			else if (parser.type() == "chat")
+			if (parser.type() == "chat")
 				result = chat(parser, message);
+			else if (parser.type() == "opensession")
+				result = opensession(parser);
+//			else if (parser.type() == "getFriendList")
+//				result = 
 
 			sock->send(response.result(parser.type(), result));
@@ -481,9 +504,4 @@
 }
 
-int createSessionID(std::string & idList)
-{
-	return 0;
-}
-
 int main(int argc, char ** argv)
 {
Index: /trunk/msvc14/chevmsgr.sln
===================================================================
--- /trunk/msvc14/chevmsgr.sln	(revision 12)
+++ /trunk/msvc14/chevmsgr.sln	(revision 13)
@@ -6,4 +6,5 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server", "server\server.vcxproj", "{D29F58DC-2F95-41FA-8749-A9D91F5D269C}"
 	ProjectSection(ProjectDependencies) = postProject
+		{A5238B12-5F59-4AF2-BC5C-DD93352082FD} = {A5238B12-5F59-4AF2-BC5C-DD93352082FD}
 		{39F45AE4-072E-44C4-8E2B-94DAC2333A5D} = {39F45AE4-072E-44C4-8E2B-94DAC2333A5D}
 	EndProjectSection
Index: /trunk/msvc14/crypto/crypto.vcxproj
===================================================================
--- /trunk/msvc14/crypto/crypto.vcxproj	(revision 12)
+++ /trunk/msvc14/crypto/crypto.vcxproj	(revision 13)
@@ -139,4 +139,5 @@
     <ClCompile Include="..\..\bit.c" />
     <ClCompile Include="..\..\crypto.cpp" />
+    <ClCompile Include="..\..\KISA_SHA256.c" />
   </ItemGroup>
   <ItemGroup>
@@ -144,4 +145,5 @@
     <ClInclude Include="..\..\bit.h" />
     <ClInclude Include="..\..\crypto.h" />
+    <ClInclude Include="..\..\KISA_SHA256.h" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Index: /trunk/msvc14/crypto/crypto.vcxproj.filters
===================================================================
--- /trunk/msvc14/crypto/crypto.vcxproj.filters	(revision 12)
+++ /trunk/msvc14/crypto/crypto.vcxproj.filters	(revision 13)
@@ -25,4 +25,7 @@
       <Filter>소스 파일</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\KISA_SHA256.c">
+      <Filter>소스 파일</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
@@ -36,4 +39,7 @@
       <Filter>소스 파일</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\KISA_SHA256.h">
+      <Filter>소스 파일</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>
Index: /trunk/msvc14/server/server.vcxproj
===================================================================
--- /trunk/msvc14/server/server.vcxproj	(revision 12)
+++ /trunk/msvc14/server/server.vcxproj	(revision 13)
@@ -97,5 +97,5 @@
       <SubSystem>Console</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>$(OutDir)\cf++.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(OutDir)\cf++.lib;$(OutDir)\crypto.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
@@ -111,5 +111,5 @@
       <SubSystem>Console</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>$(OutDir)\cf++.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(OutDir)\cf++.lib;$(OutDir)\crypto.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
@@ -129,5 +129,5 @@
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>$(OutDir)\cf++.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(OutDir)\cf++.lib;$(OutDir)\crypto.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
@@ -147,5 +147,5 @@
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>$(OutDir)\cf++.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(OutDir)\cf++.lib;$(OutDir)\crypto.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
