Beispiel #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());
    }
  }
  private PolicyConstraints(ASN1Sequence seq) {
    if (seq.size() > 2) {
      throw new IllegalArgumentException("sequence length > 2");
    }

    for (int i = 0; i < seq.size(); i++) {
      ASN1TaggedObject taggedObj = ASN1TaggedObject.getInstance(seq.getObjectAt(i));
      switch (taggedObj.getTagNo()) {
        case 0:
          requireExplicitPolicy =
              ASN1Integer.getInstance(taggedObj.getObject()).getValue().intValue();
          break;
        case 1:
          inhibitPolicyMapping =
              ASN1Integer.getInstance(taggedObj.getObject()).getValue().intValue();
          break;
        default:
          throw new IllegalArgumentException("wrong tag number");
      }
    }
  }