Unicode and multi-char program cannmot communicate

Posted on 2006-05-16
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
    LVL 2

    Accepted Solution

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Suggested Solutions

    Title # Comments Views Activity
    Windows 10 SmartScreen vs ClickOnce app 5 89
    Batch file output 20 71
    matchUp  challenge 9 50
    java continue statement 10 51
    I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
    This is an explanation of a simple data model to help parse a JSON feed
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now