diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-07-12 09:27:37 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-07-12 09:27:37 -0700 |
commit | 45fd0572bbc295bb771ba0500c70d6fd1b046847 (patch) | |
tree | 6bf1184173d63848ff74d3ea0c7a774d3d7cfc7b /docs/hazmat/primitives/mac/cmac.rst | |
parent | f11d17b5c787409a7689279aec8f5435c64fdce8 (diff) | |
download | cryptography-45fd0572bbc295bb771ba0500c70d6fd1b046847.tar.gz cryptography-45fd0572bbc295bb771ba0500c70d6fd1b046847.tar.bz2 cryptography-45fd0572bbc295bb771ba0500c70d6fd1b046847.zip |
Try to make the examples of verifying an HMAC/CMAC clearer -- refs #1259
Diffstat (limited to 'docs/hazmat/primitives/mac/cmac.rst')
-rw-r--r-- | docs/hazmat/primitives/mac/cmac.rst | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/hazmat/primitives/mac/cmac.rst b/docs/hazmat/primitives/mac/cmac.rst index 104ba8b8..1ba1b3fa 100644 --- a/docs/hazmat/primitives/mac/cmac.rst +++ b/docs/hazmat/primitives/mac/cmac.rst @@ -31,7 +31,7 @@ A subset of CMAC with the AES-128 algorithm is described in :rfc:`4493`. >>> from cryptography.hazmat.primitives.ciphers import algorithms >>> c = cmac.CMAC(algorithms.AES(key), backend=default_backend()) >>> c.update(b"message to authenticate") - >>> c.copy().finalize() + >>> c.finalize() 'CT\x1d\xc8\x0e\x15\xbe4e\xdb\xb6\x84\xca\xd9Xk' If the backend doesn't support the requested ``algorithm`` an @@ -47,6 +47,8 @@ A subset of CMAC with the AES-128 algorithm is described in :rfc:`4493`. .. doctest:: + >>> c = cmac.CMAC(algorithms.AES(key), backend=default_backend()) + >>> c.update(b"message to authenticate") >>> c.verify(b"an incorrect signature") Traceback (most recent call last): ... |