Java Crypto, encrypt - decrypt for variable and file

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

User avatar
Posts: 2709
Joined: 21 Jul 2017 17:50

Java Crypto, encrypt - decrypt for variable and file

Post by Desmanto » 04 Feb 2019 18:13

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 : ...

Android documentation for the java crypto is here (it is very extensive) : ... 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 ... 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.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Posts: 1
Joined: 05 Feb 2019 06:14

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

Post by supriyala » 06 Feb 2019 04:30

Excellent topic. Great information here. Thank you for such a great share!

Posts: 53
Joined: 15 Aug 2017 02:56

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

Post by icefox56 » 04 Nov 2019 18:31

What is @Martin's stand on this? Is this request accepted?

It would have been really helpful if you could add this feature.
Asus Zenfone Max pro M1, Stock android, Oreo 8.1, Rooted