Page 1 of 1

Java Crypto, encrypt - decrypt for variable and file

Posted: 04 Feb 2019 18:13
by Desmanto
There is old request for file encryption and decryption. But nowadays, we sometimes need to send some secret string but not in plain text. Example, we can use public MQTT service or HTTP server, post some secret command, but in encrypted format. I think we should have the implementation of java crypto for various encryption type, built-in into the script action. Something like encrypt(text_to_encrypt, "AES", "CBC", "secretkey").

The example of the AES crypto java implementation is at here :
https://www.programcreek.com/java-api-e ... rypto.java

Android documentation for the java crypto is here (it is very extensive) :
https://developer.android.com/guide/top ... yptography

Please support all various mode of the encryption for backward compatibility. Example, although ECB is not recommended, but some old application may use and we may need to decrypt from there. The hash and hmac can be included too for completeness.

Provide default configuration for the recommended encryption mode from google, or security best practices from
https://proandroiddev.com/security-best ... 16beaaade9

Since the concept is the same, please provide the action for file based encryption/decryption too, using the same implementation. The difference is we don't init the file anymore to encrypt it inside script. Since init file text only support max 1 MB, but the files we need to encrypt can be more than that.

Re: Java Crypto, encrypt - decrypt for variable and file

Posted: 06 Feb 2019 04:30
by supriyala
Excellent topic. Great information here. Thank you for such a great share!

Re: Java Crypto, encrypt - decrypt for variable and file

Posted: 04 Nov 2019 18:31
by icefox56
What is @Martin's stand on this? Is this request accepted?

It would have been really helpful if you could add this feature.