jdk/src/share/classes/sun/security/krb5/EncryptionKey.java
changeset 5774 4b9857e483c1
parent 5506 202f599c92aa
child 5802 ea99d72d3c19
equal deleted inserted replaced
5773:f66c0faf0184 5774:4b9857e483c1
    73     private int keyType;
    73     private int keyType;
    74     private byte[] keyValue;
    74     private byte[] keyValue;
    75     private Integer kvno; // not part of ASN1 encoding;
    75     private Integer kvno; // not part of ASN1 encoding;
    76 
    76 
    77     private static final boolean DEBUG = Krb5.DEBUG;
    77     private static final boolean DEBUG = Krb5.DEBUG;
       
    78 
       
    79     public static int[] getETypes(EncryptionKey[] keys) {
       
    80         int len = keys.length;
       
    81         int[] result = new int[len];
       
    82         int count = 0;  // Number of elements in result. Might be less than
       
    83                         // len if there are keys having the same etype
       
    84         loopi: for (int i=0; i<len; i++) {
       
    85             int eType = keys[i].getEType();
       
    86             for (int j=0; j<count; j++) {
       
    87                 if (result[j] == eType) {
       
    88                     continue loopi;
       
    89                 }
       
    90             }
       
    91             result[count++] = eType;
       
    92         }
       
    93         if (count != len) {
       
    94             result = Arrays.copyOf(result, count);
       
    95         }
       
    96         return result;
       
    97     }
    78 
    98 
    79     public synchronized int getEType() {
    99     public synchronized int getEType() {
    80         return keyType;
   100         return keyType;
    81     }
   101     }
    82 
   102