Unicode and multi-char program cannmot communicate

Posted on 2006-05-16
Medium Priority
Last Modified: 2008-03-06
My colleagues developed client and sever with windows cryptography(each with public and private key respectively).
Their proj setting is using unicode char set in VC++.

My proj settings is using multi-byte char set.
Now the client and server success communicate, but my tool (use the same code as in client) fail to have msg exchange,
e.g. wrong msg checksum and server fail to decrypt the username and password.
My tool success to encryt and decrypt the information itself. Checked server received what my tool generated.
The problem is complicated by the fact that there are session key which is randomly generated.
I tried every means and my colleagues fail to locate the problem.
Any suggestion?
Question by:chumotan
1 Comment

Accepted Solution

akumanova earned 2000 total points
ID: 16688905
One of the problem may be that you incorrectly store your messages, here is my guess:

At Server (unicode), you send the string like
String x = "hello";
String y = Encrypt(x);

At Client (multi-byte), you receive your string
String y;
YourSocket.Receive(y)  // Assume you store your data back to y
String x = Decrypt(y);
print y;

One of the problem may be that you try to encrypt an message not byte by byte, which is that you may need to store all your characters in SINGLE BYTE, then make encrypt and decrypt, here is an example

At server:

String x = "Hello";
Byte [] b = ConvertToByte(x);
Byte [] b2 = Encrypt(b);

At client:
Byte [] b2;
Byte [] b1 = Decrypt(b2);
String x = ConvertToString(b1);
print x

This is just a rough guess, since you do not provide any error details or source codes.


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question