1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
import numbers
import typing as t
from collections.abc import MutableSet
from enum import IntEnum
if t.TYPE_CHECKING:
from gssapi.raw.oids import OID
class NameType:
"""
GSSAPI Name Types
This enum-like object represents GSSAPI name
types (to be used with :func:`~gssapi.raw.names.import_name`, etc)
"""
#: GSS_C_NT_ANONYMOUS 1.3.6.1.5.6.3
anonymous: "OID" = ...
#: GSS_C_NT_EXPORT_NAME 1.3.6.1.5.6.4
export: "OID" = ...
#: GSS_C_NT_HOSTBASED_SERVICE 1.2.840.113554.1.2.1.4
hostbased_service: "OID" = ...
#: GSS_C_NT_MACHINE_UID_NAME 1.2.840.113554.1.2.1.2
machine_uid: "OID" = ...
#: GSS_C_NT_STRING_UID_NAME 1.2.840.113554.1.2.1.3
string_uid: "OID" = ...
#: GSS_C_NT_USER_NAME 1.2.840.113554.1.2.1.1
user: "OID" = ...
# Provided through optional extensions
#: GSS_C_NT_COMPOSITE_EXPORT 1.3.6.1.5.6.6
composite_export: "OID" = ...
#: GSS_KRB5_NT_PRINCIPAL_NAME 1.2.840.113554.1.2.2.1
kerberos_principal: "OID" = ...
#: GSS_KRB5_NT_PRINCIPAL_NAME 1.2.840.113554.1.2.2.1
krb5_nt_principal_name: "OID" = ...
class RequirementFlag(IntEnum):
"""
GSSAPI Requirement Flags
This :class:`~enum.IntEnum` represents flags used with the
:class:`~gssapi.raw.sec_contexts.SecurityContext`-related methods (e.g.
:func:`~gssapi.raw.sec_contexts.init_sec_context`)
The numbers behind the values correspond directly
to their C counterparts.
"""
# Note the values are only set here for documentation and type hints
delegate_to_peer = 1 #: GSS_C_DELEG_FLAG
mutual_authentication = 2 #: GSS_C_MUTUAL_FLAG
replay_detection = 4 #: GSS_C_REPLAY_FLAG
out_of_sequence_detection = 8 #: GSS_C_SEQUENCE_FLAG
confidentiality = 16 #: GSS_C_CONF_FLAG
integrity = 32 #: GSS_C_INTEG_FLAG
anonymity = 64 #: GSS_C_ANON_FLAG
protection_ready = 128 #: GSS_C_PROT_READY_FLAG
transferable = 256 #: GSS_C_TRANS_FLAG
channel_bound = 2048 #: GSS_C_CHANNEL_BOUND_FLAG
dce_style = 4096 #: GSS_C_DCE_STYLE
identify = 8192 #: GSS_C_IDENTIFY_FLAG
extended_error = 16384 #: GSS_C_EXTENDED_ERROR_FLAG
ok_as_delegate = 32768 #: GSS_C_DELEG_POLICY_FLAG
class AddressType(IntEnum):
"""
GSSAPI Channel Bindings Address Types
This :class:`~enum.IntEnum` represents the various address
types used with the :class:`~gssapi.raw.chan_bindings.ChannelBindings`
structure.
The numbers behind the values correspond directly
to their C counterparts. There is no value for
``GSS_C_AF_UNSPEC``, since this is represented
by ``None``.
"""
# Note the values are only set here for documentation and type hints
local = 1 #: GSS_C_AF_LOCAL
ip = 2 #: GSS_C_AF_INET
arpanet = 3 #: GSS_C_AF_IMPLINK
pup = 4 #: GSS_C_AF_PUP
chaos = 5 #: GSS_C_AF_CHAOS
xerox_ns = 6 #: GSS_C_AF_NS
nbs = 7 #: GSS_C_AF_NBS
ecma = 8 #: GSS_C_AF_ECMA
datakit = 9 #: GSS_C_AF_DATAKIT
ccitt = 10 #: GSS_C_AF_CCITT
ibm_sna = 11 #: GSS_C_AF_SNA
decnet = 12 #: GSS_C_AF_DECnet
dli = 13 #: GSS_C_AF_DLI
lat = 14 #: GSS_C_AF_LAT
hyperchannel = 15 #: GSS_C_AF_HYLINK
appletalk = 16 #: GSS_C_AF_APPLETALK
bisync = 17 #: GSS_C_AF_BSC
dss = 18 #: GSS_C_AF_DSS
osi_tp4 = 19 #: GSS_C_AF_OSI
x25 = 21 #: GSS_C_AF_X25
null = 255 #: GSS_C_AF_NULLADDR
class MechType:
"""
GSSAPI Mechanism Types
This enum-like object contains any mechanism :class:`~gssapi.raw.oids.OID`
values registered by imported mechanisms.
"""
kerberos: "OID" #: gss_mech_krb5 1.2.840.113554.1.2.2
class GenericFlagSet(MutableSet):
"""A set backed by a 32-bit integer
This is a set backed by a 32 bit integer.
the members are integers where only one
bit is set.
The class supports normal set operations,
as well as traditional "flag set" operations,
such as bitwise AND, OR, and XOR.
"""
MAX_VAL: int
def __init__(
self,
flags: t.Optional[
t.Union[GenericFlagSet, numbers.Integral, int]
] = None,
) -> None: ...
def __contains__(
self,
flag: object,
) -> bool: ...
def __iter__(self) -> t.Iterator[int]: ...
def __len__(self) -> int: ...
def add(
self,
flag: int,
) -> None: ...
def discard(
self,
flag: int,
) -> None: ...
class IntEnumFlagSet(GenericFlagSet):
"""A set backed by a 32-bit integer with enum members
This class is a :class:`GenericFlagSet` where the returned
members are values in an :class:`~enum.IntEnum`.
It functions exactly like a `GenericFlagSet`, except that
it also supports bitwise operations with the enum values.
"""
def __init__(
self,
enum: t.Type[IntEnum],
flags: t.Optional[
t.Union[GenericFlagSet, numbers.Integral, int]
] = None,
) -> None: ...
def __iter__(self) -> t.Iterator[IntEnum]: ...
|