public boolean equals(
        Object  obj)
    {
        if ((obj == null) || !(obj instanceof SecretKeySpec))
        {
            return false;
        }

        SecretKeySpec spec = (SecretKeySpec)obj;

        if (!this.algorithm.equalsIgnoreCase(spec.algorithm))
        {
            return false;
        }

        if (this.key.length != spec.key.length)
        {
            return false;
        }

        for (int i = 0; i != this.key.length; i++)
        {
            if (this.key[i] != spec.key[i])
            {
                return false;
            }
        }

        return true;
    }