5a58ba807a
Some applications, such as k8s, require a base64 encoded string. This patch updates the passphrase catalog such that the user can specify to use base64 encoding on one or more passphrases found in the passphrase catalog. We add that support by: 1. Updating pegleg.engine.catalogs.passphrase_catalog to include a method which determines what encoding type to use, if any. 2. Updating pegleg.engine.generators.passphrase_generator.generate to encode the passphrase in base64 if detected. This change is designed to easily add other supported encoding methods in the future if desired. 3. Updating tests.unit.engine.test_generate_passphrases to demonstrate that the encoding field in passphrase catalog is being used, and that the resultant passphrase is in fact base64 encoded. Also show that when encoding type is not specified, or is set to 'none' that base64 encoding does not take place. 4. Updating tests.unit.engine.test_generate_passphrases to demonstrate that the encoding field in passphrase catalog is being used, and that the resultant passphrase is in fact base64 encoded. We also demonstrate the flow from original passphrase to bytes, to base64 encoded, to encrypted, and back again yields the expected values at each step of encoding/decoding/encryption and decryption. Change-Id: I47c740ca13be57ed74b6780f80c90b39e935708b |
||
---|---|---|
.. | ||
__init__.py | ||
base_generator.py | ||
passphrase_generator.py |