| 1 |
import enum |
| 2 |
from typing import Any |
| 3 |
|
| 4 |
CERT_NONE = 0 |
| 5 |
|
| 6 |
|
| 7 |
class TLSVersion(enum.IntEnum): |
| 8 |
TLSv1_2 = 12 |
| 9 |
|
| 10 |
|
| 11 |
class WantReadException(Exception): |
| 12 |
pass |
| 13 |
|
| 14 |
|
| 15 |
class WantWriteException(Exception): |
| 16 |
pass |
| 17 |
|
| 18 |
|
| 19 |
class SSLWantReadError(Exception): |
| 20 |
pass |
| 21 |
|
| 22 |
|
| 23 |
class SSLWantWriteError(Exception): |
| 24 |
pass |
| 25 |
|
| 26 |
|
| 27 |
class SSLContext: |
| 28 |
def __init__(self) -> None: |
| 29 |
self.minimum_version: Any = TLSVersion.TLSv1_2 |
| 30 |
self.check_hostname: bool = False |
| 31 |
self.verify_mode: int = CERT_NONE |
| 32 |
|
| 33 |
def wrap_socket(self, *args, **kwargs) -> "SSLSocket": # type: ignore |
| 34 |
raise Exception("no ssl support") # pylint: disable=broad-exception-raised |
| 35 |
|
| 36 |
def set_alpn_protocols(self, *args, **kwargs): # type: ignore |
| 37 |
raise Exception("no ssl support") # pylint: disable=broad-exception-raised |
| 38 |
|
| 39 |
|
| 40 |
class SSLSocket: |
| 41 |
def pending(self) -> bool: |
| 42 |
raise Exception("no ssl support") # pylint: disable=broad-exception-raised |
| 43 |
|
| 44 |
def do_handshake(self) -> None: |
| 45 |
raise Exception("no ssl support") # pylint: disable=broad-exception-raised |
| 46 |
|
| 47 |
def settimeout(self, value: Any) -> None: |
| 48 |
pass |
| 49 |
|
| 50 |
def getpeercert(self) -> Any: |
| 51 |
raise Exception("no ssl support") # pylint: disable=broad-exception-raised |
| 52 |
|
| 53 |
def __enter__(self): |
| 54 |
return self |
| 55 |
|
| 56 |
def __exit__(self, exc_type, exc_val, exc_tb): |
| 57 |
return False |
| 58 |
|
| 59 |
|
| 60 |
def create_default_context(*args, **kwargs) -> SSLContext: # type: ignore |
| 61 |
raise Exception("no ssl support") # pylint: disable=broad-exception-raised |