Ejemplo n.º 1
0
    def it_encrypts_items(self):
        encrypted_key = self.get_key()
        decrypted_key = crypto.decrypt_key(encrypted_key, 'masterpassword123')
        decrypted_item = self.get_item()
        decrypted_item['encrypted'] = {'fields': [{'value': 'foo'}, {'value': 'bar'}, {'ball': '⚽'}]}

        encrypted_item = crypto.encrypt_item(decrypted_item, decrypted_key)
        redecrypted_item = crypto.decrypt_item(encrypted_item, decrypted_key)

        assert redecrypted_item['encrypted']['fields'][0]['value'] == 'foo'
        assert redecrypted_item['encrypted']['fields'][1]['value'] == 'bar'
Ejemplo n.º 2
0
    def it_encrypts_items(self):
        encrypted_key = self.get_key()
        decrypted_key = crypto.decrypt_key(encrypted_key, 'masterpassword123')
        decrypted_item = self.get_item()
        decrypted_item['encrypted'] = {
            'fields': [{
                'value': 'foo'
            }, {
                'value': 'bar'
            }, {
                'ball': '⚽'
            }]
        }

        encrypted_item = crypto.encrypt_item(decrypted_item, decrypted_key)
        redecrypted_item = crypto.decrypt_item(encrypted_item, decrypted_key)

        assert redecrypted_item['encrypted']['fields'][0]['value'] == 'foo'
        assert redecrypted_item['encrypted']['fields'][1]['value'] == 'bar'
Ejemplo n.º 3
0
 def _encrypt_item(self, item):
     return crypto.encrypt_item(item, self._get_key_for_item(item))
Ejemplo n.º 4
0
 def _encrypt_item(self, item):
     return crypto.encrypt_item(item, self._get_key_for_item(item))