The general steps for using GSS-API are as follows:
Each application, both sender and recipient, acquires credentials explicitly, unless credentials have been acquired automatically.
The sender initiates a security context. The recipient accepts the context.
The sender applies security protection to the data to be transmitted. The sender either encrypts the message or stamps the data with an identification tag. The sender then transmits the protected message.
The sender can choose not to apply either security protection, in which case the message has only the default GSS-API security service, that is, authentication.
The recipient decrypts the message if needed and verifies the message if appropriate.
(Optional) The recipient returns an identification tag to the sender for confirmation.
Both applications destroy the shared security context. If necessary, the allocations can also deallocate any remaining GSS-API data.
The calling application is responsible for freeing all data space that has been allocated.