?
Solved

file encryption

Posted on 2010-01-07
6
Medium Priority
?
274 Views
Last Modified: 2012-05-08
i need the code for how to encrypt the file using java?
0
Comment
Question by:sunda2010
  • 3
  • 2
6 Comments
 

Author Comment

by:sunda2010
ID: 26207339
Hello sir,

I was run this code.
http://cs.saddleback.edu/rwatkins/CS4B/Crypto/FileEncryptor.html

This link contains the 2 programs. one was FileEncryptor.java and FileDecryptor.java.

I was comile and run the FileEncryptor.java program successfully.

I was comile and run the FileDencryptor.java program. I was got an error.

Exception in thread "main" javax.crypto.BadPaddingException: Given final block not properly padded
        at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
        at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
        at com.sun.crypto.provider.SunJCE_ab.b(DashoA13*..)
        at com.sun.crypto.provider.PBEWithMD5AndDESCipher.engineDoFinal(DashoA13*..)
        at javax.crypto.Cipher.doFinal(DashoA13*..)
        at fileencryption.FileDecryptor.main(FileDecryptor.java:66)


How to rectify this error.

please help me.

Thanks in advance.




0
Technology Partners: 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!

 

Author Comment

by:sunda2010
ID: 26207352
Hello sir,

I was run this code.
http://www.java2s.com/Code/Java/Security/Basicsymmetricencryptionexample.htm

This link contains the MainClass.java program. I include all the library files into my projects.

I was compile successfully.

I was run this program.I was got an error like,

Exception in thread "main" java.security.InvalidKeyException: Illegal key size or default parameters
        at javax.crypto.Cipher.a(DashoA13*..)
        at javax.crypto.Cipher.init(DashoA13*..)
        at javax.crypto.Cipher.init(DashoA13*..)
        at BasicSymmetricEncryptionExample.MainClass.main(MainClass.java:25)


How to rectify this error.

please help me.

Thanks in advance.

0
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 500 total points
ID: 26207413

check this one out

Modify this file to get the inputs from data file and encrypt it.


Main1.java
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 26207515
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

839 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