moving to scripts
This commit is contained in:
2505
asq-env/lib/python3.9/site-packages/OpenSSL/SSL.py
Normal file
2505
asq-env/lib/python3.9/site-packages/OpenSSL/SSL.py
Normal file
File diff suppressed because it is too large
Load Diff
32
asq-env/lib/python3.9/site-packages/OpenSSL/__init__.py
Normal file
32
asq-env/lib/python3.9/site-packages/OpenSSL/__init__.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# Copyright (C) AB Strakt
|
||||
# See LICENSE for details.
|
||||
|
||||
"""
|
||||
pyOpenSSL - A simple wrapper around the OpenSSL library
|
||||
"""
|
||||
|
||||
from OpenSSL import crypto, SSL
|
||||
from OpenSSL.version import (
|
||||
__author__,
|
||||
__copyright__,
|
||||
__email__,
|
||||
__license__,
|
||||
__summary__,
|
||||
__title__,
|
||||
__uri__,
|
||||
__version__,
|
||||
)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"SSL",
|
||||
"crypto",
|
||||
"__author__",
|
||||
"__copyright__",
|
||||
"__email__",
|
||||
"__license__",
|
||||
"__summary__",
|
||||
"__title__",
|
||||
"__uri__",
|
||||
"__version__",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
155
asq-env/lib/python3.9/site-packages/OpenSSL/_util.py
Normal file
155
asq-env/lib/python3.9/site-packages/OpenSSL/_util.py
Normal file
@@ -0,0 +1,155 @@
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
from six import PY2, text_type
|
||||
|
||||
from cryptography.hazmat.bindings.openssl.binding import Binding
|
||||
|
||||
|
||||
binding = Binding()
|
||||
binding.init_static_locks()
|
||||
ffi = binding.ffi
|
||||
lib = binding.lib
|
||||
|
||||
|
||||
# This is a special CFFI allocator that does not bother to zero its memory
|
||||
# after allocation. This has vastly better performance on large allocations and
|
||||
# so should be used whenever we don't need the memory zeroed out.
|
||||
no_zero_allocator = ffi.new_allocator(should_clear_after_alloc=False)
|
||||
|
||||
|
||||
def text(charp):
|
||||
"""
|
||||
Get a native string type representing of the given CFFI ``char*`` object.
|
||||
|
||||
:param charp: A C-style string represented using CFFI.
|
||||
|
||||
:return: :class:`str`
|
||||
"""
|
||||
if not charp:
|
||||
return ""
|
||||
return native(ffi.string(charp))
|
||||
|
||||
|
||||
def exception_from_error_queue(exception_type):
|
||||
"""
|
||||
Convert an OpenSSL library failure into a Python exception.
|
||||
|
||||
When a call to the native OpenSSL library fails, this is usually signalled
|
||||
by the return value, and an error code is stored in an error queue
|
||||
associated with the current thread. The err library provides functions to
|
||||
obtain these error codes and textual error messages.
|
||||
"""
|
||||
errors = []
|
||||
|
||||
while True:
|
||||
error = lib.ERR_get_error()
|
||||
if error == 0:
|
||||
break
|
||||
errors.append(
|
||||
(
|
||||
text(lib.ERR_lib_error_string(error)),
|
||||
text(lib.ERR_func_error_string(error)),
|
||||
text(lib.ERR_reason_error_string(error)),
|
||||
)
|
||||
)
|
||||
|
||||
raise exception_type(errors)
|
||||
|
||||
|
||||
def make_assert(error):
|
||||
"""
|
||||
Create an assert function that uses :func:`exception_from_error_queue` to
|
||||
raise an exception wrapped by *error*.
|
||||
"""
|
||||
|
||||
def openssl_assert(ok):
|
||||
"""
|
||||
If *ok* is not True, retrieve the error from OpenSSL and raise it.
|
||||
"""
|
||||
if ok is not True:
|
||||
exception_from_error_queue(error)
|
||||
|
||||
return openssl_assert
|
||||
|
||||
|
||||
def native(s):
|
||||
"""
|
||||
Convert :py:class:`bytes` or :py:class:`unicode` to the native
|
||||
:py:class:`str` type, using UTF-8 encoding if conversion is necessary.
|
||||
|
||||
:raise UnicodeError: The input string is not UTF-8 decodeable.
|
||||
|
||||
:raise TypeError: The input is neither :py:class:`bytes` nor
|
||||
:py:class:`unicode`.
|
||||
"""
|
||||
if not isinstance(s, (bytes, text_type)):
|
||||
raise TypeError("%r is neither bytes nor unicode" % s)
|
||||
if PY2:
|
||||
if isinstance(s, text_type):
|
||||
return s.encode("utf-8")
|
||||
else:
|
||||
if isinstance(s, bytes):
|
||||
return s.decode("utf-8")
|
||||
return s
|
||||
|
||||
|
||||
def path_string(s):
|
||||
"""
|
||||
Convert a Python string to a :py:class:`bytes` string identifying the same
|
||||
path and which can be passed into an OpenSSL API accepting a filename.
|
||||
|
||||
:param s: An instance of :py:class:`bytes` or :py:class:`unicode`.
|
||||
|
||||
:return: An instance of :py:class:`bytes`.
|
||||
"""
|
||||
if isinstance(s, bytes):
|
||||
return s
|
||||
elif isinstance(s, text_type):
|
||||
return s.encode(sys.getfilesystemencoding())
|
||||
else:
|
||||
raise TypeError("Path must be represented as bytes or unicode string")
|
||||
|
||||
|
||||
if PY2:
|
||||
|
||||
def byte_string(s):
|
||||
return s
|
||||
|
||||
|
||||
else:
|
||||
|
||||
def byte_string(s):
|
||||
return s.encode("charmap")
|
||||
|
||||
|
||||
# A marker object to observe whether some optional arguments are passed any
|
||||
# value or not.
|
||||
UNSPECIFIED = object()
|
||||
|
||||
_TEXT_WARNING = (
|
||||
text_type.__name__ + " for {0} is no longer accepted, use bytes"
|
||||
)
|
||||
|
||||
|
||||
def text_to_bytes_and_warn(label, obj):
|
||||
"""
|
||||
If ``obj`` is text, emit a warning that it should be bytes instead and try
|
||||
to convert it to bytes automatically.
|
||||
|
||||
:param str label: The name of the parameter from which ``obj`` was taken
|
||||
(so a developer can easily find the source of the problem and correct
|
||||
it).
|
||||
|
||||
:return: If ``obj`` is the text string type, a ``bytes`` object giving the
|
||||
UTF-8 encoding of that text is returned. Otherwise, ``obj`` itself is
|
||||
returned.
|
||||
"""
|
||||
if isinstance(obj, text_type):
|
||||
warnings.warn(
|
||||
_TEXT_WARNING.format(label),
|
||||
category=DeprecationWarning,
|
||||
stacklevel=3,
|
||||
)
|
||||
return obj.encode("utf-8")
|
||||
return obj
|
||||
3288
asq-env/lib/python3.9/site-packages/OpenSSL/crypto.py
Normal file
3288
asq-env/lib/python3.9/site-packages/OpenSSL/crypto.py
Normal file
File diff suppressed because it is too large
Load Diff
42
asq-env/lib/python3.9/site-packages/OpenSSL/debug.py
Normal file
42
asq-env/lib/python3.9/site-packages/OpenSSL/debug.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import ssl
|
||||
import sys
|
||||
|
||||
import OpenSSL.SSL
|
||||
import cffi
|
||||
import cryptography
|
||||
|
||||
from . import version
|
||||
|
||||
|
||||
_env_info = u"""\
|
||||
pyOpenSSL: {pyopenssl}
|
||||
cryptography: {cryptography}
|
||||
cffi: {cffi}
|
||||
cryptography's compiled against OpenSSL: {crypto_openssl_compile}
|
||||
cryptography's linked OpenSSL: {crypto_openssl_link}
|
||||
Python's OpenSSL: {python_openssl}
|
||||
Python executable: {python}
|
||||
Python version: {python_version}
|
||||
Platform: {platform}
|
||||
sys.path: {sys_path}""".format(
|
||||
pyopenssl=version.__version__,
|
||||
crypto_openssl_compile=OpenSSL._util.ffi.string(
|
||||
OpenSSL._util.lib.OPENSSL_VERSION_TEXT,
|
||||
).decode("ascii"),
|
||||
crypto_openssl_link=OpenSSL.SSL.SSLeay_version(
|
||||
OpenSSL.SSL.SSLEAY_VERSION
|
||||
).decode("ascii"),
|
||||
python_openssl=getattr(ssl, "OPENSSL_VERSION", "n/a"),
|
||||
cryptography=cryptography.__version__,
|
||||
cffi=cffi.__version__,
|
||||
python=sys.executable,
|
||||
python_version=sys.version,
|
||||
platform=sys.platform,
|
||||
sys_path=sys.path,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(_env_info)
|
||||
40
asq-env/lib/python3.9/site-packages/OpenSSL/rand.py
Normal file
40
asq-env/lib/python3.9/site-packages/OpenSSL/rand.py
Normal file
@@ -0,0 +1,40 @@
|
||||
"""
|
||||
PRNG management routines, thin wrappers.
|
||||
"""
|
||||
|
||||
from OpenSSL._util import lib as _lib
|
||||
|
||||
|
||||
def add(buffer, entropy):
|
||||
"""
|
||||
Mix bytes from *string* into the PRNG state.
|
||||
|
||||
The *entropy* argument is (the lower bound of) an estimate of how much
|
||||
randomness is contained in *string*, measured in bytes.
|
||||
|
||||
For more information, see e.g. :rfc:`1750`.
|
||||
|
||||
This function is only relevant if you are forking Python processes and
|
||||
need to reseed the CSPRNG after fork.
|
||||
|
||||
:param buffer: Buffer with random data.
|
||||
:param entropy: The entropy (in bytes) measurement of the buffer.
|
||||
|
||||
:return: :obj:`None`
|
||||
"""
|
||||
if not isinstance(buffer, bytes):
|
||||
raise TypeError("buffer must be a byte string")
|
||||
|
||||
if not isinstance(entropy, int):
|
||||
raise TypeError("entropy must be an integer")
|
||||
|
||||
_lib.RAND_add(buffer, len(buffer), entropy)
|
||||
|
||||
|
||||
def status():
|
||||
"""
|
||||
Check whether the PRNG has been seeded with enough data.
|
||||
|
||||
:return: 1 if the PRNG is seeded enough, 0 otherwise.
|
||||
"""
|
||||
return _lib.RAND_status()
|
||||
28
asq-env/lib/python3.9/site-packages/OpenSSL/version.py
Normal file
28
asq-env/lib/python3.9/site-packages/OpenSSL/version.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# Copyright (C) AB Strakt
|
||||
# Copyright (C) Jean-Paul Calderone
|
||||
# See LICENSE for details.
|
||||
|
||||
"""
|
||||
pyOpenSSL - A simple wrapper around the OpenSSL library
|
||||
"""
|
||||
|
||||
__all__ = [
|
||||
"__author__",
|
||||
"__copyright__",
|
||||
"__email__",
|
||||
"__license__",
|
||||
"__summary__",
|
||||
"__title__",
|
||||
"__uri__",
|
||||
"__version__",
|
||||
]
|
||||
|
||||
__version__ = "21.0.0"
|
||||
|
||||
__title__ = "pyOpenSSL"
|
||||
__uri__ = "https://pyopenssl.org/"
|
||||
__summary__ = "Python wrapper module around the OpenSSL library"
|
||||
__author__ = "The pyOpenSSL developers"
|
||||
__email__ = "cryptography-dev@python.org"
|
||||
__license__ = "Apache License, Version 2.0"
|
||||
__copyright__ = "Copyright 2001-2020 {0}".format(__author__)
|
||||
Reference in New Issue
Block a user