1 /*
   2  * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  */
  28 
  29 package sun.security.krb5.internal.crypto;
  30 
  31 /**
  32  * Key usages used for key derivation in Kerberos.
  33  */
  34 public class KeyUsage {
  35 
  36     private KeyUsage() {
  37     }
  38 
  39     public static final int KU_UNKNOWN = 0;                     // Cannot be 0
  40 
  41     // Defined in draft-yu-krb-wg-kerberos-extensions-00.txt, Appendix A
  42     public static final int KU_PA_ENC_TS = 1;                   // KrbAsReq
  43     public static final int KU_TICKET = 2;                      // KrbApReq (ticket)
  44     public static final int KU_ENC_AS_REP_PART = 3;             // KrbAsRep
  45     public static final int KU_TGS_REQ_AUTH_DATA_SESSKEY= 4;    // KrbTgsReq
  46     public static final int KU_TGS_REQ_AUTH_DATA_SUBKEY = 5;    // KrbTgsReq
  47     public static final int KU_PA_TGS_REQ_CKSUM = 6;            // KrbTgsReq
  48     public static final int KU_PA_TGS_REQ_AUTHENTICATOR = 7;    // KrbApReq
  49     public static final int KU_ENC_TGS_REP_PART_SESSKEY = 8;    // KrbTgsRep
  50     public static final int KU_ENC_TGS_REP_PART_SUBKEY = 9;     // KrbTgsRep
  51     public static final int KU_AUTHENTICATOR_CKSUM = 10;
  52     public static final int KU_AP_REQ_AUTHENTICATOR = 11;       // KrbApReq
  53     public static final int KU_ENC_AP_REP_PART = 12;            // KrbApRep
  54     public static final int KU_ENC_KRB_PRIV_PART = 13;          // KrbPriv
  55     public static final int KU_ENC_KRB_CRED_PART = 14;          // KrbCred
  56     public static final int KU_KRB_SAFE_CKSUM = 15;             // KrbSafe
  57     public static final int KU_PA_FOR_USER_ENC_CKSUM = 17;      // S4U2user
  58     public static final int KU_AD_KDC_ISSUED_CKSUM = 19;
  59     public static final int KU_AS_REQ = 56;
  60 
  61     public static final boolean isValid(int usage) {
  62         return usage >= 0;
  63     }
  64 }