public DERObject getDERObject() {
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(objectId);
    v.add(obj);

    return new DERSequence(v);
  }
  /**
   * Implementation of the method <code>toASN1Object</code> as required by the superclass <code>
   * ASN1Encodable</code>.
   *
   * <pre>
   * RoleSyntax ::= SEQUENCE {
   *                 roleAuthority  [0] GeneralNames OPTIONAL,
   *                 roleName       [1] GeneralName
   *           }
   * </pre>
   */
  public DERObject toASN1Object() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    if (this.roleAuthority != null) {
      v.add(new DERTaggedObject(false, 0, roleAuthority));
    }
    v.add(new DERTaggedObject(false, 1, roleName));

    return new DERSequence(v);
  }
  /**
   * Produce an object suitable for an ASN1OutputStream.
   *
   * <p>Returns:
   *
   * <p>
   *
   * <pre>
   *       CertificatePair ::= SEQUENCE {
   *         forward        [0]    Certificate OPTIONAL,
   *         reverse        [1]    Certificate OPTIONAL,
   *         -- at least one of the pair shall be present -- }
   * </pre>
   *
   * @return a DERObject
   */
  public DERObject toASN1Object() {
    ASN1EncodableVector vec = new ASN1EncodableVector();

    if (forward != null) {
      vec.add(new DERTaggedObject(0, forward));
    }
    if (reverse != null) {
      vec.add(new DERTaggedObject(1, reverse));
    }

    return new DERSequence(vec);
  }