Exemplo n.º 1
0
def empty_db_file(rsa_pair):
    db = PasswordDatabase()
    db.recipients.append(Recipient(rsa_pair.public, ''))
    f = BytesIO()
    db.encrypt(f)
    f.seek(0)

    return namedtuple('EmptyDBFile', 'f rsa_pair')._make((f, rsa_pair))
Exemplo n.º 2
0
    def test_symmerty(self, rsa_pair):
        """Ensures that encrypt/decrypt is symmentrical"""

        database = PasswordDatabase()
        database['my_password'] = '******'
        database.recipients.append(Recipient(rsa_pair.public, 'Test'))

        f = BytesIO()
        database.encrypt(f)

        f.seek(0)
        database2 = PasswordDatabase(f, rsa_pair.private)
        assert database._password_store == database2._password_store
        assert len(database2.recipients) == 1 and database2.recipients[0].comment == 'Test'