HP Open Source Security for OpenVMS Volume 3: Kerberos > Chapter 6 KRB5 (Kerberos V5) Application Programming Interface

krb5_kt_read_service_key — Retrieve a service key from the key table

  Table of Contents



C Prototype

krb5_error_code krb5_kt_read_service_key( \funcinout
krb5_context context,
krb5_pointer keyprocarg,
krb5_principal principal,
krb5_kvno vno,
krb5_keytype keytype,
krb5_keyblock **key );


context (input/output) 

The context structure.

keyprocarg (input)  

The name of a keytab, or NULL to use the default keytab.

principal (input)  

The service principal.

vno (input)  

Key version number. Use a vno of zero to specify the key with the highest version number.

keytype (input) 

The key encryption type. Use a keytype of zero if an encryption type does not matter.

key (output)  

The returned service key.


The routine opens and searches keytab for the entry identified by principal, keytype, and vno, returning the resulting key in *key or returning an error code if it is not found. If keyprocarg is not NULL, it is taken to be a char* denoting the name of a keytab. Otherwise, the default keytab will be used.

krb5_free_keyblock should be called on *key when the caller is finished with the key.

Return Values

This routine returns the following KRB5 status code:


Successful completion.