本文整理匯總了Python中cryptography.hazmat.bindings._openssl.lib.Cryptography_STATIC_CALLBACKS方法的典型用法代碼示例。如果您正苦於以下問題:Python lib.Cryptography_STATIC_CALLBACKS方法的具體用法?Python lib.Cryptography_STATIC_CALLBACKS怎麽用?Python lib.Cryptography_STATIC_CALLBACKS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cryptography.hazmat.bindings._openssl.lib
的用法示例。
在下文中一共展示了lib.Cryptography_STATIC_CALLBACKS方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ffi_callback
# 需要導入模塊: from cryptography.hazmat.bindings._openssl import lib [as 別名]
# 或者: from cryptography.hazmat.bindings._openssl.lib import Cryptography_STATIC_CALLBACKS [as 別名]
def ffi_callback(signature, name, **kwargs):
"""Callback dispatcher
The ffi_callback() dispatcher keeps callbacks compatible between dynamic
and static callbacks.
"""
def wrapper(func):
if lib.Cryptography_STATIC_CALLBACKS:
# def_extern() returns a decorator that sets the internal
# function pointer and returns the original function unmodified.
ffi.def_extern(name=name, **kwargs)(func)
callback = getattr(lib, name)
else:
# callback() wraps the function in a cdata function.
callback = ffi.callback(signature, **kwargs)(func)
return callback
return wrapper