Urgent - Sending Secret Text from Socket

First of all, this is my finishing project. My project has a client and server parts. Server sends the DES key and client initializes it . It is working fine when I check. But the problem is I'm sending encrypted text to the server. And it is stored in SQL DB. then I retrieve the text and decrypt it. And here the problem starts . It throws some exceptions. They are
DES Bad Padding Exception2 !
   DES Illegal Block Size2 !I looked the text that is stored in db. The encrypted text is sent to Server and DB is in server's computer. The encrypted text and the text in DB are same.
Then I again get the encrypted text from the server and I compare the texts all are the same. Wht is my problem? Is it because of the sending error of sockets (I use TCP Socket) . And when I don't use encryption the data are sent very perfectly.
Please Help. I cannot find my problem. And if there are someone doing similar projects please contact me.. msn: [email protected]

I bet you are converting the encrypted bytes to a String using
String toStoreInDB = new String(encryptedBytes);
Your encrypted bytes will look very random and using your default encoding system will probably not convert properly using this approach. Centainly the transform bytes -> String -> bytes will probably not get back your original bytes.
You have two possible approaches.
1) Define your DB column to hold bytes (not CHAR or VARCHAR).
2) Encode the encrypted bytes. I would use Base64 encoding but HEX and many other encoding systems are just as good.

