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

    ASN1Sequence other = (ASN1Sequence) o;

    if (this.getSize() != other.getSize()) {
      return false;
    }

    Enumeration s1 = this.getObjects();
    Enumeration s2 = other.getObjects();

    while (s1.hasMoreElements()) {
      if (!s1.nextElement().equals(s2.nextElement())) {
        return false;
      }
    }

    return true;
  }