---
name: "krb5_compare_creds"
section: "3"
platform: "linux"
package: "heimdal-dev"
version: "1.2.dfsg.1-2.1+lenny1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/krb5_compare_creds"
---

# krb5\_compare\_creds(3)

compare Kerberos 5 credentials

## NAME

**krb5\_compare\_creds** – compare Kerberos 5 credentials

## LIBRARY

Kerberos 5 Library (libkrb5, -lkrb5)

## SYNOPSIS

**#include \<krb5.h\>**

*krb5\_boolean*\

**krb5\_compare\_creds**(*krb5\_context context*, *krb5\_flags whichfields*, *const krb5\_creds \*mcreds*, *const krb5\_creds \*creds*);

## DESCRIPTION

**krb5\_compare\_creds**() compares *mcreds* (usually filled in by the application) to *creds* (most often from a credentials cache) and return TRUE if they are equal. Unless *mcreds-server* is NULL, the service of the credentials are always compared.  If the client name in *mcreds* is present, the client names are also compared. This function is normally only called indirectly via [krb5\_cc\_retrieve\_cred(3)](/krb5_cc_retrieve_cred/3.md).

The following flags, set in *whichfields*, affects the comparison:

- KRB5\_TC\_MATCH\_SRV\_NAMEONLY

  Consider all realms equal when comparing the service principal.

- KRB5\_TC\_MATCH\_KEYTYPE

  Compare enctypes.

- KRB5\_TC\_MATCH\_FLAGS\_EXACT

  Make sure that the ticket flags are identical.

- KRB5\_TC\_MATCH\_FLAGS

  Make sure that all ticket flags set in *mcreds* are also present  in *creds*.

- KRB5\_TC\_MATCH\_TIMES\_EXACT

  Compares the ticket times exactly.

- KRB5\_TC\_MATCH\_TIMES

  Compares only the expiration times of the creds.

- KRB5\_TC\_MATCH\_AUTHDATA

  Compares the authdata fields.

- KRB5\_TC\_MATCH\_2ND\_TKT

  Compares the second tickets (used by user-to-user authentication).

- KRB5\_TC\_MATCH\_IS\_SKEY

  Compares the existance of the second ticket.

## SEE ALSO

[krb5(3)](/krb5/3.md), [krb5\_cc\_retrieve\_cred(3)](/krb5_cc_retrieve_cred/3.md), [krb5\_creds(3)](/krb5_creds/3.md), [krb5\_get\_init\_creds(3)](/krb5_get_init_creds/3.md), [kerberos(8)](/kerberos/8.md)
