[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Sockets ASCII & Base64 Encryption Problems?

Posted on 2009-05-05
6
Medium Priority
?
369 Views
Last Modified: 2012-05-06
I'm building a typical TCP Socket Server / Client in the usual way. Now I have a problem after encrypting the data. Both Client and Server have identical myCrypto classes and password123. I don't receive errors performing the Encryption on the Client, just during Decryption on the Server...

[Client]
publice void SendData(string message)
{
     Object oData = myCrypto.Encrypt(message, "password123");
     byte[] byteData = System.Text.Encoding.ASCII.GetBytes(oData.ToString());
}

[Server]
public  void DataRcvd(IAsyncResult aResult)
{
     string dataEncrypted = Encoding.ASCII.GetString(skt.byteBuffer, 0, skt.byteBuffer.Length);                                
     string dataDecrypted = myCrypto.Decrypt(dataEncrypted, "password123");
}
0
Comment
Question by:pointeman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 12

Expert Comment

by:williamcampbell
ID: 24310057
does (Server) string dataEncrypted   Equal (Client)  oData.ToString()  ?
0
 

Author Comment

by:pointeman
ID: 24316549
I'm check that out now...
0
 

Author Comment

by:pointeman
ID: 24317047
Go figure, for what ever reason, loading the received data into a textbox somehow fixes the problem, although I don't want to use a textbox because the Win-App is just a testing project to eventually build a Win-Service later....
public  void DataRcvd(IAsyncResult aResult)
{
     string dataEncrypted = Encoding.ASCII.GetString(skt.byteBuffer, 0, skt.byteBuffer.Length);                                
     
     textBox_ReceivedMsg.Text = dataEncrypted;

     string dataDECRYTPED = myCrypto.Decrypt(txtReceivedMsg.Text, "password123");

     textBox_Decrypted.Text = dataDECRYTPED;
}
 
0
Industry Leaders: 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!

 
LVL 12

Expert Comment

by:williamcampbell
ID: 24318000
Maybe the line below will do it
string dataEncrypted = Convert.ToString (Encoding.ASCII.GetString(skt.byteBuffer, 0, skt.byteBuffer.Length));  
 
or
 
string dataEncrypted = Encoding.ASCII.GetString(skt.byteBuffer, 0, skt.byteBuffer.Length).ToString ();  

Open in new window

0
 

Author Comment

by:pointeman
ID: 24320809
No, both code suggestions failed because I now need to convert to base64, which I did, then I receive a padding error....
I guess I need to investigate how a TextBox converts input data.
0
 

Accepted Solution

by:
pointeman earned 0 total points
ID: 24337218
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

656 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