예제 #1
0
 /**
  * Constructor.
  *
  * @param roleAuthority the role authority of this RoleSyntax.
  * @param roleName the role name of this RoleSyntax.
  */
 public RoleSyntax(GeneralNames roleAuthority, GeneralName roleName) {
   if (roleName == null
       || roleName.getTagNo() != GeneralName.uniformResourceIdentifier
       || ((ASN1String) roleName.getName()).getString().equals("")) {
     throw new IllegalArgumentException(
         "the role name MUST be non empty and MUST " + "use the URI option of GeneralName");
   }
   this.roleAuthority = roleAuthority;
   this.roleName = roleName;
 }
예제 #2
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());
    }
  }
예제 #3
0
  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));
  }
예제 #4
0
 /** Returns the collection of pairs: (Integer (tag), Object (name value))* */
 @DSSource({DSSourceKind.SENSITIVE_UNCATEGORIZED})
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 13:00:57.585 -0500",
     hash_original_method = "393D0968412D8AD2DE170EB074DB113A",
     hash_generated_method = "5703127E086E9DCCAAFA514DF4493212")
 public Collection<List<?>> getPairsList() {
   Collection<List<?>> result = new ArrayList<List<?>>();
   if (generalNames == null) {
     return result;
   }
   for (GeneralName generalName : generalNames) {
     result.add(generalName.getAsList());
   }
   return result;
 }
예제 #5
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");
      }
    }
  }