473,949 Members | 35,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can anyone help me to solve that? RSA encryption/decryption

1 New Member
Thanks for your great help you offer through this nice form.
My problem is in encryption and decryption using RSA, in my project I need to encrypt some string using the public key and send the results via some socket to another client to decrypt it using the relative private key.
My encryption function return byte[] and I encode it to string to be able to send it also I add some other data to this string and then in the other side I break it again and get the encrypted part off and then again turn it back to byte[] form. When I try to decrypt it an error is raised:
Expand|Select|Wrap|Line Numbers
  1. Exception in thread "main" javax.crypto.BadPaddingException: Data must start with zero
  2.     at sun.security.rsa.RSAPadding.unpadV15(Unknown Source)
  3.     at sun.security.rsa.RSAPadding.unpad(Unknown Source)
  4.     at com.sun.crypto.provider.RSACipher.a(DashoA13*..)
  5.     at com.sun.crypto.provider.RSACipher.engineDoFinal(DashoA13*..)
  6.     at javax.crypto.Cipher.doFinal(DashoA13*..)
  7.  
I try to decrypt the original byte[] in the server side and I succeeded but when I convert it to string and back again to byte[] and then decrypt it the same error is appeared . I believe that the problem is in converting to and from string.
Can anyone help me to solve that?
Nov 13 '10 #1
0 1326

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2433
by: D. Alvarado | last post by:
On my Fedora Core 2 Linux dev box, I have installed mcrypt and compiled PHP with the --with-mcrypt option. I am concerned that when I move to another hosting enviornment mcrypt will not be supported. In people's experiences, have hosting companies supporting PHP/MySQL generally provided support for mcrypt? Does anyone recommend another module for encryption/decryption that accompanies the PHP package? Thanks, - Dave
1
2488
by: Jase H | last post by:
Hello, I have a ASP.NET web application problem involving the data encryption and decryption assembly(DLL) used on the connection string value that is set in the webconfig file. The problem occurs in the application when you instantiate a new instance of the class as shown below: ---Dim dp As DPAPIComp.DataProtectorComp = New DPAPIComp.DataProtectorComp--- where DPAPIComp is the name of the namespace referenced to in the library
5
7707
by: Robert Bull | last post by:
I am looking for an example of encryption/decryption in asp.net. I want to encrypt a string before I send it to a Web Service, decrypt it on the Web Service then encrypt the results on the Web Service and decrypt the results on the web app. Any example using System.Security.Cryptography namespace (VB not C#, thanks)would be greatly appreciated. Thanks in advance. -Rob
2
7164
by: almurph | last post by:
Hi everyone, Can you help me please? I am having a problem with the encryption/decryption of words with the Irish fada in them. The Irish fada is like this: áéíóú/ÁÉÍÓÚ. It's kind of like the French grave... Anyway when I run encryption on a plaintext word like:
2
2450
by: tfoxusenet | last post by:
Hi, I need to encrypt/decrypt some data for my C# application that can also be read on a unix system, and need a quick, simple, cross-platform solution I can embed in my own code that doesn't require dependencies on outside applications. I don't know much about encryption. What I would like to do is come up with an encryption/decryption code that will work with my C#/.NET framework windows code (there are a number of cryptographic...
3
3989
by: Mythran | last post by:
I have googled and tested and tried and still I can't seem to implement a simple encryption/decryption console application. My goal is to create two methods. public byte Encrypt(string DataToEncrypt, string Key) { ... } public byte Decrypt(byte DataToDecrypt, string Key)
1
2412
by: ppuniversal | last post by:
Hello, I am making a DES encryption/decryption program using OpenSSL library. I am using function des_ecb_encrypt(des_cblock *input, des_cblock *output, des_cblock *keysched, int mode); This function can encrypt/decrypt only 8bytes block at a time. Thus takes a lot of time during encryption/decryption. Please tell, if there is any other way/function that can take larger block size, or any other function which implements DES in a...
0
1052
by: Rajeev Kumar Sarawagi | last post by:
Can anyone say that the difference between oracle and informix
0
2385
by: Dipanwita | last post by:
I have written a RSA encryption/decryption function in c using the formula a = b^c %n. For solving the equation I have used Squaring and multiplying method for modulo exponentiation . These functions work fine when Two random prime numbers (required to generate public n private key) are within certain range but fails afterwords.All the variables are of datatype ULONGLONG. I m unable to fix up the problem. Is these really a storage problem...
3
3096
by: =?Utf-8?B?TG9yZW4=?= | last post by:
I’m trying to encrypt and decrypt a file in vb.net. I am using the TripleDESCryptoServiceProvider encryption found in System.Security.Cryptography. Below is the code for my Encrypt and Decrypt functions. While my functions read and write files the encryption/decryption is not working properly. My test file has an original length of 66,048 bytes. My encrypted file ends up with 66,056 bytes … 8 bytes more than my original. When I...
0
10171
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9991
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11190
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11363
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10701
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9903
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4547
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3556
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.