コード例 #1
0
ファイル: ResponseData.java プロジェクト: spacemeteor/telexme
  private ResponseData(ASN1Sequence seq) {
    int index = 0;

    if (seq.getObjectAt(0) instanceof ASN1TaggedObject) {
      ASN1TaggedObject o = (ASN1TaggedObject) seq.getObjectAt(0);

      if (o.getTagNo() == 0) {
        this.versionPresent = true;
        this.version = ASN1Integer.getInstance((ASN1TaggedObject) seq.getObjectAt(0), true);
        index++;
      } else {
        this.version = V1;
      }
    } else {
      this.version = V1;
    }

    this.responderID = ResponderID.getInstance(seq.getObjectAt(index++));
    this.producedAt = (DERGeneralizedTime) seq.getObjectAt(index++);
    this.responses = (ASN1Sequence) seq.getObjectAt(index++);

    if (seq.size() > index) {
      this.responseExtensions =
          Extensions.getInstance((ASN1TaggedObject) seq.getObjectAt(index), true);
    }
  }
コード例 #2
0
  public CertStatus(ASN1TaggedObject choice) {
    this.tagNo = choice.getTagNo();

    switch (choice.getTagNo()) {
      case 0:
        value = new DERNull();
        break;
      case 1:
        value = RevokedInfo.getInstance(choice, false);
        break;
      case 2:
        value = new DERNull();
    }
  }
コード例 #3
0
  public static DirectoryString getInstance(ASN1TaggedObject o, boolean explicit) {
    if (!explicit) {
      throw new IllegalArgumentException("choice item must be explicitly tagged");
    }

    return getInstance(o.getObject());
  }
コード例 #4
0
ファイル: PKIHeader.java プロジェクト: SreejitS/isaacyang1988
  private PKIHeader(ASN1Sequence seq) {
    Enumeration en = seq.getObjects();

    pvno = DERInteger.getInstance(en.nextElement());
    sender = GeneralName.getInstance(en.nextElement());
    recipient = GeneralName.getInstance(en.nextElement());

    while (en.hasMoreElements()) {
      ASN1TaggedObject tObj = (ASN1TaggedObject) en.nextElement();

      switch (tObj.getTagNo()) {
        case 0:
          messageTime = DERGeneralizedTime.getInstance(tObj, true);
          break;
        case 1:
          protectionAlg = AlgorithmIdentifier.getInstance(tObj, true);
          break;
        case 2:
          senderKID = ASN1OctetString.getInstance(tObj, true);
          break;
        case 3:
          recipKID = ASN1OctetString.getInstance(tObj, true);
          break;
        case 4:
          transactionID = ASN1OctetString.getInstance(tObj, true);
          break;
        case 5:
          senderNonce = ASN1OctetString.getInstance(tObj, true);
          break;
        case 6:
          recipNonce = ASN1OctetString.getInstance(tObj, true);
          break;
        case 7:
          freeText = PKIFreeText.getInstance(tObj, true);
          break;
        case 8:
          generalInfo = ASN1Sequence.getInstance(tObj, true);
          break;
        default:
          throw new IllegalArgumentException("unknown tag number: " + tObj.getTagNo());
      }
    }
  }
コード例 #5
0
  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");
      }
    }
  }
コード例 #6
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());
    }
  }
コード例 #7
0
  /**
   * @deprecated use getInstance()
   * @param seq
   */
  public RSAESOAEPparams(ASN1Sequence seq) {
    hashAlgorithm = DEFAULT_HASH_ALGORITHM;
    maskGenAlgorithm = DEFAULT_MASK_GEN_FUNCTION;
    pSourceAlgorithm = DEFAULT_P_SOURCE_ALGORITHM;

    for (int i = 0; i != seq.size(); i++) {
      ASN1TaggedObject o = (ASN1TaggedObject) seq.getObjectAt(i);

      switch (o.getTagNo()) {
        case 0:
          hashAlgorithm = AlgorithmIdentifier.getInstance(o, true);
          break;
        case 1:
          maskGenAlgorithm = AlgorithmIdentifier.getInstance(o, true);
          break;
        case 2:
          pSourceAlgorithm = AlgorithmIdentifier.getInstance(o, true);
          break;
        default:
          throw new IllegalArgumentException("unknown tag");
      }
    }
  }
コード例 #8
0
ファイル: OOBCertHash.java プロジェクト: zxlooong/ejbca4
  public OOBCertHash(ASN1Sequence seq) {
    Enumeration e = seq.getObjects();

    while (e.hasMoreElements()) {
      Object obj = e.nextElement();

      if (obj instanceof ASN1TaggedObject) {
        ASN1TaggedObject tagObj = (ASN1TaggedObject) obj;

        switch (tagObj.getTagNo()) {
          case 0:
            hashAlg = AlgorithmIdentifier.getInstance(tagObj.getObject());
            break;
          case 1:
            certId = CertId.getInstance(tagObj.getObject());
            break;
        }
      } else {
        hashVal = DERBitString.getInstance(obj);

        break;
      }
    }
  }
コード例 #9
0
 public static CertStatus getInstance(ASN1TaggedObject obj, boolean explicit) {
   return getInstance(obj.getObject()); // must be explicitly tagged
 }
コード例 #10
0
 public static AttCertIssuer getInstance(ASN1TaggedObject obj, boolean explicit) {
   return getInstance(obj.getObject()); // must be explictly tagged
 }