Return type of `get_tag` should be `bytes`
rsoultanaev opened this issue · 0 comments
rsoultanaev commented
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