Пример #1
0
 def test_open(self):
     """Ensure open passes all AES-(PMAC-)SIV AEAD test vectors"""
     for ex in AEADExample.load():
         aead = AEAD(ex.alg, ex.key)
         plaintext = aead.open(ex.ciphertext,
                               nonce=ex.nonce,
                               associated_data=ex.ad)
         self.assertEqual(plaintext, ex.plaintext)
Пример #2
0
 def test_generate_nonce(self):
     """Ensure we can generate random nonces with the right default size"""
     nonce = AEAD.generate_nonce()
     self.assertEqual(len(nonce), 16)
Пример #3
0
 def test_generate_key(self):
     """Ensure we can generate random keys with the right default size"""
     key = AEAD.generate_key()
     self.assertEqual(len(key), 32)