本文整理匯總了Python中cryptography.hazmat.bindings._openssl.ffi.string方法的典型用法代碼示例。如果您正苦於以下問題:Python ffi.string方法的具體用法?Python ffi.string怎麽用?Python ffi.string使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cryptography.hazmat.bindings._openssl.ffi
的用法示例。
在下文中一共展示了ffi.string方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _openssl_assert
# 需要導入模塊: from cryptography.hazmat.bindings._openssl import ffi [as 別名]
# 或者: from cryptography.hazmat.bindings._openssl.ffi import string [as 別名]
def _openssl_assert(lib, ok):
if not ok:
errors = _consume_errors(lib)
errors_with_text = []
for err in errors:
err_text_reason = ffi.string(
lib.ERR_error_string(err.code, ffi.NULL)
)
errors_with_text.append(
_OpenSSLErrorWithText(
err.code, err.lib, err.func, err.reason, err_text_reason
)
)
raise InternalError(
"Unknown OpenSSL error. This error is commonly encountered when "
"another library is not cleaning up the OpenSSL error stack. If "
"you are using cryptography with another library that uses "
"OpenSSL try disabling it before reporting a bug. Otherwise "
"please file an issue at https://github.com/pyca/cryptography/"
"issues with information on how to reproduce "
"this. ({0!r})".format(errors_with_text),
errors_with_text
)