AES-CMAC python interface
Posted: Tue Sep 10, 2019 5:22 am
Hello. I would like to use AES-CMAC which is used for message verification/authentication in micropython. It appears the ucryptolib AES code comes from mbed tls which also includes CMAC code. Anyone know if cmac has been stripped out for micropython or do I need to just build a python interface on top of it?
Should I just copy the AES ucryptolib.c to add support for CMAC or any other suggestions to get me started?
Is anyone working on or any intentions of adding a python interface for cmac? Regular python has it implemented like this:
Should I just copy the AES ucryptolib.c to add support for CMAC or any other suggestions to get me started?
Is anyone working on or any intentions of adding a python interface for cmac? Regular python has it implemented like this:
>>> from Crypto.Hash import CMAC
>>> from Crypto.Cipher import AES
>>>
>>> secret = b'Sixteen byte key'
>>> cobj = CMAC.new(secret, ciphermod=AES)
>>> cobj.update(msg)
>>> try:
>>> cobj.verify(mac)
>>> print "The message '%s' is authentic" % msg
>>> except ValueError:
>>> print "The message or the key is wrong"