Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 05:37

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[What] is this part of DH Key Exchange

Discussion on [What] is this part of DH Key Exchange within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
badguy4you's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 477
Received Thanks: 178
[What] is this part of DH Key Exchange

What is this part in albetros source

Code:
                byte[] pad = new byte[PAD_LEN];
                Kernel.RND.NextBytes(pad);
                byte[] junk = new byte[_junk_len];
                Kernel.RND.NextBytes(junk);

Please Explain me what is this used for and how i got this declared in my project
badguy4you is offline  
Thanks
2 Users
Old 06/20/2012, 04:23   #2
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,142
RND obviously is an instance of Random so just do
Code:
Random RND = new Random();
Also, I don't know if that has anything to do with the D-H Ex., but I really doubt it.
Zeroxelli is offline  
Thanks
2 Users
Old 06/20/2012, 05:32   #3
 
elite*gold: 0
Join Date: Aug 2008
Posts: 94
Received Thanks: 19
i Dont know but .... i think so .... after that p length ? and p .. then g length and g ... so on? !!
romeoromeo is offline  
Thanks
1 User
Old 06/20/2012, 05:47   #4
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,142
Quote:
Originally Posted by romeoromeo View Post
i Dont know but .... i think so .... after that p length ? and p .. then g length and g ... so on? !!
Seems like a rather strange thing to include in an implementation of the Diffie-Hellman exchange, though..
Zeroxelli is offline  
Thanks
3 Users
Old 06/20/2012, 06:49   #5
 
elite*gold: 0
Join Date: Aug 2008
Posts: 94
Received Thanks: 19
Quote:
Originally Posted by Zeroxelli View Post
Seems like a rather strange thing to include in an implementation of the Diffie-Hellman exchange, though..
here is why i think its related . .. to be honest i do not understand it .
Code:
  public byte[] CreateServerKeyPacket()
            {
                _clientIv = new byte[8];
                _serverIv = new byte[8];
                string P = "E7A69EBDF105F2A6BBDEAD7E798F76A209AD73FB466431E2E7352ED262F8C558F10BEFEA977DE9E21DCEE9B04D245F300ECCBBA03E72630556D011023F9E857F";
               // string P = "A320A85EDD79171C341459E94807D71D39BB3B3F3B5161CA84894F3AC3FC7FEC317A2DDEC83B66D30C29261C6492643061AECFCF4A051816D7C359A6A7B7D8FB";
                string G = "05";
                _keyExchange = new OpenSSL.DH(OpenSSL.BigNumber.FromHexString(P), OpenSSL.BigNumber.FromHexString(G));
                _keyExchange.GenerateKeys();
                return GeneratePacket(_serverIv, _clientIv, P, G, _keyExchange.PublicKey.ToHexString());
            }

            public byte[] GeneratePacket(byte[] ServerIV1, byte[] ServerIV2, string P, string G, string ServerPublicKey)
            {
                int PAD_LEN = 11;
                int _junk_len = 12;
                string tqs = "TQServer";
                MemoryStream ms = new MemoryStream();
                byte[] pad = new byte[PAD_LEN];
                ServerBase.Kernel.Random.NextBytes(pad);
                byte[] junk = new byte[_junk_len];
                ServerBase.Kernel.Random.NextBytes(junk);
                int size = 47 + P.Length + G.Length + ServerPublicKey.Length + 12 + 8 + 8;
                BinaryWriter bw = new BinaryWriter(ms);
                bw.Write(pad);  
                bw.Write(size - PAD_LEN);
                bw.Write((UInt32)_junk_len);
                bw.Write(junk);
                bw.Write((UInt32)ServerIV2.Length);
                bw.Write(ServerIV2);
                bw.Write((UInt32)ServerIV1.Length);
                bw.Write(ServerIV1);
                bw.Write((UInt32)P.ToCharArray().Length);
                foreach (char fP in P.ToCharArray())
                {
                    bw.BaseStream.WriteByte((byte)fP);
                }
                bw.Write((UInt32)G.ToCharArray().Length);
                foreach (char fG in G.ToCharArray())
                {
                    bw.BaseStream.WriteByte((byte)fG);
                }
                bw.Write((UInt32)ServerPublicKey.ToCharArray().Length);
                foreach (char SPK in ServerPublicKey.ToCharArray())
                {
                    bw.BaseStream.WriteByte((byte)SPK);
                }
                foreach (char tq in tqs.ToCharArray())
                {
                    bw.BaseStream.WriteByte((byte)tq);
                }
                byte[] Packet = new byte[ms.Length];
                Packet = ms.ToArray();
                ms.Close();
                Console.WriteLine(Packet.ToString());
                return Packet;
            }
