file encryption

i need the code for how to encrypt the file using java?
sunda2010Asked:
Who is Participating?
 
Gurvinder Pal SinghCommented:

check this one out

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


Main1.java
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
sunda2010Author Commented:
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
 
sunda2010Author Commented:
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
 
Gurvinder Pal SinghCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.