def test_password_encryption(self):
        """ Verify that encryption matches a known encrypted string """

        PLAINTEXT_MESSAGE = "This is a really cool encrypted message"
        ENCRYPTED_MESSAGE = "wM9rJnv-b5C5S8hwIm062vCpOkA8DbVJhqOejlyY7gaR53ROM-QxfG7hxgu65wVawQLysRdFHvhPh9qValXdGr9OsCHJFO35rHHMhBhHWg=="

        password_encryptor = PasswordEncryptor("password")

        encrypted_message = password_encryptor.encrypt(PLAINTEXT_MESSAGE, nonce=KNOWN_NONCE)

        self.assertEqual(encrypted_message, ENCRYPTED_MESSAGE)
Exemple #2
0
    def test_password_encryption(self):
        """ Verify that encryption matches a known encrypted string """

        PLAINTEXT_MESSAGE =  'This is a really cool encrypted message'
        ENCRYPTED_MESSAGE =  'wM9rJnv-b5C5S8hwIm062vCpOkA8DbVJhqOejlyY7gaR53ROM-QxfG7hxgu65wVawQLysRdFHvhPh9qValXdGr9OsCHJFO35rHHMhBhHWg=='

        password_encryptor = PasswordEncryptor('password')

        encrypted_message = password_encryptor.encrypt(PLAINTEXT_MESSAGE, nonce=KNOWN_NONCE)

        self.assertEqual(encrypted_message, ENCRYPTED_MESSAGE)
Exemple #3
0
    def test_password_encryption_and_decryption(self):
        """ Verify that encryption with a given password matches decryption with the same password """

        PLAINTEXT_MESSAGE =  'This is a really cool encrypted message'

        password_encryptor = PasswordEncryptor('password')
        encrypted_message = password_encryptor.encrypt(PLAINTEXT_MESSAGE)

        password_decryptor = PasswordDecryptor('password')
        decrypted_message = password_decryptor.decrypt(encrypted_message)

        self.assertEqual(PLAINTEXT_MESSAGE, decrypted_message)
    def test_password_encryption_and_decryption(self):
        """ Verify that encryption with a given password matches decryption with the same password """

        PLAINTEXT_MESSAGE = "This is a really cool encrypted message"

        password_encryptor = PasswordEncryptor("password")
        encrypted_message = password_encryptor.encrypt(PLAINTEXT_MESSAGE)

        password_decryptor = PasswordDecryptor("password")
        decrypted_message = password_decryptor.decrypt(encrypted_message)

        self.assertEqual(PLAINTEXT_MESSAGE, decrypted_message)