jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 51 6fe31bc95bbc
child 5457 d2782f1ecc9f
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 51
diff changeset
     2
 * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.security.auth.kerberos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.Arrays;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.crypto.SecretKey;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.security.auth.Destroyable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.security.auth.DestroyFailedException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import sun.misc.HexDumpEncoder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import sun.security.krb5.Asn1Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.security.krb5.PrincipalName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import sun.security.krb5.EncryptionKey;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import sun.security.krb5.EncryptedData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import sun.security.krb5.KrbException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import sun.security.krb5.KrbCryptoException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import sun.security.util.DerValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * This class encapsulates a Kerberos encryption key. It is not associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * with a principal and may represent an ephemeral session key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @author Mayank Upadhyay
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @serial include
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
class KeyImpl implements SecretKey, Destroyable, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    private static final long serialVersionUID = -7889313790214321193L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    private transient byte[] keyBytes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    private transient int keyType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private transient volatile boolean destroyed = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * Constructs a KeyImpl from the given bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * @param keyBytes the raw bytes for the secret key
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * @param keyType the key type for the secret key as defined by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * Kerberos protocol specification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    public KeyImpl(byte[] keyBytes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                       int keyType) {
51
6fe31bc95bbc 6600143: Remove another 450 unnecessary casts
martin
parents: 2
diff changeset
    69
        this.keyBytes = keyBytes.clone();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        this.keyType = keyType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * Constructs a KeyImpl from a password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @param principal the principal from which to derive the salt
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * @param password the password that should be used to compute the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @param algorithm the name for the algorithm that this key wil be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * used for. This parameter may be null in which case "DES" will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * assumed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    public KeyImpl(KerberosPrincipal principal,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
                   char[] password,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                   String algorithm) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            PrincipalName princ = new PrincipalName(principal.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            EncryptionKey key =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                new EncryptionKey(password, princ.getSalt(), algorithm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            this.keyBytes = key.getBytes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            this.keyType = key.getEType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        } catch (KrbException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            throw new IllegalArgumentException(e.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * Returns the keyType for this key as defined in the Kerberos Spec.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    public final int getKeyType() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        if (destroyed)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
            throw new IllegalStateException("This key is no longer valid");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        return keyType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * Methods from java.security.Key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    public final String getAlgorithm() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        return getAlgorithmName(keyType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    private String getAlgorithmName(int eType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        if (destroyed)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            throw new IllegalStateException("This key is no longer valid");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        switch (eType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        case EncryptedData.ETYPE_DES_CBC_CRC:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        case EncryptedData.ETYPE_DES_CBC_MD5:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            return "DES";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        case EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            return "DESede";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        case EncryptedData.ETYPE_ARCFOUR_HMAC:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            return "ArcFourHmac";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            return "AES128";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            return "AES256";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        case EncryptedData.ETYPE_NULL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            return "NULL";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            throw new IllegalArgumentException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                "Unsupported encryption type: " + eType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    public final String getFormat() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        if (destroyed)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            throw new IllegalStateException("This key is no longer valid");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        return "RAW";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    public final byte[] getEncoded() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        if (destroyed)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            throw new IllegalStateException("This key is no longer valid");
51
6fe31bc95bbc 6600143: Remove another 450 unnecessary casts
martin
parents: 2
diff changeset
   154
        return keyBytes.clone();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    public void destroy() throws DestroyFailedException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        if (!destroyed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            destroyed = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            Arrays.fill(keyBytes, (byte) 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    public boolean isDestroyed() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        return destroyed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @serialData this <code>KeyImpl</code> is serialized by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * writing out the ASN1 Encoded bytes of the encryption key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * The ASN1 encoding is defined in RFC4120 and as  follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * EncryptionKey   ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *          keytype    [0] Int32 -- actually encryption type --,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     *          keyvalue   [1] OCTET STRING
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    private void writeObject(ObjectOutputStream ois)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        if (destroyed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
           throw new IOException("This key is no longer valid");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
           ois.writeObject((new EncryptionKey(keyType, keyBytes)).asn1Encode());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        } catch (Asn1Exception ae) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
           throw new IOException(ae.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    private void readObject(ObjectInputStream ois)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                throws IOException, ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            EncryptionKey encKey = new EncryptionKey(new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                                     DerValue((byte[])ois.readObject()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            keyType = encKey.getEType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            keyBytes = encKey.getBytes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        } catch (Asn1Exception ae) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            throw new IOException(ae.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        HexDumpEncoder hd = new HexDumpEncoder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        return "EncryptionKey: keyType=" + keyType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                          + " keyBytes (hex dump)="
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                          + (keyBytes == null || keyBytes.length == 0 ?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                             " Empty Key" :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                             '\n' + hd.encode(keyBytes)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                          + '\n');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        int result = 17;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        if(isDestroyed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        result = 37 * result + Arrays.hashCode(keyBytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        return 37 * result + keyType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    public boolean equals(Object other) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        if (other == this)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        if (! (other instanceof KeyImpl)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        KeyImpl otherKey = ((KeyImpl) other);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        if (isDestroyed() || otherKey.isDestroyed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        if(keyType != otherKey.getKeyType() ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
                !Arrays.equals(keyBytes, otherKey.getEncoded())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
}