Dissector preferences with alternative representations
I've got a custom dissector written in Lua. The protocol has encryption, which needs a 16-byte encryption key to decode, so I've made that a protocol preference, with the key entered as 32 hex digits. That's working fine.
I'd like to have the possibility of entering a protocol encryption key as a keyphrase instead, where the encryption key is a hash output from the keyphrase (and non-reversible).
How could dissector preferences be set up so that a user could enter either an encryption key as 32 hex digits, or enter a passphrase that is converted to 32 hex digits? Could it be:
- two separate text fields (and the key as 32 hex digits is automatically updated when the user types a keyphrase)
- one text field plus an enum box to choose whether it's a hex key vs keyphrase
- some other strategy?