AES encryption


#1

HI,

does anybody know if there is a way to use AES CBC encryption in ST ? I need to encrypt communication via hub action. Any idea how to do it ?


( I hate Mondays) #2

You may be able to find ways in Groovy. The ST cloud runs groovy so that’s your starting point. I managed to get MD5 running and I believe there are ways to use SHA too, but these are hashes, not crypto. Look up Groovy AES. Then keep in mind not all classes are permitted in the ST version of Groovy.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #3

Last time I checked … no.

There is a very limited “whitelist” of Java Class libraries that can be imported.

And I don’t think the whitelist is published (@jim?)


(Jim Anderson) #4

http://docs.smartthings.com/en/latest/getting-started/groovy-for-smartthings.html#allowed-classes


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #5

Yay… Thanks, Jim!

But… No crypt, encrypt, (?) Class in the list… I don’t think??


#6

Nope. Nothing like this on a list. Looks like importing Cipher is ok, but due to the fact it is not whitelisted I get SecurityException.

I guess the only way would be to reimplement all logic within groovy script (if possible ) or find a way to add this to whitelist.


( I hate Mondays) #7

Or use an external service to do the decrypting for you. When you receive a message from the LAN device, pass it to an https request that decrypts it. When sending a message, first pass it to the https request for encryption. Horrible workaround but still a workaround.


#8

Yeah, Was thinking about this but as ultimate goal was to get rid of intermediary device keeping it just for encryption seems pointless.