Exemplo n.º 1
0
  private static String outputApplicationSpecific(
      String type, String indent, boolean verbose, DERObject obj, String nl) {
    DERApplicationSpecific app = (DERApplicationSpecific) obj;
    StringBuffer buf = new StringBuffer();

    if (app.isConstructed()) {
      try {
        ASN1Sequence s = ASN1Sequence.getInstance(app.getObject(DERTags.SEQUENCE));
        buf.append(indent + type + " ApplicationSpecific[" + app.getApplicationTag() + "]" + nl);
        for (Enumeration e = s.getObjects(); e.hasMoreElements(); ) {
          _dumpAsString(indent + TAB, verbose, (DERObject) e.nextElement(), buf);
        }
      } catch (IOException e) {
        buf.append(e);
      }
      return buf.toString();
    }

    return indent
        + type
        + " ApplicationSpecific["
        + app.getApplicationTag()
        + "] ("
        + new String(Hex.encode(app.getContents()))
        + ")"
        + nl;
  }
Exemplo n.º 2
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));
  }
Exemplo n.º 3
0
  public AttributeTypeAndValue[] getRegInfo() {
    if (regInfo == null) {
      return null;
    }

    AttributeTypeAndValue[] results = new AttributeTypeAndValue[regInfo.size()];

    for (int i = 0; i != results.length; i++) {
      results[i] = AttributeTypeAndValue.getInstance(regInfo.getObjectAt(i));
    }

    return results;
  }
Exemplo n.º 4
0
  private CertReqMsg(ASN1Sequence seq) {
    Enumeration en = seq.getObjects();

    certReq = CertRequest.getInstance(en.nextElement());
    while (en.hasMoreElements()) {
      Object o = en.nextElement();

      if (o instanceof ASN1TaggedObject || o instanceof ProofOfPossession) {
        popo = ProofOfPossession.getInstance(o);
      } else {
        regInfo = ASN1Sequence.getInstance(o);
      }
    }
  }
Exemplo n.º 5
0
  public static CertReqMsg getInstance(Object o) {
    if (o instanceof CertReqMsg) {
      return (CertReqMsg) o;
    } else if (o != null) {
      return new CertReqMsg(ASN1Sequence.getInstance(o));
    }

    return null;
  }
Exemplo n.º 6
0
  public TimeStampResp(ASN1Sequence seq) {

    Enumeration e = seq.getObjects();

    // status
    pkiStatusInfo = PKIStatusInfo.getInstance(e.nextElement());

    if (e.hasMoreElements()) {
      timeStampToken = ContentInfo.getInstance(e.nextElement());
    }
  }
Exemplo n.º 7
0
  public KeyAgreeRecipientInfo(ASN1Sequence seq) {
    int index = 0;

    version = (DERInteger) seq.getObjectAt(index++);
    originator =
        OriginatorIdentifierOrKey.getInstance((ASN1TaggedObject) seq.getObjectAt(index++), true);

    if (seq.getObjectAt(index) instanceof ASN1TaggedObject) {
      ukm = ASN1OctetString.getInstance((ASN1TaggedObject) seq.getObjectAt(index++), true);
    }

    keyEncryptionAlgorithm = AlgorithmIdentifier.getInstance(seq.getObjectAt(index++));

    recipientEncryptedKeys = (ASN1Sequence) seq.getObjectAt(index++);
  }
Exemplo n.º 8
0
  public CrlID(ASN1Sequence seq) {
    Enumeration e = seq.getObjects();

    while (e.hasMoreElements()) {
      ASN1TaggedObject o = (ASN1TaggedObject) e.nextElement();

      switch (o.getTagNo()) {
        case 0:
          crlUrl = DERIA5String.getInstance(o, true);
          break;
        case 1:
          crlNum = DERInteger.getInstance(o, true);
          break;
        case 2:
          crlTime = DERGeneralizedTime.getInstance(o, true);
          break;
        default:
          throw new IllegalArgumentException("unknown tag number: " + o.getTagNo());
      }
    }
  }
Exemplo n.º 9
0
 /**
  * return a KeyAgreeRecipientInfo object from a tagged object.
  *
  * @param obj the tagged object holding the object we want.
  * @param explicit true if the object is meant to be explicitly tagged false otherwise.
  * @exception IllegalArgumentException if the object held by the tagged object cannot be
  *     converted.
  */
 public static KeyAgreeRecipientInfo getInstance(ASN1TaggedObject obj, boolean explicit) {
   return getInstance(ASN1Sequence.getInstance(obj, explicit));
 }
Exemplo n.º 10
0
 /**
  * return an RecipientEncryptedKey object from a tagged object.
  *
  * @param obj the tagged object holding the object we want.
  * @param explicit true if the object is meant to be explicitly tagged false otherwise.
  * @exception IllegalArgumentException if the object held by the tagged object cannot be
  *     converted.
  */
 public static RecipientEncryptedKey getInstance(ASN1TaggedObject obj, boolean explicit) {
   return getInstance(ASN1Sequence.getInstance(obj, explicit));
 }
Exemplo n.º 11
0
 private RecipientEncryptedKey(ASN1Sequence seq) {
   identifier = KeyAgreeRecipientIdentifier.getInstance(seq.getObjectAt(0));
   encryptedKey = (ASN1OctetString) seq.getObjectAt(1);
 }