The low-level API contains a variety of Python functions that map directly to the corresponding C functions. Additionally, it contains several basic wrapper classes that wrap underlying C structs and automatically deallocate them when the Python object itself is deallocated.
Warning
All methods in both the high-level and low-level APIs may throw the generic GSSError exception.
Core RFC 2744 NamesNote
Some functions in the following section will refer to “mechanism names”. These are not names of mechanisms. Instead, they are a special form of name specific to a given mechanism.
A GSSAPI Name
Convert a string and a name type into a GSSAPI name.
This method takes a string name and a name type and converts them into a GSSAPI Name
.
the GSSAPI version of the name
Convert a GSSAPI name into its components.
This method converts a GSSAPI Name
back into its text form. If name_type
is True, it also attempts to retrieve the NameType
of the name (otherwise the returned name type will be None
).
the text part of the name and its type
Check two GSSAPI names to see if they are the same.
This method compares two GSSAPI names, checking to see if they are equivalent.
whether or not the names are equal
Export a GSSAPI name.
This method “produces a canonical contigous string representation of a mechanism name, suitable for direct comparison for use in authorization functions”.
The input name must be a valid GSSAPI mechanism name, as generated by canonicalize_name()
or accept_sec_context()
.
name (Name) – the name to export
the exported name
Canonicalize an arbitrary GSSAPI Name into a Mechanism Name
This method turns any GSSAPI name into a “mechanism name” – a full form name specific to a mechanism.
a canonicalized version of the input name
Duplicate a GSSAPI name.
name (Name) – the name to duplicate
a duplicate of the input name
Release a GSSAPI name.
This method frees a GSSAPI Name
. You probably won’t have to do this.
Warning
This method is deprecated. Names are automatically freed by Python.
name (Name) – the name in question
GSSAPI Credentials
Get GSSAPI credentials for the given name and mechanisms.
This method gets GSSAPI credentials corresponding to the given name and mechanims. The desired TTL and usage for the the credential may also be specified.
name (Name) – the name for which to acquire the credentials (or None for the “no name” functionality)
lifetime (int) – the lifetime in seconds for the credentials (or None for indefinite)
mechs (MechType) – the desired mechanisms for which the credentials should work, or None for the default set
usage (str) – the usage type for the credentials: may be ‘initiate’, ‘accept’, or ‘both’
the resulting credentials, the actual mechanisms with which they may be used, and their actual lifetime in seconds (or None for indefinite or not supported)
release_cred(creds) Release GSSAPI Credentials.
This method releases GSSAPI credentials.
Warning
This method is deprecated. Credentials are automatically freed by Python.
creds (Creds) – the credentials in question
Add a credential element to a credential.
This method can be used to either compose two credentials (i.e., original and new credential), or to add a new element to an existing credential.
input_cred (Creds) – the set of credentials to which to add the new credentials
name (Name) – name of principal to acquire a credential for
mech (MechType) – the desired security mechanism (required).
usage (str) – usage type for credentials. Possible values: ‘initiate’ (default), ‘accept’, ‘both’ (failsafe).
init_lifetime (int) – lifetime of credentials for use in initiating security contexts in seconds (None for indefinite)
accept_lifetime (int) – lifetime of credentials for use in accepting security contexts in seconds (None for indefinite)
mutate_input (bool) – whether to mutate the input credentials (True) or produce a new set of credentials (False). Defaults to False
the actual mechanisms with which the credentials may be used, the actual initiator TTL, and the actual acceptor TTL (None for either indefinite or not supported). Note that the credentials may be set to None if mutate_input is set to True.
Inspect credentials for information.
This method inspects a Creds
object for information.
the information about the credentials, with unused fields set to None
Inspect credentials for mechanism-specific information.
This method inspects a Creds
object for information specific to a particular mechanism. It functions similarly to inquire_cred()
.
creds (Creds) – the credentials to inspect
mech (OID) – the desired mechanism
name (bool) – get the Name associated with the credentials
init_lifetime (bool) – get the initiator TTL for the credentials (in seconds)
accept_lifetime (bool) – get the acceptor TTL for the credentials (in seconds)
usage (bool) – get the usage type of the credentials
the information about the credentials, with unused fields set to None
A GSSAPI Security Context
Initiate a GSSAPI security context.
This method initiates a GSSAPI security context, targeting the given target name. To create a basic context, just provide the target name. Further calls used to update the context should pass in the output context of the last call, as well as the input token received from the acceptor.
Warning
This changes the input context!
target_name (Name) – the target for the security context
creds (Creds) – the credentials to use to initiate the context, or None to use the default credentials
context (SecurityContext) – the security context to update, or None to create a new context
mech (MechType) – the mechanism type for this security context, or None for the default mechanism type
flags (list) – the flags to request for the security context, or None to use the default set: mutual_authentication and out_of_sequence_detection. This may also be an IntEnumFlagSet
lifetime (int) – the request lifetime of the security context in seconds (a value of 0 or None means indefinite)
channel_bindings (ChannelBindings) – The channel bindings (or None for no channel bindings)
input_token (bytes) – the token to use to update the security context, or None if you are creating a new context
the output security context, the actual mech type, the actual flags used, the output token to send to the acceptor, the actual lifetime of the context in seconds (or None if not supported or indefinite), and whether or not more calls are needed to finish the initiation.
Accept a GSSAPI security context.
This method accepts a GSSAPI security context using a token sent by the initiator, using the given credentials. It can either be used to accept a security context and create a new security context object, or to update an existing security context object.
Warning
This changes the input context!
input_token (bytes) – the token sent by the context initiator
acceptor_creds (Creds) – the credentials to be used to accept the context (or None to use the default credentials)
context (SecurityContext) – the security context to update (or None to create a new security context object)
channel_bindings (ChannelBindings) – The channel bindings (or None for no channel bindings)
the resulting security context, the initiator name, the mechanism being used, the output token, the flags in use, the lifetime of the context in seconds (or None for indefinite or not supported), the delegated credentials (valid only if the delegate_to_peer flag is set), and whether or not further token exchanges are needed to finalize the security context.
Get information about a security context.
This method obtains information about a security context, including the initiator and target names, as well as the TTL, mech, flags, and its current state (open vs closed).
Note
the target name may be None
if it would have been GSS_C_NO_NAME
context (SecurityContext) – the context in question
the initiator name, the target name, the TTL (can be None for indefinite or not supported), the mech type, the flags, whether or not the context was locally initiated, and whether or not the context is currently fully established
Get the amount of time for which the given context will remain valid.
This method determines the amount of time for which the given security context will remain valid. An expired context will give a result of 0.
context (SecurityContext) – the security context in question
the number of seconds for which the context will be valid
Process a token asynchronously.
This method provides a way to process a token, even if the given security context is not expecting one. For example, if the initiator has the initSecContext return that the context is complete, but the acceptor is unable to accept the context, and wishes to send a token to the initiator, letting the initiator know of the error.
Warning
This method has been essentially deprecated by RFC 2744.
context (SecurityContext) – the security context against which to process the token
token (bytes) – the token to process
Import a context from another process.
This method imports a security context established in another process by reading the specified token which was output by export_sec_context()
.
Export a context for use in another process.
This method exports a security context, deactivating in the current process and creating a token which can then be imported into another process with import_sec_context()
.
Warning: this modifies the input context
context (SecurityContext) – the context to send to another process
the output token to be imported
Delete a GSSAPI security context.
This method deletes a GSSAPI security context, returning an output token to send to the other holder of the security context to notify them of the deletion.
Note
This method generally should not be used. SecurityContext
objects will automatically be freed by Python.
context (SecurityContext) – the security context in question
local_only (bool) – should we request local deletion (True), or also remote deletion (False), in which case a token is also returned
this is None, but bytes for compatibility.
Generate a MIC for a message.
This method generates a Message Integrity Check token for the given message. This can be separately trasmitted to the other entity, unlike wrap, which bundles the MIC and the message together.
context (SecurityContext) – the current security context
message (bytes) – the message for which to generate the MIC
qop (int) – the requested Quality of Protection (or None to use the default)
the generated MIC token
Verify that a MIC matches a message.
This method verifies that the given MIC matches the given message. If the MIC does not match the given message, an exception will be raised.
context (SecurityContext) – the current security context
message (bytes) – the message in question
token (bytes) – the MIC token in question
the QoP used.
Calculate the max message size.
This method calculates the unwrapped/unencrypted message size for the given maximum wrapped/encrypted message size.
context (SecurityContext) – the current security context
output_size (int) – the maximum desired wrapped/encrypted message size
confidential (bool) – whether or not confidentiality is being used
qop (int) – the QoP that will be when you actually call wrap (or None for the default QoP)
the maximum unencrypted/unwrapped message size
Wrap/Encrypt a message.
This method wraps or encrypts a message (depending on the value of confidential) with the given Quality of Protection.
context (SecurityContext) – the current security context
message (bytes) – the message to wrap or encrypt
confidential (bool) – whether or not to encrypt the message (True), or just wrap it with a MIC (False)
qop (int) – the desired Quality of Protection (or None for the default QoP)
encryption was actually used
Unwrap/Decrypt a message.
This method unwraps or decrypts a message, depending on whether the sender used confidentiality.
context (SecurityContext) – the current security context
message (bytes) – the message to unwrap/decrypt
encryption was used, and the QoP used
A GSSAPI OID
A new OID may be created by passing the elements argument to the constructor. The elements argument should be a bytes
consisting of the BER-encoded values in the OID.
To retrieve the underlying bytes, use the bytes
function in Python 3.
This object is hashable, and may be compared using equality operators.
Create a OID from a sequence of integers.
This method creates an OID from a sequence of integers. The sequence can either be in dotted form as a string, or in list form.
This method is not for BER-encoded byte strings, which can be passed directly to the OID constructor.
integer_sequence – either a list of integers or a string in dotted form
the OID represented by the given integer sequence
ValueError – the sequence is less than two elements long
A GSSAPI Name
A GSSAPI OID
A new OID may be created by passing the elements argument to the constructor. The elements argument should be a bytes
consisting of the BER-encoded values in the OID.
To retrieve the underlying bytes, use the bytes
function in Python 3.
This object is hashable, and may be compared using equality operators.
Create a OID from a sequence of integers.
This method creates an OID from a sequence of integers. The sequence can either be in dotted form as a string, or in list form.
This method is not for BER-encoded byte strings, which can be passed directly to the OID constructor.
integer_sequence – either a list of integers or a string in dotted form
the OID represented by the given integer sequence
ValueError – the sequence is less than two elements long
GSSAPI Mechanism Types
This enum-like object contains any mechanism OID
values registered by imported mechanisms.
Get the currently supported mechanisms.
This method retrieves the currently supported GSSAPI mechanisms. Note that if unknown mechanims are found, those will be skipped.
inquire_names_for_mech(mech) Get the name types supported by a mechanism.
This method retrieves the different name types supported by the given mechanism.
inquire_mechs_for_name(name) List the mechanisms which can process a name.
This method lists the mechanisms which may be able to process the given name.
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Retrieve all messages for a status code.
This method retrieves all human-readable messages available for the given status code.
code – the status code in question
is_maj – whether this is a major status code (True) or minor status code (False)
given code
[str]
Retrieves all messages for this error’s status codes
This method retrieves all messages for this error’s status codes, and forms them into a string for use as an exception message
a string for use as this error’s message
GSSAPI Name Types
This enum-like object represents GSSAPI name types (to be used with import_name()
, etc)
GSSAPI Requirement Flags
This IntEnum
represents flags used with the SecurityContext
-related methods (e.g. init_sec_context()
)
The numbers behind the values correspond directly to their C counterparts.
GSSAPI Channel Bindings Address Types
This IntEnum
represents the various address types used with the 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
.
GSSAPI Mechanism Types
This enum-like object contains any mechanism OID
values registered by imported mechanisms.
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.
Add an element.
Remove an element. Do not raise an exception if absent.
A set backed by a 32-bit integer with enum members
This class is a GenericFlagSet
where the returned members are values in an IntEnum
.
It functions exactly like a GenericFlagSet, except that it also supports bitwise operations with the enum values.
GSSAPI Channel Bindings
This class represents a set of GSSAPI channel bindings.
initiator_address_type – the initiator address type
initiator_address – the initiator address
acceptor_address_type – the acceptor address type
acceptor_address – the acceptor address
application_data – additional application-specific data
The following is a list of GSSAPI extensions supported by the low-level API.
Note
While all of these extensions have bindings, they may not be supported by your particularly GSSAPI implementation. In this case, they will not be compiled, and will simply not be available in the gssapi.raw
namespace.
Specify the set of security mechanisms that may be negotiated with the credential identified by cred_handle. If more than one mechanism is specified in mech_set, the order in which those mechanisms are specified implies a relative preference.
Get a set of mechanisms that have the specified attributes.
a set of mechs which satisfy the given criteria
GSSError –
Gets the set of attrs supported and known by a mechanism.
Returns information about attributes in human readable form.
Store credentials into the default store.
This method stores the given credentials into the default store. They may then be retrieved later using acquire_cred()
.
creds (Creds) – the credentials to store
usage (str) – the usage to store the credentials with – either ‘both’, ‘initiate’, or ‘accept’
mech (OID) – the mechansim to associate with the stored credentials
overwrite (bool) – whether or not to overwrite existing credentials stored with the same name, etc
set_default (bool) – whether or not to set these credentials as the default credentials for the given store.
the results of the credential storing operation
Gets information about a specified mech, including the SASL name, the mech name, and the mech description.
Gets the OID for the mech specified by SASL name.
Credential Store Extension
Acquire credentials from the given store.
This method acquires credentials from the store specified by the given credential store information.
The credential store information is a dictionary containing mechanisms-specific keys and values pointing to a credential store or stores.
store (dict) – the credential store information pointing to the credential store from which to acquire the credentials. See Common Values for Credentials Store Extensions for valid values
name (Name) – the name associated with the credentials, or None for the default name
lifetime (int) – the desired lifetime of the credentials in seconds, or None for indefinite
mechs (list) – the desired mechanisms to be used with these credentials, or None for the default set
usage (str) – the usage for these credentials – either ‘both’, ‘initiate’, or ‘accept’
the acquired credentials and information about them
GSSError –
Acquire credentials to add to the current set from the given store.
This method works like acquire_cred_from()
, except that it adds the acquired credentials for a single mechanism to a copy of the current set, instead of creating a new set for multiple mechanisms. Unlike acquire_cred()
, you cannot pass None for the desired name or mechanism.
The credential store information is a dictionary containing mechanisms-specific keys and values pointing to a credential store or stores.
store (dict) – the store into which to store the credentials, or None for the default store. See Common Values for Credentials Store Extensions for valid values
name (Name) – the name associated with the credentials
mech (OID) – the desired mechanism to be used with these credentials
usage (str) – the usage for these credentials – either ‘both’, ‘initiate’, or ‘accept’
init_lifetime (int) – the desired initiate lifetime of the credentials in seconds, or None for indefinite
accept_lifetime (int) – the desired accept lifetime of the credentials in seconds, or None for indefinite
the new credentials set and information about it
GSSError –
Store credentials into the given store.
This method stores the given credentials into the store specified by the given store information. They may then be retrieved later using acquire_cred_from()
or add_cred_from()
.
The credential store information is a dictionary containing mechanisms-specific keys and values pointing to a credential store or stores.
store (dict) – the store into which to store the credentials, or None for the default store. See Common Values for Credentials Store Extensions for valid values
creds (Creds) – the credentials to store
usage (str) – the usage to store the credentials with – either ‘both’, ‘initiate’, or ‘accept’
mech (OID) – the mechansim to associate with the stored credentials
overwrite (bool) – whether or not to overwrite existing credentials stored with the same name, etc
set_default (bool) – whether or not to set these credentials as the default credentials for the given store.
the results of the credential storing operation
GSSError –
Display the given Name using the given name type.
This method attempts to display the given Name using the syntax of the given name type. If this is not possible, an appropriate error will be raised.
the displayed name
OperationUnavailableError – the given name could not be displayed using the given name type
Get information about a Name.
This method retrieves information about the given name, including the set of attribute names for the given name, as well as whether or not the name is a mechanism name. Additionally, if the given name is a mechanism name, the associated mechansim is returned as well.
the set of attribute names for the given name, whether or not the name is a Mechanism Name, and potentially the associated mechanism if it is a Mechanism Name
GSSError –
Set the value(s) of a name attribute.
This method sets the value(s) of the given attribute on the given name.
Note that this functionality more closely matches the pseudo-API presented in RFC 6680, not the C API (which uses multiple calls to add multiple values). However, multiple calls to this method will continue adding values, so delete_name_attribute()
must be used in between calls to “clear” the values.
OperationUnavailableError – the given attribute name is unknown or could not be set
Get the value(s) of a name attribute.
This method retrieves the value(s) of the given attribute for the given Name.
Note that this functionality matches pseudo-API presented in RFC 6680, not the C API (which uses a state variable and multiple calls to retrieve multiple values).
the raw version of the value(s), the human-readable version of the value(s), whether or not the attribute was authenticated, and whether or not the attribute’s value set was marked as complete
OperationUnavailableError – the given attribute is unknown or unset
Remove an attribute from a name.
This method removes an attribute from a Name. This method may be used before set_name_attribute()
clear the values of an attribute before setting a new value (making the latter method work like a ‘set’ operation instead of an ‘add’ operation).
Note that the removal of certain attributes may not be allowed.
Export a name, preserving attribute information.
This method functions similarly to export_name()
, except that it preserves attribute information. The resulting bytes may be imported using import_name()
with the composite_export
name type.
Note
Some versions of MIT Kerberos require you to either canonicalize a name once it has been imported with composite-export name type, or to import using the normal export name type.
Credentials Import/Export Extension
Export GSSAPI credentials.
This method exports GSSSAPI credentials into a token which may be transmitted between different processes.
Import GSSAPI credentials from a token.
This method imports a credentials object from a token previously exported by export_cred()
.
Wrap/Encrypt an AEAD message.
This method takes an input message and associated data, and outputs and AEAD message.
context (SecurityContext) – the current security context
message (bytes) – the message to wrap or encrypt
associated (bytes) – associated data to go with the message
confidential (bool) – whether or not to encrypt the message (True), or just wrap it with a MIC (False)
qop (int) – the desired Quality of Protection (or None for the default QoP)
the wrapped/encrypted total message, and whether or not encryption was actually used
GSSError –
Unwrap/Decrypt an AEAD message.
This method takes an encrpyted/wrapped AEAD message and some associated data, and returns an unwrapped/decrypted message.
context (SecurityContext) – the current security context
message (bytes) – the AEAD message to unwrap or decrypt
associated (bytes) – associated data that goes with the message
the unwrapped/decrypted message, whether or on encryption was used, and the QoP used
GSSError –
IOV Buffer Types
This IntEnum represent GSSAPI IOV buffer types to be used with the IOV methods.
The numbers behind the values correspond directly to their C counterparts.
A GSSAPI IOV
Wrap/Encrypt an IOV message.
This method wraps or encrypts an IOV message. The allocate parameter of the IOVBuffer
objects in the IOV
indicates whether or not that particular buffer should be automatically allocated (for use with padding, header, and trailer buffers).
Warning
This modifies the input IOV
.
context (SecurityContext) – the current security context
confidential (bool) – whether or not to encrypt the miovessage (True), or just wrap it with a MIC (False)
qop (int) – the desired Quality of Protection (or None for the default QoP)
whether or not confidentiality was actually used
GSSError –
Unwrap/Decrypt an IOV message.
This method uwraps or decrypts an IOV message. The allocate parameter of the IOVBuffer
objects in the IOV
indicates whether or not that particular buffer should be automatically allocated (for use with padding, header, and trailer buffers).
As a special case, you may pass an entire IOV message as a single ‘stream’. In this case, pass a buffer type of IOVBufferType.stream
followed by a buffer type of IOVBufferType.data
. The former should contain the entire IOV message, while the latter should be empty.
Warning
This modifies the input IOV
.
context (SecurityContext) – the current security context
whether or not confidentiality was used, and the QoP used.
GSSError –
Appropriately size padding, trailer, and header IOV buffers.
This method sets the length values on the IOV buffers. You should already have data provided for the data (and sign-only) buffer(s) so that padding lengths can be appropriately computed.
In Python terms, this will result in an appropriately sized bytes object consisting of all zeros.
Warning
This modifies the input IOV
.
context (SecurityContext) – the current security context
a list of :class:IOVBuffer` objects, and whether or not encryption was actually used
GSSError –
Generate MIC tokens for the given IOV message.
This method generates a MIC token for the given IOV message, and places it in the mic_token
buffer in the IOV. This method operates entirely in-place, and returns nothing.
Warning
This modifies the input IOV
.
context (SecurityContext) – the current security context
qop (int) – the desired Quality of Protection (or None for the default QoP)
None
GSSError –
Allocate space for the MIC buffer in the given IOV message.
This method allocates space for the MIC token buffer (mic_token
) in the given IOV message.
Warning
This modifies the input IOV
.
context (SecurityContext) – the current security context
qop (int) – the desired Quality of Protection (or None for the default QoP)
None
GSSError –
Verify that the MIC matches the data in the given IOV message.
This method verifies that the MIC token in the MIC buffer (mic_token
) match the data buffer(s) in the given IOV method.
context (SecurityContext) – the current security context
the QoP used to generate the MIC token
GSSError –
GGF Extensions
GGF provides extended credential and security context inquiry that allows application to retrieve more information about the client’s credentials and security context. One common use case is to use inquire_sec_context_by_oid()
to retrieve the “session” key that is required by the SMB protocol for signing and encrypting a message.
Draft IETF document for these extensions can be found at https://tools.ietf.org/html/draft-engert-ggf-gss-extensions-00
This method inspects a Creds
object for information specific to a particular desired aspect as an OID.
This method inspects a SecurityContext
object for information specific to a particular desired aspect as an OID.
This method can be used with the GSS_KRB5_INQ_SSPI_SESSION_KEY_OID OID to retrieve the required key that is used to derive the SMB/SAMBA signing and encryption keys.
context (SecurityContext) – the Security Context to query
desired_aspect (OID) – the desired aspect of the Security Context to inquire about.
A list of zero or more pieces of data (as bytes objects)
GSSError –
This method is used to set a value for a specific OID of a SecurityContext
object. The OID and value to pass in depends on the mech the SecurityContext backs.
An example of how this can be used would be to reset the NTLM crypto engine used in gss-ntlmssp. The OID that controls this value is ‘1.3.6.1.4.1.7165.655.1.3’ and it takes it a byte value that represents an int32 where 1 resets the verifier handle and any other int resets the sender handle.
desired_aspect (OID) – the desired aspect of the Security Context to set the value for.
context (SecurityContext) – the Security Context to set, or None to create a new context.
value (bytes) – the value to set on the desired aspect of the Security Context or None to send GSS_C_EMPTY_BUFFER.
The output security context.
GSSError –
Service4User Extension
Acquire credentials by impersonating another name.
This method is one of the ways to use S4U2Self. It acquires credentials by impersonating another name using a set of proxy credentials. The impersonator credentials must have a usage of ‘both’ or ‘initiate’.
impersonator_cred (Creds) – the credentials with permissions to impersonate the target name
name (Name) – the name to impersonate
lifetime (int) – the lifetime for the credentials (or None for indefinite) in seconds
mechs (MechType) – the desired mechanisms for which the credentials should work (or None for the default set)
usage (str) – the usage type for the credentials: may be ‘initiate’, ‘accept’, or ‘both’
the resulting credentials, the actual mechanisms with which they may be used, and their actual lifetime in seconds (or None for indefinite or not support)
GSSError –
Add a credentials element to a credential by impersonating another name.
This method is one of the ways to use S4U2Self. It adds credentials to the input credentials by impersonating another name using a set of proxy credentials. The impersonator credentials must have a usage of ‘both’ or ‘initiate’.
input_cred (Creds) – the set of credentials to which to add the new credentials
impersonator_cred (Creds) – the credentials with permissions to impersonate the target name
name (Name) – the name to impersonate
mech (MechType) – the desired mechanism. Note that this is both singular and required, unlike acquireCredImpersonateName
usage (str) – the usage type for the credentials: may be ‘initiate’, ‘accept’, or ‘both’
init_lifetime (int) – the lifetime, in seconds, for the credentials to remain valid when using them to initiate security contexts (or None for indefinite)
accept_lifetime (int) – the lifetime, in seconds, for the credentials to remain valid when using them to accept security contexts (or None for indefinite)
the actual mechanisms with which the credentials may be used, the actual initiator TTL in seconds, and the actual acceptor TTL in seconds (the TTLs may be None for indefinite or not supported)
GSSError –
Acquire credentials through provided password.
This function is originally from Solaris and is not documented by either MIT or Heimdal.
In general, it functions similarly to acquire_cred()
.
name (Name) – the name to acquire credentials for
password (bytes) – the password used to acquire credentialss with
lifetime (int) – the lifetime for the credentials in seconds (or None for indefinite)
mechs (MechType) – the desired mechanisms for which the credentials should work (or None for the default set)
usage (str) – usage type for credentials. Possible values: ‘initiate’ (default), ‘accept’, ‘both’ (failsafe).
the resulting credentials, the actual mechanisms with which they may be used, and their actual lifetime in seconds (or None for indefinite or not supported)
GSSError –
Add a credential-element to a credential using provided password.
This function is originally from Solaris and is not documented by either MIT or Heimdal.
In general, it functions similarly to add_cred()
.
input_cred (Creds) – the credentials to add to
name (Name) – the name to acquire credentials for
mech (MechType) – the desired mechanism. Note that this is both singular and required
password (bytes) – the password used to acquire credentialss with
usage (str) – the usage type for the credentials: may be ‘initiate’, ‘accept’, or ‘both’
init_lifetime (int) – the lifetime, in seconds, for the credentials to remain valid when using them to initiate security contexts (or None for indefinite)
accept_lifetime (int) – the lifetime, in seconds, for the credentials to remain valid when using them to accept security contexts (or None for indefinite)
the actual mechanisms with which the credentials may be used, the actual initiator TTL in seconds, and the actual acceptor TTL in seconds (the TTLs may be None for indefinite or not supported)
GSSError –
The base container returned by krb5_export_lucid_sec_context()
when an unknown version was requested.
Kerberos context data returned by krb5_export_lucid_sec_context()
when version 1 was requested.
The structure version number
the structure version number
Optional[int]
Whether the context was the initiator
True
when the exported context was the initiator
Optional[bool]
Expiration time of the context
the expiration time of the context
Optional[int]
Sender sequence number
the sender sequence number
Optional[int]
Receiver sequence number
the receiver sequence number
Optional[int]
The protocol number
If the protocol number is 0 then rfc1964_kd
is set and cfx_kd
is None. If the protocol number is 1 then the opposite is true.
Protocol 0 refers to RFC1964 and 1 refers to RFC4121.
the protocol number
Optional[int]
Keydata for protocol 0 (RFC1964)
This will be set when protocol
is 0
.
the RFC1964 key data
Optional[Rfc1964KeyData]
Key data for protocol 1 (RFC4121)
This will be set when protocol
is 1
.
the RFC4121 key data
Optional[CfxKeyData]
Set the default Kerberos Protocol credentials cache name.
This method sets the default credentials cache name for use by he Kerberos mechanism. The default credentials cache is used by acquire_cred()
to create a GSS-API credential. It is also used by init_sec_context()
when GSS_C_NO_CREDENTIAL is specified.
Note
Heimdal does not return the old name when called. It also does not reset the ccache lookup behaviour when setting to None
.
Note
The return value may not be thread safe.
Returns a non-opaque version of the internal context info.
Gets information about the Kerberos security context passed in. Currently only version 1 is known and supported by this library.
Note
The context handle must not be used again by the caller after this call.
context (SecurityContext) – the current security context
version (int) – the output structure version to export. Currently only 1 is supported.
the non-opaque version context info
GSSError –
Get the auth time for the security context.
Gets the auth time for the established security context.
Note
Heimdal can only get the authtime on the acceptor security context. MIT is able to get the authtime on both initiators and acceptors.
context (SecurityContext) – the current security context
the authtime
GSSError –
Extracts Kerberos authorization data.
Extracts authorization data that may be stored within the context.
Note
Only operates on acceptor contexts.
context (SecurityContext) – the current security context
ad_type (int) – the type of data to extract
the raw authz data from the sec context
GSSError –
Import Krb5 credentials into GSSAPI credential.
Imports the krb5 credentials (either or both of the keytab and cache) into the GSSAPI credential so it can be used within GSSAPI. The ccache is copied by reference and thus shared, so if the credential is destroyed, all users of cred_handle will fail.
cred_handle (Creds) – the credential handle to import into
cache (int) – the krb5_ccache address pointer, as an int, to import from
keytab_principal (int) – the krb5_principal address pointer, as an int, of the credential to import
keytab (int) – the krb5_keytab address pointer, as an int, of the keytab to import
None
GSSError –
Return ticket flags for the kerberos ticket.
Return the ticket flags for the kerberos ticket received when authenticating the initiator.
Note
Heimdal can only get the tkt flags on the acceptor security context. MIT is able to get the tkt flags on initiators and acceptors.
context (SecurityContext) – the security context
the ticket flags for the received kerberos ticket
GSSError –
Limits the keys that can be exported.
Called by a context initiator after acquiring the creds but before calling init_sec_context()
to restrict the set of enctypes which will be negotiated during context establisment to those in the provided list.
Warning
The cred_handle should not be GSS_C_NO_CREDENTIAL
.
gss_set_cred_option
Provides a way to set options on a credential based on the OID specified. A common use case is to set the GSS_KRB5_CRED_NO_CI_FLAGS_X on a Kerberos credential. This is used for interoperability with Microsoft’s SSPI.
Note this function is commonly lumped with the GGF extensions but they are not part of the GGF IETF draft so it’s separated into it’s own file.
Closest draft IETF document for the gss_set_cred_option can be found at https://tools.ietf.org/html/draft-williams-kitten-channel-bound-flag-01
This method is used to set options of a Creds
object based on an OID key. The options that can be set depends on the mech the credentials were created with.
An example of how this can be used would be to set the GSS_KRB5_CRED_NO_CI_FLAGS_X on a Kerberos credential. The OID string for this flag is ‘1.2.752.43.13.29’ and it requires no value to be set. This must be set before the SecurityContext was initialised with the credentials.
The output credential.
GSSError –
Credential result when acquiring a GSSAPI credential.
Create new instance of AcquireCredResult(creds, mechs, lifetime)
GSSAPI credentials that were acquired
Set of mechs the cred is for
Number of seconds for which the cred will remain valid
Information about the credential.
Create new instance of InquireCredResult(name, lifetime, usage, mechs)
The principal associated with the credential
Number of seconds which the cred is valid for
How the credential can be used
Set of mechs the cred is for
Information about the credential for a specific mechanism.
Create new instance of InquireCredByMechResult(name, init_lifetime, accept_lifetime, usage)
The principal associated with the credential
Time valid for initiation, in seconds
Time valid for accepting, in seconds
How the credential can be used
Result of adding to a GSSAPI credential.
Create new instance of AddCredResult(creds, mechs, init_lifetime, accept_lifetime)
The credential that was generated
Set of mechs the cred is for
Time valid for initiation, in seconds
Time valid for accepting, in seconds
Textual representation of a GSSAPI name.
Create new instance of DisplayNameResult(name, name_type)
The representation of the GSSAPI name
The type of GSSAPI name
Wrapped message result.
Create new instance of WrapResult(message, encrypted)
The wrapped message
Whether the message is encrypted and not just signed
Unwrapped message result.
Create new instance of UnwrapResult(message, encrypted, qop)
The unwrapped message
Whether the message was encrypted and not just signed
The quality of protection applied to the message
Result when accepting a security context by an initiator.
Create new instance of AcceptSecContextResult(context, initiator_name, mech, token, flags, lifetime, delegated_creds, more_steps)
The acceptor security context
The authenticated name of the initiator
Mechanism with which the context was established
Token to be returned to the initiator
Services requested by the initiator
Seconds for which the context is valid for
Delegated credentials
More input is required to complete the exchange
Result when initiating a security context
Create new instance of InitSecContextResult(context, mech, flags, token, lifetime, more_steps)
The initiator security context
Mechanism used in the security context
Services available for the context
Token to be sent to the acceptor
Seconds for which the context is valid for
More input is required to complete the exchange
Information about the security context.
Create new instance of InquireContextResult(initiator_name, target_name, lifetime, mech, flags, locally_init, complete)
Name of the initiator
Name of the acceptor
Time valid for the security context, in seconds
Mech used to create the security context
Services available for the context
Context was initiated locally
Context has been established and ready to use
Result of the credential storing operation.
Create new instance of StoreCredResult(mechs, usage)
Mechs that were stored in the credential store
How the credential can be used
Unwrapped IOV message result.
Create new instance of IOVUnwrapResult(encrypted, qop)
Whether the message was encrypted and not just signed
The quality of protection applied to the message
Information about a GSSAPI Name.
Create new instance of InquireNameResult(attrs, is_mech_name, mech)
Set of attribute names
Name is a mechanism name
The mechanism if is_name_mech is True
GSSAPI Name attribute values.
Create new instance of GetNameAttributeResult(values, display_values, authenticated, complete)
Raw values
Human-readable values
Attribute has been authenticated
Attribute value is marked as complete
Set of attributes supported and known by a mechanism.
Create new instance of InquireAttrsResult(mech_attrs, known_mech_attrs)
The mechanisms attributes
Known attributes of the mechanism
Information about an attribute.
Create new instance of DisplayAttrResult(name, short_desc, long_desc)
The mechanism name
Short description of the mechanism
Long description of the mechanism
SASL informmation about a GSSAPI Name.
Create new instance of InquireSASLNameResult(sasl_mech_name, mech_name, mech_description)
The SASL name
The mechanism name
The mechanism description
Security context key data based on RFC1964.
Create new instance of Rfc1964KeyData(sign_alg, seal_alg, key_type, key)
Signing algorithm identifier
Sealing algorithm identifier
Key encryption type identifier
Encryption key data
Securty context key data.
Create new instance of CfxKeyData(ctx_key_type, ctx_key, acceptor_subkey_type, acceptor_subkey)
Context key encryption type identifier
Context key data - session or sub-session key
Acceptor key enc type identifier
Acceptor key data
Bases: Exception
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Retrieve all messages for a status code.
This method retrieves all human-readable messages available for the given status code.
code – the status code in question
is_maj – whether this is a major status code (True) or minor status code (False)
given code
[str]
Retrieves all messages for this error’s status codes
This method retrieves all messages for this error’s status codes, and forms them into a string for use as an exception message
a string for use as this error’s message
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: ParameterReadError
, BadNameError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: ParameterReadError
, BadNameTypeError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: ParameterReadError
, InvalidTokenError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: ParameterReadError
, MissingContextError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: ParameterReadError
, MissingCredentialsError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: ParameterWriteError
, MissingContextError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: ParameterWriteError
, MissingCredentialsError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: gssapi.raw.misc.GSSError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: SupplementaryError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: SupplementaryError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: SupplementaryError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: TokenOutOfSequenceError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
Bases: TokenOutOfSequenceError
A GSSAPI Error
This Exception represents an error returned from the GSSAPI C bindings. It contains the major and minor status codes returned by the method which caused the error, and can generate human-readable string messages from the error codes
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4