Similar Messages

  • When I attempt to send a text from the new iPad, a dialog box appears with the option to either sign in with Apple ID Password or Create New Account. I try signing in using my Apple ID password but IMessage informs me that email address cannot be verified

    When I attempt to send a text from the new iPad, a dialog box appears with the option to either sign in with Apple ID Password or Create New Account. I try signing in using my Apple ID password but IMessage informs me that email address cannot be verified because it is already in use ??? What am I doing wrong?

    settings -> iTunes & App Store
    click on apple ID listed there
    select Sign Out
    sign in with the proper account
    from then on, when the store ask for your password it should be with the correct ID

  • When I send a text from my iPad, it shows that it comes from my email address.  If I then text that same someone from my iPhone it still shows as if its coming from my iPad.  How do I stop this?

    When I send a text from my iPad, it shows that it comes from my email address.  If I then text that same someone from my iPhone it still shows as if its coming from my iPad.  How do I stop this?

    On your iPhone, go to Settings -> Messages -> Receive At -> Caller ID and make sure the phone number is selected - this will cause new messages sent from your iPhone to appear to come from your iPhone phone number.
    (I actually prefer to have my email selected, so that when I message someone from my iPhone and they reply, it goes to both my iPhone and iPad)
    Also, when you send a message from your iPhone, make sure you're not replying within an existing conversation (that was created on your iPad and linked to your email). Just start a new conversation (even if it's to the same person) by going to the Messages app, going back to "Messages" (top left corner) if you're already looking at a conversation, and then clicking the Compose icon in the top right.

  • Why does my iphone send all text from only one of my contacts to my email?

    Why does my iphone send all text from only one of my contacts to my email? I'm curious to know if anyone else has had this issue with the Iphone 5s...

    imessage has a new setting that shows all emails associated with your apple id.  There are two sections, send and receive.  Since you are using the same apple id, Im sure if you adjust one of those settings to your mobile number instead of your appleid, it wont send double.
    You might also have to adjust your wifes settings too, so those emails dont overlap

  • Whenever I send a text from my iphone 5 my text messages are appearing on other apple devices in the household.

    Whenever I send a text from my iphone 5 my text messages are appearing on other apple devices in the household. ie Iphone 4 and Ipod.
    How do I stop this occurring.

    You'll have to deselect your phone number on the other devices in Settings/Messages/Receive at/
    Check this post about iMessage:
    iMessage on iPad and iPhone Explained and De-Mystified

  • Can I send a text from my ipad to a droid?

    Can I send a text from my ipad to a droid?

    IF YOU ONLY HAVE WIFI: you can download a texting app (which gives you your own #) and then YES, you can text anyone's cell phone or device as long as they have a phone # as well.
    IF YOU HAVE 3G (INTERNET EVERYWHERE) OR A TEXTING PLAN: YES you can, if you have 3G, then follow the instructions for wifi
    if you have 3g, then you should be able to enter the messaging application on your iPad and send a message to anyone with a valid phone #!
    I hope I was able to help you converse with whoever you are trying to converse with...
    Maniac

  • Unable to send Group text from Nokia Lumia 520

    Hi Guys,
    I am unable to send Group text from lumia 520, even after enabling the Group text option in the messaging settings.
    Please help.
    Attachments:
    wp_ss_20130729_0001[1].png ‏39 KB

    I also need to send group msg to about 100 people which was possible in Symbian, but in Lumia group limit is 25 (how ridiculous!)
    Now I have made several groups of 25 & send few mgs.
    But what I don't like is, group sms are shown in different thread, so when someone replies, his thread doesn't show the group msg so I can't make out to which msg I am getting reply.
    Earlier Symbian used to send group msg as individual sms so replies used to show all sms, sent & received. Symbian system was better for me.
    Using Nokia Lumia 1320.
    Also have Nokia E72 & Nokia N8.

  • When I send a text from my IPad to an IPhone there is no alert on the phone letting them know they have a text

    When I send a text from my IPad to my wife's IPhone no alert sounds on the phone and is not displayed on the screen.Do I not have some settings right?

    The settings issue would be on your wife's iPhone, assuming the message is being displayed on her phone.

  • If I send a text from my iphone to an iphone user the reply comes into my ipad via imessage. I don't get a text reply on my iphone. Any ideas how to fix?

    If I send a text from my iphone to an iphone user the reply comes into my ipad via imessage. I don't get a text reply on my iphone. Any ideas how to fix?

    Yes. On your phone make sure it is set to send messages from your phone number, not your apple id or other email address. That way when they reply it will go to your phone.

  • Can i send a text from my ipad

    Can i send a text from my i pad to any phone? How do you do it!
    Thankyou!

    There may be some apps that will allow sending a text to other non Apple phones. Search the App Store.
    The Messages app that comes on an iPad can send iMessages to other iOS devices only.

  • I have a friend that has the IPhone and I have Straight Talk, what the issue is,when I send picture texts from my ST phone to his IPhone,he always tells me  he doesn't receive them.Why is this happening?

    I have a friend that has the IPhone and I have Straight Talk, what the issue is,when I send picture texts from my ST phone to his IPhone,he always tells me  he doesn't receive them.Why is this happening?

    You got the new iphone?????   I have same problem.  I transferred audiobooks to device to find no audiobooks on device (despite it being in iTunes as if it was).  Have you found a solution?????   I even tried to change import settings on format transfer but hasn't worked. 

  • If I send a text from my phone does that text show up in every device I own??

    If I send a text from my phone, will it also show up on every device that I have?? And what about texts I get back

    For imessage if you are signed in thru your apple id for all your devices, yes I believe you will receive it all. 
    NOt sure about text message.

  • How do I send a text from my iphone to an email address and have it be an imessage?

    I am trying to send a text message to my husband's ipad from my iphone via his email address.  He receives the text in his email and not as an imessage.  How can I change this so he receives it as an imessage. Our apple user id is my email address. 

    If you want your husband to receive an iMessage, you must send it to him as an iMessage yourself. Just go into the Messages app and send it to your husband's Apple ID. All e-mails (except me.com, as it is part of iCloud/iMessages) don't actually work with Messages.
    Alternatively, you could download free, wi-fi based messenger apps on your iDevices. Popular ones include WhatsApp, but there should be more that suit your preferences.

  • When i send a text from my iphone 5S its going from my icloud email not my phone number , how can i change this?

    When i send a text message from my iphone 5s, it is sending it from my icloud email rather than my phone number , how can i change this ?
    Thanx

    Settings>Messages>Send/Receive>Start New Conversations From....put a check next to your phone number.

  • Help: send unicode text using sockets

    Hi,
    I am trying to send unicode text to a native app using sockets. My test code looks like this
    Socket socket = new Socket(m_serverHost, m_hostPort);
    OutputStreamWriter out = new OutputStreamWriter(socket.getOutputStream(), "UTF-8");
    InputStreamReader reader = new InputStreamReader(socket.getInputStream(), "UTF-8");
    BufferedReader in = new BufferedReader(reader);
    // receive response to connect
    byte[] rc = new byte[4];
    int i = 0;
    while (i < 4)
    rc[i++] = (byte) in.read();
    String text = new String("Hello");
    out.write(text);
    // receive response to "hello"
    i = 0;
    while (i < 4)
    rc[i++] = (byte) in.read();
    My test program is connecting to the server socket but the server does not seem to understand the text that I send.
    Please comment if I am doing anything wrong or advice if you have any different ideas.
    Thanks,
    nallamos

    Try using the following output and input streams.
    out = new DataOutputStream(
    new BufferedOutputStream(
    s.getOutputStream()));
    in = new DataInputStream(
    new BufferedInputStream(
    s.getInputStream()));
    When you send the data send it using
    out.WriteBytes(message)

Maybe you are looking for