gdanezis / petlib

A python library that implements a number of Privacy Enhancing Technolgies
BSD 2-Clause "Simplified" License
133 stars 33 forks source link

Return type of `get_tag` should be `bytes` #16

Closed rsoultanaev closed 6 years ago

rsoultanaev commented 6 years ago

Example (quick_gcm_enc uses get_tag and in here tag is the return value of get_tag):

>>> from os import urandom
>>> from petlib.cipher import Cipher
>>> message = "hello"
>>> plaintext = message.encode("utf8")
>>> aes = Cipher("aes-128-gcm")
>>> iv = urandom(16)
>>> key = urandom(16)
>>> ciphertext, tag = aes.quick_gcm_enc(key, iv, plaintext)
>>> type(tag)
<type '_cffi_backend.CDataOwn'>
>>> tag is str
False
>>> tag is bytes
False