tag:blogger.com,1999:blog-1188765056128955958.post7137347739510891178..comments2023-05-17T14:37:46.383+05:30Comments on the insane techie: Java - Encryption and Decryption of an Image Using Blowfish AlgorithmDhanoop Bhaskarhttp://www.blogger.com/profile/06123558027322013737noreply@blogger.comBlogger66125tag:blogger.com,1999:blog-1188765056128955958.post-76147797675309682032017-04-01T20:56:47.308+05:302017-04-01T20:56:47.308+05:30This program is just to demonstrate the use of JCE...This program is just to demonstrate the use of JCE. Another program which takes user-defined password is also there as a separate post (mentioned in this post itself). Thanks for your feedback.Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-18859117058399342822017-04-01T20:52:47.644+05:302017-04-01T20:52:47.644+05:30Hi,
This program auto-generates the key (password...Hi, <br />This program auto-generates the key (password) for encryption/decryption. It will be different for each execution of the program. That's why the error. Kindly use another version of the program which takes user-defined password (mentioned in this post itself).Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-46915793770245837652017-04-01T20:30:27.160+05:302017-04-01T20:30:27.160+05:30This version of program auto-generates a key (pass...This version of program auto-generates a key (password). Kindly refer to <br />http://www.theinsanetechie.in/2014/04/java-encryption-and-decryption-of-image.html <br />for version with user defined password. You can give any alphanumeric string as password.Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-61261068834253775372017-03-30T13:18:50.196+05:302017-03-30T13:18:50.196+05:30what is the password given?
please specify
what is the password given?<br /><br />please specify<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-47754138025691470372017-03-25T11:24:30.435+05:302017-03-25T11:24:30.435+05:30What exactly should be given in place of masterPas...What exactly should be given in place of masterPassword?<br /><br />And how can I decrypt my encrypted image elsewhere using this ?<br /><br />Reply asap,<br />Thank YouAnonymoushttps://www.blogger.com/profile/07957753056843362125noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-9489399479145858882016-11-30T17:29:09.140+05:302016-11-30T17:29:09.140+05:30Thanks a lot... It helped a lot.Thanks a lot... It helped a lot.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-11612472724068954462016-09-14T08:10:01.182+05:302016-09-14T08:10:01.182+05:30heelo bro i run program i get encrpt image and sen...heelo bro i run program i get encrpt image and sencond time i will run only decrypt method error shows javax.crypto.BadPaddingException: Given final block not properly padded help menaveeenhttps://www.blogger.com/profile/04449797642569956714noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-28701965565339918392016-08-16T00:35:48.091+05:302016-08-16T00:35:48.091+05:30Good article, but there is Logical "Bhanda&qu...Good article, but there is Logical "Bhanda" :D like if user comes uploads some file and logs out, new keys are generated and so on, he comes back and tries to retrieve then he will never get file decrypted due to re initialization of all keys. Better approach to do it more realistic way like from user input file upload and download. :) Anonymoushttps://www.blogger.com/profile/02480698082450891124noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-36968431614985017452016-06-30T21:58:22.809+05:302016-06-30T21:58:22.809+05:30It seems that you placed the code for decryption s...It seems that you placed the code for decryption some where outside the main method.<br />Either make the method (where code for decryption is placed) as 'static' or invoke it using the object of the class from the main method<br />(We can not invoke a non-static method from a static method in Java - main() is static)Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-80523632350744298072016-06-30T21:52:59.787+05:302016-06-30T21:52:59.787+05:30While executing the program EncryptFile.class shou...While executing the program EncryptFile.class should be in the directory com/java/blowfish.<br /><br />While execution you should change directory (cd) to parent of com and run<br /><br />#java com.java.blowfish.EncryptFile<br /><br /><br />(The java interpreter will seek for com/java/blowfish/EncryptFile.class)Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-85591709505812129192016-06-30T21:47:44.832+05:302016-06-30T21:47:44.832+05:30The 'SecretKey' may not be in human readab...The 'SecretKey' may not be in human readable format. If you want to reuse in a separate program you can serialize the object to a file and reuse.<br />(Read about serialization and the interface java.io.Serializable)Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-69469243112042071712016-06-30T21:38:18.321+05:302016-06-30T21:38:18.321+05:30Hi,
Instead of hard coding the file paths, make us...Hi,<br />Instead of hard coding the file paths, make use of command line arguments to take user supplied file paths in to the program.Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-5524032428893531452016-06-30T21:35:41.891+05:302016-06-30T21:35:41.891+05:30Please try to understand what 'encryption'...Please try to understand what 'encryption' and 'decryption' is before going in to the code. Thanks.Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-65032414754405392932016-04-27T20:43:04.961+05:302016-04-27T20:43:04.961+05:30i am not getting encrypted image. when i open the ...i am not getting encrypted image. when i open the encrypted image it shows a cross symbol but i can see the decrypted image.Anonymoushttps://www.blogger.com/profile/05131411283841169719noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-77383247202205846412016-04-27T20:38:05.875+05:302016-04-27T20:38:05.875+05:30i am not getting encrypted image. when i open the ...i am not getting encrypted image. when i open the encrypted image i get a cross sign,but i can see the decrypted image same as that of the input image.Anonymoushttps://www.blogger.com/profile/05131411283841169719noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-17399596933979167002016-03-25T21:32:14.572+05:302016-03-25T21:32:14.572+05:30umm hey can you tell me how to encode or decode us...umm hey can you tell me how to encode or decode user selected images?Anonymoushttps://www.blogger.com/profile/09449730456206275980noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-46454555400222723182016-02-29T20:38:35.106+05:302016-02-29T20:38:35.106+05:30Hi, I splitted my Program as encrypt and Decryt fi...Hi, I splitted my Program as encrypt and Decryt file.<br /><br />encryption part is Working but Decryption part is Showing error message as<br /><br />non-static method(java.lang.String, java.lang.String,)<br />Anonymoushttps://www.blogger.com/profile/10603096276321673706noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-26175237432893724302015-12-10T16:51:24.987+05:302015-12-10T16:51:24.987+05:30Code is getting compiled. But its showing FileNotF...Code is getting compiled. But its showing FileNotFoundException when I run it. I have tried the methods you mentioned earlier but of no use. I am using windows 8. Suggest me the solution.Anonymoushttps://www.blogger.com/profile/04027395999497528882noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-53066205056034647672015-12-08T11:46:57.745+05:302015-12-08T11:46:57.745+05:30I am getting the exception java.io.FileNotFoundExc...I am getting the exception java.io.FileNotFoundException... I have replaced the directory path as you mentioned in one of the above comments.... But still getting the same error.. Please do replyAnonymoushttps://www.blogger.com/profile/04027395999497528882noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-89144380376744798242015-07-03T16:40:27.841+05:302015-07-03T16:40:27.841+05:30how can i get secret key from this programhow can i get secret key from this programAnonymoushttps://www.blogger.com/profile/11000015634894505029noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-75272553249158349692015-07-03T16:39:08.539+05:302015-07-03T16:39:08.539+05:30how can i get secret key from this program how can i get secret key from this program Anonymoushttps://www.blogger.com/profile/11000015634894505029noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-68877376518153775802015-04-29T11:08:35.609+05:302015-04-29T11:08:35.609+05:30Replace
cipher = Cipher.getInstance("Blowfi...Replace <br /><br />cipher = Cipher.getInstance("Blowfish");<br /><br />by<br /><br />cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-5232379026194583842015-04-29T11:04:58.452+05:302015-04-29T11:04:58.452+05:30Hi,
Already explained in one of the previous comme...Hi,<br />Already explained in one of the previous comments.<br /><br />Thanks.Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-91469294881795564202015-04-29T11:02:41.126+05:302015-04-29T11:02:41.126+05:30Hi,
Sorry, I'm not the right person to help yo...Hi,<br />Sorry, I'm not the right person to help you out. Consult someone from electronics background.<br /><br />Thanks.Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.comtag:blogger.com,1999:blog-1188765056128955958.post-60123668631841595122015-04-29T10:54:15.822+05:302015-04-29T10:54:15.822+05:30Hi,
We cannot encrypt data of size greater than th...Hi,<br />We cannot encrypt data of size greater than the key length using RSA algorithm in java (JCE). (However we can use our own implementation of the RSA algorithm) <br /><br />If needed, you can use RSA to encrypt the password and use the encrypted password further to encrypt the image using DES, AES, Blowfish or any such symmetric crypto systems.Dhanoop Bhaskarhttps://www.blogger.com/profile/06123558027322013737noreply@blogger.com