gssapi/creds.py
def export(self):
        """
        Serializes this credential into a byte string, which can be passed to :meth:`imprt` in
        another process in order to deserialize the byte string back into a credential. Exporting
        a credential does not destroy it.

        :returns: The serialized token representation of this credential.
        :rtype: bytes
        :raises: :exc:`~gssapi.error.GSSException` if there is a problem with exporting the
            credential.

            :exc:`NotImplementedError` if the underlying GSSAPI implementation does not
            support the ``gss_export_cred`` C function.
        """
        if not hasattr(C, 'gss_export_cred'):
            raise NotImplementedError("The GSSAPI implementation does not support gss_export_cred")

        minor_status = ffi.new('OM_uint32[1]')
        output_buffer = ffi.new('gss_buffer_desc[1]')
        retval = C.gss_export_cred(minor_status, self._cred[0], output_buffer)
        try:
            if GSS_ERROR(retval):
                raise _exception_for_status(retval, minor_status[0])

            return _buf_to_str(output_buffer[0])
        finally:
            if output_buffer[0].length != 0:
                C.gss_release_buffer(minor_status, output_buffer)
def export(self):
        """
        Serializes this credential into a byte string, which can be passed to :meth:`imprt` in
        another process in order to deserialize the byte string back into a credential. Exporting
        a credential does not destroy it.

        :returns: The serialized token representation of this credential.
        :rtype: bytes
        :raises: :exc:`~gssapi.error.GSSException` if there is a problem with exporting the
            credential.

            :exc:`NotImplementedError` if the underlying GSSAPI implementation does not
            support the ``gss_export_cred`` C function.
        """
        if not hasattr(C, 'gss_export_cred'):
            raise NotImplementedError("The GSSAPI implementation does not support gss_export_cred")

        minor_status = ffi.new('OM_uint32[1]')
        output_buffer = ffi.new('gss_buffer_desc[1]')
        retval = C.gss_export_cred(minor_status, self._cred[0], output_buffer)
        try:
            if GSS_ERROR(retval):
                raise _exception_for_status(retval, minor_status[0])

            return _buf_to_str(output_buffer[0])
        finally:
            if output_buffer[0].length != 0:
                C.gss_release_buffer(minor_status, output_buffer)
Serializes this credential into a byte string, which can be passed to :meth:`imprt` in
        another process in order to deserialize the byte string back into a credential. Exporting
        a credential does not destroy it.

        :returns: The serialized token representation of this credential.
        :rtype: bytes
        :raises: :exc:`~gssapi.error.GSSException` if there is a problem with exporting the
            credential.

            :exc:`NotImplementedError` if the underlying GSSAPI implementation does not
            support the ``gss_export_cred`` C function.