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_asymmetric_enc_dec(self):
     """Tests asymmetric 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.'''
     ciphertext = asymmetric_encrypt_sign(
         msg, self._client_pub_key2, self._server_priv_key1)
     self.assertNotEqual(msg, ciphertext)
     deciphered = asymmetric_decrypt_verify(
         ciphertext, self._client_priv_key2, self._server_pub_key1)
     self.assertEqual(msg, deciphered)
Beispiel #4
0
 def test_asymmetric_enc_dec(self):
     """Tests asymmetric 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.'''
     ciphertext = asymmetric_encrypt_sign(msg, self._client_pub_key2,
                                          self._server_priv_key1)
     self.assertNotEqual(msg, ciphertext)
     deciphered = asymmetric_decrypt_verify(ciphertext,
                                            self._client_priv_key2,
                                            self._server_pub_key1)
     self.assertEqual(msg, deciphered)