• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

RAS+public private key encrypt +decrypt+ file size larger

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear friends,
I am doing encrypting decrypting of any type files using My RSA+private key ,public key alogorithm in java.
My issue is wheever i enctyprt any .tar files the size of the encrypted file is larger than the original .tar file.
But encryption is ok and decryption also ok.

Thanks
Rakesh
 
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rakesh Kumar wrote:Dear friends,
I am doing encrypting decrypting of any type files using My RSA+private key ,public key alogorithm in java.
My issue is wheever i enctyprt any .tar files the size of the encrypted file is larger than the original .tar file.
But encryption is ok and decryption also ok.

Thanks
Rakesh



Unless you compress a file first, it is almost certain that the encrypted file will be longer than the original. This applies pretty much regardless of the encryption method since one normally has to apply some form of padding and one has to ship some ancillary information such as a random initialisation value (IV).

 
Rakesh Kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you could explain in some more details it will help me more.
Thankx
Rakesh
 
James Sabre
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rakesh Kumar wrote:If you could explain in some more details it will help me more.
Thankx
Rakesh



What more can one say! The subject is large and I don't intend to write a book on the subject and post it here. If you are really serious about the topic then, as a starting point, you should read "Beginning Cryptography with Java" written by David Hook and published by Wrox.
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why is it a problem?

The point of encryption is to hide the data, or make it impossible to read without knowing the key. It is NOT supposed to compress the data. I doubt any encryption tool says it would keep the file the same size. Pretty much by nature of what it does, it has to add bytes in here and there.

 
Rakesh Kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear friend I am able to encrypt the file but with some considerable increase in size .And later we can decrypt the file also..

The size incriment of the output of the decryption happens.

Thanks
Rakesh
 
fred rosenberger
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what you are saying is that you have a file that is X bytes, you encrypt it, then decrypt it, and the final result of that is X+delta bytes?
 
James Sabre
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rakesh Kumar wrote:Dear friend I am able to encrypt the file but with some considerable increase in size .And later we can decrypt the file also..

The size incriment of the output of the decryption happens.

Thanks
Rakesh



Then you have a bug in either or both of your encryption and decryption routines. Of course if we could see the code we could possibly help but ...
 
Rakesh Kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear friend ,
I tried to attach ans send the sample files but some error is coming.
Can you please send me your email id so that i can send files directly to you.

Thanks for your support in this problem.
raakesh
 
James Sabre
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rakesh Kumar wrote:Dear friend ,
I tried to attach ans send the sample files but some error is coming.
Can you please send me your email id so that i can send files directly to you.

Thanks for your support in this problem.
raakesh



I don't publish an email address and I don't enter into private correspondence . Your code should not be more than about 50 lines long (if it is then it includes far too much that is not concerned with the cryptography) so try again.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rakesh Kumar wrote:I tried to attach ans send the sample files but some error is coming.


Text files can not be attached. James is right, the relevant code should not be long - just post it in CODE tags.
 
Rakesh Kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear friends I got one sample from one site it will encrypt the files without increasing the size.
Thanks for the support and suggestion of all of you people and very appreciable your efforts to help in case of technical issues.
Expecting more help from you people.

Thanks
rakesh
 
James Sabre
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rakesh Kumar wrote:Dear friends I got one sample from one site it will encrypt the files without increasing the size.



Then the 'sample' is most probably flawed since the ancillary information such as padding and IV will in general add to the overall size.
 
reply
    Bookmark Topic Watch Topic
  • New Topic