krb5_mk_safe()--Create Kerberos KRB_SAFE Message


  Syntax
 #include <krb5.h>

 krb5_error_code krb5_mk_safe(
     krb5_context       context,
     krb5_auth_context      auth_context,  
     krb5_const krb5_data *   userdata,
     krb5_data *      out_data,
     krb5_replay_data *     replay_data);  
  Service Program Name: QSYS/QKRBGSS

  Default Public Authority: *USE

  Threadsafe: Conditional. See Usage Notes.

The krb5_mk_safe() function creates a Kerberos KRB_SAFE message using data supplied by the application. Messages created by the krb5_mk_safe() routine are integrity-protected. This routine returns an error if the message has been modified.


Authorities

No authorities are required.


Parameters

context  (Input)
The Kerberos context.

auth_context  (Input/Output)
The authentication context.

userdata  (Input)
The application data for the KRB_SAFE message.

out_data  (Output)
The KRB_SAFE message. The krb5_free_data_contents() routine should be called to release the storage pointed to by the data field of the krb5_data structure when it is no longer needed.

replay_data  (Output)
Replay information returned to the caller. This parameter is required if the KRB5_AUTH_CONTEXT_RET_TIME (x'00000002') or KRB5_AUTH_CONTEXT_RET_SEQUENCE (x'00000008') flag is set in the authentication context. Otherwise, NULL may be specified for this parameter.

Return Value

If no errors occur, the return value is 0. Otherwise, a Kerberos error code is returned.


Error Messages

Message ID Error Message Text
CPE3418 E Possible APAR condition or hardware failure.


Usage Notes

  1. The authentication context specifies the checksum type, the keyblock used to seed the checksum, the addresses of the sender and receiver, and the replay cache.

  2. Use the krb5_auth_con_setrcache() routine to set the replay cache in the authentication context.

  3. The local address in the authentication context is used to create the KRB_SAFE message and must be present. The remote address is optional. Use the krb5_auth_con_genaddrs() routine or a combination of the krb5_auth_con_setaddrs() and the krb5_auth_con_setports() routines to set the addresses in the authentication context. If the remote address is set, then the local address also must be set in the authentication context that is used for the krb5_rd_safe() routine. If port numbers are set, then they also must be set in the authentication context used for the krb5_rd_safe() routine.

  4. The authentication context flags determine whether sequence numbers or timestamps should be used to identify the message. Use the krb5_auth_con_set_flags() routine to set the authentication context flags.

  5. If timestamps are used (KRB5_AUTH_CONTEXT_DO_TIME (x'00000001') is set), an entry describing the message is entered in the replay cache so the caller can detect if this message is sent back by an attacker. An error is returned if the authentication context does not specify a replay cache.

  6. If sequence numbers are used (KRB5_AUTH_CONTEXT_DO_SEQUENCE (x'00000004') or KRB5_AUTH_CONTEXT_RET_SEQUENCE (x'00000008') is set), the local sequence number in the authentication context is placed in the protected message as its sequence number.

  7. The Kerberos protocol runtime provides no concurrency control for the authentication context. If the application wants to use the same authentication context in multiple threads, it is the responsibility of the application to serialize access to the authentication context so that only a single thread is accessing the authentication context at any time. Because message sequence numbers are contained in the authentication context, this serialization needs to be extended to encompass the message exchange between the two applications. Otherwise, message sequence errors are liable to occur if the messages are delivered out of sequence.


API introduced: V5R1

[ Back to top | Security APIs | UNIX-Type APIs | APIs by category ]