Exemple #1
0
    def test_secret_encryption(self):
        assert conf.get(ENCRYPTION_KEY) == 'my_key'
        assert conf.get(ENCRYPTION_SECRET
                        ) == 'qMGwKR21SAjprV0XOJUI4SoI-MLFoTxN1ahZndKREL4='
        encryptor.validate()
        encryptor.setup()

        value = 'foo'
        encrypted_value = encryptor.encrypt(value)

        assert encrypted_value.startswith('{}my_key$'.format(
            EncryptionManager.MARKER))
        assert encryptor.decrypt(encrypted_value) == 'foo'
Exemple #2
0
    def setup_encryptor_service(self) -> None:
        import encryptor

        encryptor.validate()
        encryptor.setup()