Part IV : Secure Communications Using Stronger Encryption Algorithms

Exercise 7: Configuring to Use Stronger Encryption Algorithms in a Kerberos Environment, to Secure the Communication

Goal of This Exercise

The goal of this exercise is to learn how to use various Kerberos encryption algorithms to secure the communication. Java GSS/Kerberos provides a wide range of encryption algorithms, including AES256, AES128, 3DES, RC4-HMAC, and DES.

Note:

DES-based encryption types are disabled by default.

The following is a list of all the encryption types supported by the Java GSS/Kerberos provider in Java SE:

  • AES256-CTS
  • AES128-CTS
  • AES256-SHA2
  • AES128-SHA2
  • RC4-HMAC
  • DES3-CBC-SHA1
  • DES-CBC-MD5
  • DES-CBC-CRC

Steps to Follow

  1. Configure the Key Distribution Center (KDC) and update the Kerberos database.

    First, you need to update to use the KDC that supports the required Kerberos encryption types, such as the latest version of Solaris or the latest version of Kerberos from the MIT distribution. If you are using Active Directory on a Windows platform, the latest version also supports RC4-HMAC and AES encryption types.

    You need to update the Kerberos database to generate the new keys with stronger encryption algorithms. By default, Solaris 10 KDC will generate the keys for all the above encryption types listed. You can now create a keytab that will include all the keys for all the above encryption types.

    Note:

    If you want to use Windows 2000 KDC, you can configure to use the DES and RC4-HMAC encryption types that are available on Windows.

  2. Edit the Kerberos configuration file (krb5.conf).

    You will need to edit the Kerberos configuration file in order to select the desired encryption types used. The required parameters that you will need to insert under the libdefaults section of the Kerberos configuration file are listed below. For the purpose of this exercise, all the required entries have been added to a sample Kerberos configuration file included with the exercise, and the entries have been commented out. To enable the desired encryption type, you only need to uncomment the required entries.

    • To only enable AES256-CTS encryption type, add the following:

      [libdefaults]
      default_tkt_enctypes = aes256-cts
      default_tgs_enctypes = aes256-cts
      permitted_enctypes = aes256-cts

      Note:

      Solaris 10 11/06 and earlier does not support AES256 by default. You will need to install the following packages: SUNWcry, SUNWcryr, SUNWcryptoint.

    • To only enable AES128-CTS encryption type, add the following:

      [libdefaults]
      default_tkt_enctypes = aes128-cts
      default_tgs_enctypes = aes128-cts
      permitted_enctypes = aes128-cts
    • To only enable RC4-HMAC encryption type, add the following:

      [libdefaults]
      default_tkt_enctypes = rc4-hmac
      default_tgs_enctypes = rc4-hmac
      permitted_enctypes = rc4-hmac
    • To only enable DES3-CBC-SHA1 encryption type, add the following:

      [libdefaults]
      default_tkt_enctypes = des3-cbc-sha1
      default_tgs_enctypes = des3-cbc-sha1
      permitted_enctypes = des3-cbc-sha1

    Note:

    • If the above parameters are not added to the Kerberos configuration file, Solaris 10 11/06 and earlier will default to use AES128 enctype. If the exportable crypto packages have been installed, it will default to use AES256 enctype.

    • Destroy any pre-existing Kerberos TGT in the ticket cache from the previous exercise as follows:

      % kdestroy
  3. Launch a new window and start the server using the updated krb5.conf as follows:

    % java -Djava.security.auth.login.config=jaas-krb5.conf \
    -Djava.security.krb5.conf=krb5.conf GSSServer
  4. Run the client application using the updated krb5.conf. The GSSClient class takes two parameters: the service name and the name of the server that the service is running on. For example, if the service is host running on the machine j1hol-001, use the following (provide a secure password when prompted):

    % java -Djava.security.auth.login.config=jaas-krb5.conf \
    -Djava.security.krb5.conf=krb5.conf \
    GSSClient host j1hol-001

Summary

In this exercise, you learned how to write a client-server application that uses Java GSS API to authenticate and communicate securely using stronger Kerberos encryption algorithms. You can enable Kerberos debugging (-Dsun.security.krb5.debug=true), to obtain information about the Kerberos encryption type used.