def test_basic_functionality(self): crypter = Crypter(KEYSET_PATH) for key, expected in SETTING_NAME_TO_DECRYPTED_VALUE_MAP.items(): value = getattr(encrypted_settings, key) plaintext = crypter.decrypt(value) self.assertEqual(plaintext, expected)
""" Method 1 - explicitly calling decrypt method with a ciphertext. """ from encrypted_settings.crypter import Crypter crypter = Crypter('/my/path/to/keyczar_keyset') FACEBOOK_API_KEY = crypter.decrypt('ciphertext')
def __init__(self, keyset_path, encrypted_settings_module): self._crypter = Crypter(keyset_path=keyset_path) self._encrypted_settings_module = encrypted_settings_module self._settings_module = __import__(encrypted_settings_module, fromlist=['.'])