jdk/src/share/classes/sun/security/krb5/EncryptionKey.java
changeset 18168 f47169155ea0
parent 14895 5ad2d7032375
child 18536 092411ced388
equal deleted inserted replaced
18167:fb6a6363109c 18168:f47169155ea0
    94     }
    94     }
    95 
    95 
    96     public synchronized Object clone() {
    96     public synchronized Object clone() {
    97         return new EncryptionKey(keyValue, keyType, kvno);
    97         return new EncryptionKey(keyValue, keyType, kvno);
    98     }
    98     }
    99 
       
   100     /**
       
   101      * Obtains the latest version of the secret key of
       
   102      * the principal from a keytab.
       
   103      *
       
   104      * @param princ the principal whose secret key is desired
       
   105      * @param keytab the path to the keytab file. A value of null
       
   106      * will be accepted to indicate that the default path should be
       
   107      * searched.
       
   108      * @returns the secret key or null if none was found.
       
   109      */
       
   110     /*
       
   111     // Replaced by acquireSecretKeys
       
   112     public static EncryptionKey acquireSecretKey(PrincipalName princ,
       
   113                                                  String keytab)
       
   114         throws KrbException, IOException {
       
   115 
       
   116         if (princ == null) {
       
   117             throw new IllegalArgumentException(
       
   118                 "Cannot have null pricipal name to look in keytab.");
       
   119         }
       
   120 
       
   121         KeyTab ktab = KeyTab.getInstance(keytab);
       
   122 
       
   123         if (ktab == null)
       
   124             return null;
       
   125 
       
   126         return ktab.readServiceKey(princ);
       
   127     }
       
   128     */
       
   129 
    99 
   130     /**
   100     /**
   131      * Obtains all versions of the secret key of the principal from a
   101      * Obtains all versions of the secret key of the principal from a
   132      * keytab.
   102      * keytab.
   133      *
   103      *
   206      */
   176      */
   207     public static EncryptionKey[] acquireSecretKeys(char[] password,
   177     public static EncryptionKey[] acquireSecretKeys(char[] password,
   208             String salt) throws KrbException {
   178             String salt) throws KrbException {
   209 
   179 
   210         int[] etypes = EType.getDefaults("default_tkt_enctypes");
   180         int[] etypes = EType.getDefaults("default_tkt_enctypes");
   211         if (etypes == null) {
       
   212             etypes = EType.getBuiltInDefaults();
       
   213         }
       
   214 
   181 
   215         EncryptionKey[] encKeys = new EncryptionKey[etypes.length];
   182         EncryptionKey[] encKeys = new EncryptionKey[etypes.length];
   216         for (int i = 0; i < etypes.length; i++) {
   183         for (int i = 0; i < etypes.length; i++) {
   217             if (EType.isSupported(etypes[i])) {
   184             if (EType.isSupported(etypes[i])) {
   218                 encKeys[i] = new EncryptionKey(
   185                 encKeys[i] = new EncryptionKey(