Пример #1
0
 def decrypt(ciphertext: bytes, key: bytes, iv: bytes, auth_tag: bytes) -> bytes:
     return Cipher.aes_256_gcm().quick_gcm_dec(key, iv, ciphertext, auth_tag)
Пример #2
0
    def encrypt(plaintext: bytes, key: bytes) -> (bytes, bytes):
        iv = urandom(16)
        assert len(key) == 32

        ciphertext, auth_tag = Cipher.aes_256_gcm().quick_gcm_enc(key, iv, plaintext)
        return ciphertext, iv, auth_tag