Exemple #1
0
  public GeneralSubtree(ASN1Sequence seq) {
    base = GeneralName.getInstance(seq.getObjectAt(0));

    switch (seq.size()) {
      case 1:
        break;
      case 2:
        ASN1TaggedObject o = ASN1TaggedObject.getInstance(seq.getObjectAt(1));
        switch (o.getTagNo()) {
          case 0:
            minimum = DERInteger.getInstance(o, false);
            break;
          case 1:
            maximum = DERInteger.getInstance(o, false);
            break;
          default:
            throw new IllegalArgumentException("Bad tag number: " + o.getTagNo());
        }
        break;
      case 3:
        minimum = DERInteger.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(1)));
        maximum = DERInteger.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(2)));
        break;
      default:
        throw new IllegalArgumentException("Bad sequence size: " + seq.size());
    }
  }
  public AccessDescription(ASN1Sequence seq) {
    if (seq.size() != 2) {
      throw new IllegalArgumentException("wrong number of elements in sequence");
    }

    accessMethod = DERObjectIdentifier.getInstance(seq.getObjectAt(0));
    accessLocation = GeneralName.getInstance(seq.getObjectAt(1));
  }
Exemple #3
0
  /**
   * Constructor that builds an instance of <code>RoleSyntax</code> by extracting the encoded
   * elements from the <code>ASN1Sequence</code> object supplied.
   *
   * @param seq an instance of <code>ASN1Sequence</code> that holds the encoded elements used to
   *     build this <code>RoleSyntax</code>.
   */
  private RoleSyntax(ASN1Sequence seq) {
    if (seq.size() < 1 || seq.size() > 2) {
      throw new IllegalArgumentException("Bad sequence size: " + seq.size());
    }

    for (int i = 0; i != seq.size(); i++) {
      ASN1TaggedObject taggedObject = ASN1TaggedObject.getInstance(seq.getObjectAt(i));
      switch (taggedObject.getTagNo()) {
        case 0:
          roleAuthority = GeneralNames.getInstance(taggedObject, false);
          break;
        case 1:
          roleName = GeneralName.getInstance(taggedObject, true);
          break;
        default:
          throw new IllegalArgumentException("Unknown tag in RoleSyntax");
      }
    }
  }