View Single Post
Old 20.01.2006, 07:26   #18
navy
Архивный участник
 
Join Date: Nov 2005
Posts: 41
Default

I've found one error in your first AuthD and in my code, that Iappend to it. Here is yours In server.c you ctreate
Code:
				new ClientThread(stream, rsaPrivateParams, rsaPublicParams, scrambledModulus);
but constructor for ClientThread looks like
Code:
		public ClientThread(NetworkStream conn, RSAParameters rsaPublic, RSAParameters rsaPrivate, byte[] scrambled)
Private->Public

and here is RequestAuthLogin
Code:
		public RequestAuthLogin(byte[] rawPacket, RSAParameters rsaPrivateParams)
		{
			try
			{

				Console.WriteLine("[RequestLoginAuth] :: Incoming Packet Length: {0}", rawPacket.Length);
				Console.WriteLine(PrintData(rawPacket, rawPacket.Length));

				Console.WriteLine("\n");

				byte[] decrypted = new byte[0x80];
				Array.Copy(rawPacket, 1, decrypted, 0, decrypted.Length);

				Console.WriteLine("\n");

				RSAManaged rsaDecryptor = new RSAManaged();
				rsaDecryptor.ImportParameters(rsaPrivateParams);

				byte[] result = rsaDecryptor.DecryptValue(decrypted);

				Console.WriteLine("[RequestLoginAuth] :: Decrypted Packet Length: {0}", result.Length);
				Console.WriteLine(PrintData(result, result.Length));

				Console.WriteLine("\n");

				char [] dec = new char [result.Length];
				result.CopyTo(dec,0);

				username = new System.String(dec, 0x02, 14).Trim();
				username = username.ToLower();
				password = new string(dec, 0x11, 16).Trim();

				Console.WriteLine("[RequestLoginAuth] :: username: " + username + " password: " + password + "\n");
			}
			catch(Exception ex)
			{

				Console.WriteLine("[RequestAuthLogin] :: Error Decrypting Login");
				Console.WriteLine("[RequestAuthLogin] :: Error Message:\n");
				Console.WriteLine(ex.Message);

			}
		}
navy is offline