本文整理汇总了Python中cryptography.hazmat.primitives.cmac.CMAC.copy方法的典型用法代码示例。如果您正苦于以下问题:Python CMAC.copy方法的具体用法?Python CMAC.copy怎么用?Python CMAC.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cryptography.hazmat.primitives.cmac.CMAC
的用法示例。
在下文中一共展示了CMAC.copy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_raises_after_finalize
# 需要导入模块: from cryptography.hazmat.primitives.cmac import CMAC [as 别名]
# 或者: from cryptography.hazmat.primitives.cmac.CMAC import copy [as 别名]
def test_raises_after_finalize(self, backend):
key = b"2b7e151628aed2a6abf7158809cf4f3c"
cmac = CMAC(AES(key), backend)
cmac.finalize()
with pytest.raises(AlreadyFinalized):
cmac.update(b"foo")
with pytest.raises(AlreadyFinalized):
cmac.copy()
with pytest.raises(AlreadyFinalized):
cmac.finalize()
示例2: test_copy
# 需要导入模块: from cryptography.hazmat.primitives.cmac import CMAC [as 别名]
# 或者: from cryptography.hazmat.primitives.cmac.CMAC import copy [as 别名]
def test_copy():
backend = DummyCMACBackend([AES])
copied_ctx = pretend.stub()
pretend_ctx = pretend.stub(copy=lambda: copied_ctx)
key = b"2b7e151628aed2a6abf7158809cf4f3c"
cmac = CMAC(AES(key), backend=backend, ctx=pretend_ctx)
assert cmac._backend is backend
assert cmac.copy()._backend is backend
示例3: test_copy
# 需要导入模块: from cryptography.hazmat.primitives.cmac import CMAC [as 别名]
# 或者: from cryptography.hazmat.primitives.cmac.CMAC import copy [as 别名]
def test_copy():
@utils.register_interface(CMACBackend)
class PretendBackend(object):
pass
pretend_backend = PretendBackend()
copied_ctx = pretend.stub()
pretend_ctx = pretend.stub(copy=lambda: copied_ctx)
key = b"2b7e151628aed2a6abf7158809cf4f3c"
cmac = CMAC(AES(key), backend=pretend_backend, ctx=pretend_ctx)
assert cmac._backend is pretend_backend
assert cmac.copy()._backend is pretend_backend
示例4: test_copy_with_backend
# 需要导入模块: from cryptography.hazmat.primitives.cmac import CMAC [as 别名]
# 或者: from cryptography.hazmat.primitives.cmac.CMAC import copy [as 别名]
def test_copy_with_backend(self, backend):
key = b"2b7e151628aed2a6abf7158809cf4f3c"
cmac = CMAC(AES(key), backend)
cmac.update(b"6bc1bee22e409f96e93d7e117393172a")
copy_cmac = cmac.copy()
assert cmac.finalize() == copy_cmac.finalize()