romeoromeo is offline  
Thanks
3 Users
Old 06/20/2012, 06:54   #6
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,142
Quote:
Originally Posted by romeoromeo View Post
here is why i think its related . .. to be honest i do not understand it .
Code:
  public byte[] CreateServerKeyPacket()
            {
                _clientIv = new byte[8];
                _serverIv = new byte[8];
                string P = "E7A69EBDF105F2A6BBDEAD7E798F76A209AD73FB466431E2E7352ED262F8C558F10BEFEA977DE9E21DCEE9B04D245F300ECCBBA03E72630556D011023F9E857F";
               // string P = "A320A85EDD79171C341459E94807D71D39BB3B3F3B5161CA84894F3AC3FC7FEC317A2DDEC83B66D30C29261C6492643061AECFCF4A051816D7C359A6A7B7D8FB";
                string G = "05";
                _keyExchange = new OpenSSL.DH(OpenSSL.BigNumber.FromHexString(P), OpenSSL.BigNumber.FromHexString(G));
                _keyExchange.GenerateKeys();
                return GeneratePacket(_serverIv, _clientIv, P, G, _keyExchange.PublicKey.ToHexString());
            }

            public byte[] GeneratePacket(byte[] ServerIV1, byte[] ServerIV2, string P, string G, string ServerPublicKey)
            {
                int PAD_LEN = 11;
                int _junk_len = 12;
                string tqs = "TQServer";
                MemoryStream ms = new MemoryStream();
                byte[] pad = new byte[PAD_LEN];
                ServerBase.Kernel.Random.NextBytes(pad);
                byte[] junk = new byte[_junk_len];
                ServerBase.Kernel.Random.NextBytes(junk);
                int size = 47 + P.Length + G.Length + ServerPublicKey.Length + 12 + 8 + 8;
                BinaryWriter bw = new BinaryWriter(ms);
                bw.Write(pad);  
                bw.Write(size - PAD_LEN);
                bw.Write((UInt32)_junk_len);
                bw.Write(junk);
                bw.Write((UInt32)ServerIV2.Length);
                bw.Write(ServerIV2);
                bw.Write((UInt32)ServerIV1.Length);
                bw.Write(ServerIV1);
                bw.Write((UInt32)P.ToCharArray().Length);
                foreach (char fP in P.ToCharArray())
                {
                    bw.BaseStream.WriteByte((byte)fP);
                }
                bw.Write((UInt32)G.ToCharArray().Length);
                foreach (char fG in G.ToCharArray())
                {
                    bw.BaseStream.WriteByte((byte)fG);
                }
                bw.Write((UInt32)ServerPublicKey.ToCharArray().Length);
                foreach (char SPK in ServerPublicKey.ToCharArray())
                {
                    bw.BaseStream.WriteByte((byte)SPK);
                }
                foreach (char tq in tqs.ToCharArray())
                {
                    bw.BaseStream.WriteByte((byte)tq);
                }
                byte[] Packet = new byte[ms.Length];
                Packet = ms.ToArray();
                ms.Close();
                Console.WriteLine(Packet.ToString());
                return Packet;
            }
From the looks of it, that doesn't have anything to do with it. It's just random garbage to confuse the bots.
Zeroxelli is offline  
Thanks
3 Users
Old 06/20/2012, 07:21   #7
 
