Beispiel #1
0
    def test_asymmetric_key_encryption(self):
        """Tests asymmetric key encryption"""
        key = gen_symmetric_key()

        ciphertext = asymmetric_encrypt_sign(
            key, self._client_pub_key2, self._server_priv_key1)
        self.assertNotEqual(key, ciphertext)
        deciphered = asymmetric_decrypt_verify(
            ciphertext, self._client_priv_key2, self._server_pub_key1)
        self.assertEqual(key, deciphered)
Beispiel #2
0
    def test_asymmetric_key_encryption(self):
        """Tests asymmetric key encryption"""
        key = gen_symmetric_key()

        ciphertext = asymmetric_encrypt_sign(key, self._client_pub_key2,
                                             self._server_priv_key1)
        self.assertNotEqual(key, ciphertext)
        deciphered = asymmetric_decrypt_verify(ciphertext,
                                               self._client_priv_key2,
                                               self._server_pub_key1)
        self.assertEqual(key, deciphered)
Beispiel #3
0
 def test_symmetric_enc_dec(self):
     """Tests symmetric encryption/decryption"""
     msg = b'''All that is gold does not glitter, not all those who wander
      are lost, the old that is strong does not whither, deep roots are
      not touched by the frost. From the ashes a fire shall be woken, a
      light from the shadow shall spring, renewed be the blade that was
      broken, the crownless again shall be king. All that is gold does not
       glitter, not all those who wander are lost, the old that is strong
       does not whither, deep roots are not touched by the frost. From
       the ashes a fire shall be woken, a light from the shadow shall
       spring, renewed be the blade that was broken, the crownless again
       shall be king.'''
     key = gen_symmetric_key()
     ciphertext = symmetric_encrypt(msg, key)
     self.assertNotEqual(msg, ciphertext)
     deciphered = symmetric_decrypt(ciphertext, key)
     self.assertEqual(msg, deciphered)
Beispiel #4
0
 def test_symmetric_enc_dec(self):
     """Tests symmetric encryption/decryption"""
     msg = b'''All that is gold does not glitter, not all those who wander
      are lost, the old that is strong does not whither, deep roots are
      not touched by the frost. From the ashes a fire shall be woken, a
      light from the shadow shall spring, renewed be the blade that was
      broken, the crownless again shall be king. All that is gold does not
       glitter, not all those who wander are lost, the old that is strong
       does not whither, deep roots are not touched by the frost. From
       the ashes a fire shall be woken, a light from the shadow shall
       spring, renewed be the blade that was broken, the crownless again
       shall be king.'''
     key = gen_symmetric_key()
     ciphertext = symmetric_encrypt(msg, key)
     self.assertNotEqual(msg, ciphertext)
     deciphered = symmetric_decrypt(ciphertext, key)
     self.assertEqual(msg, deciphered)
Beispiel #5
0
 def test_symmetric_key_generation(self):
     """Tests generating symmetric keys"""
     key = gen_symmetric_key()
     self.assertEqual(len(key), 32)
Beispiel #6
0
 def test_symmetric_key_generation(self):
     """Tests generating symmetric keys"""
     key = gen_symmetric_key()
     self.assertEqual(len(key), 32)