AES Two way password encoder

Description

The AES two-way password encoder plugin allows you to encrypt and decrypt passwords using a provided key string.

Configuration

The configuration of this encoder is for the whole Hop environment and can as such only be done using system properties. These properties are listed below and can also be specified as system properties with hop-run:

  • HOP_PASSWORD_ENCODER_PLUGIN: set this to the ID of this plugin: AES

  • HOP_AES_ENCODER_KEY: Specify the key to use to encode or decode passwords

Noteworthy

Please note that passwords are encoded with prefix AES which is AES plus a space. This means that it’s different from standard, Hop encoded, passwords which have prefix Encrypted which is Encrypted plus a space. The consequence of this is that you need to encode passwords either one way or another. Mixing password encoding is not supported.

Best practices

Make sure to only use variables and parameters to specify passwords. Store the passwords in an environment using the projects plugin. This way you can store the passwords in a single file specific for the given environment (development, test, production, …​).

Secure the passwords file. Even though passwords are encrypted it’s better to be safe than sorry. A password that can’t be read, encrypted or otherwise, can’t be seen in any way. So use appropriate file security on the file in which you eventually store the passwords. This advice is doubly true for the key.

You can specify the key using a variable as well.

Hop Encrypt

You can test your setup by setting the variables in your environment and then by using hop-encrypt to see the output:

$:~/hop$ export HOP_PASSWORD_ENCODER_PLUGIN=AES
$:~/hop$ export HOP_AES_ENCODER_KEY=ddsfsdfsfsdf
$:~/hop$ sh hop-encrypt.sh -hop MyPassword222
AES kb/8yIPqClL/0+/e+gsVcw==

$:~/hop$ export HOP_AES_ENCODER_KEY=abcd
$:~/hop$ sh hop-encrypt.sh -hop MyPassword222
AES s7JDgDBqQWMh1E/RWgGaUA==