elite*gold: 0
Join Date: Aug 2008
Posts: 94
Received Thanks: 19
Quote:
Originally Posted by Zeroxelli View Post
From the looks of it, that doesn't have anything to do with it. It's just random garbage to confuse the bots.
i thought that was the packet which sends p, g ,PublicKey to client . :-s .
but coz i still have lot of questions need to be answered about key exchange and encryption i still do not understand it . so . can you please explain it ?
romeoromeo is offline  
Thanks
1 User
Old 06/20/2012, 07:23   #8
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,142
Quote:
Originally Posted by romeoromeo View Post
i thought that was the packet which sends p, g ,PublicKey to client . :-s .
but coz i still have lot of questions need to be answered about key exchange and encryption i still do not understand it . so . can you please explain it ?
It is, but that portion is just garbage..

Diffie-Hellman_key_exchange
Zeroxelli is offline  
Thanks
2 Users
Old 06/20/2012, 07:30   #9
 
elite*gold: 0
Join Date: Aug 2008
Posts: 94
Received Thanks: 19
i know it , and read this b4 ... but ... my questions ....... like here >>
romeoromeo is offline  
Thanks
1 User
Old 06/20/2012, 15:01   #10
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,142
Quote:
Originally Posted by romeoromeo View Post
is that means that the G and P are only known by the server ? and server will send it to clients ? or client already has the P and G ? !!!
and !! if it only known by server ? so the only way to know them is to trick the server to connect to me via proxy ... and send em to me first ? !!

P and G are decided based on data sent to/from the server, and vice-versa. Based on the "secret" of the client and server being merged, you get your P and G. In most cases, the "secret" is your key.
Zeroxelli is offline  
Thanks
2 Users
Old 06/20/2012, 15:18   #11
 
badguy4you's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 477
Received Thanks: 178
so i will do it as you said Zero i thought it will be crucial if i changed it
badguy4you is offline  
Thanks
3 Users
Old 06/20/2012, 15:28   #12
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,142
Quote:
Originally Posted by badguy4you View Post
so i will do it as you said Zero i thought it will be crucial if i changed it
You can always check if it makes a difference by writing 23 blank bytes instead of the pad and junk. More likely than not, it won't, though.
Zeroxelli is offline  
Thanks
2 Users
Old 06/20/2012, 15:41   #13
 
badguy4you's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 477
Received Thanks: 178
ok although i got a bit stuck but i am tring till i get it work
badguy4you is offline  
Thanks
2 Users
Old 06/20/2012, 15:45   #14
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,142
Quote:
Originally Posted by badguy4you View Post
ok although i got a bit stuck but i am tring till i get it work
Alright, good luck.
Zeroxelli is offline  
Thanks
2 Users
Old 06/20/2012, 15:51   #15
 
elite*gold: 0
Join Date: Aug 2008
Posts: 94
Received Thanks: 19
Quote:
Originally Posted by Zeroxelli View Post
P and G are decided based on data sent to/from the server, and vice-versa. Based on the "secret" of the client and server being merged, you get your P and G. In most cases, the "secret" is your key.



let me try to ask it in yes/no questions .
1- are P&G known by server only ?
2- does server send P and G and pubkey ?
3- is client have P & G saved somewhere if server did not send any ?
4- is P and G are send on connection request ? (or p &g request ?? )
5- can i tell server to use diff P and g ?
6- dkhey is used to set encryption ? !! is there any encryption b4 it
romeoromeo is offline  
Thanks
2 Users
Reply


Similar Threads Similar Threads
exchange gold to silk and exchange gold ^^
07/27/2011 - Silkroad Online Trading - 37 Replies
Liking the title, we can help you exchange gold to silk (epin-card).what's more?we can also help you exchange gold from one server to another server . contact ways: Email/MSN: [email protected] Yahoo! Messenger: [email protected] AOL AIM: [email protected] Skype:
LoL exchange
05/27/2011 - League of Legends - 6 Replies
WTT LoL acc lvl 30 all champions full runes 2 warwick skin for a hon account [email protected]
exchange
11/17/2009 - Silkroad Online Trading - 0 Replies
y want exchange bow lvl 80 sjsro for xbow or wizard lvl 78-80 isro .. PM id mesenger ionutzulb



All times are GMT +2. The time now is 05:37.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.