public esscertidv2[] getcerts() {
   esscertidv2[] certids = new esscertidv2[certs.size()];
   for (int i = 0; i != certs.size(); i++) {
     certids[i] = esscertidv2.getinstance(certs.getobjectat(i));
   }
   return certids;
 }
Esempio n. 2
0
 /**
  * constructor from asn1sequence.
  *
  * <p>the sequence is of type certhash:
  *
  * <p>
  *
  * <pre>
  *     certhash ::= sequence {
  *       hashalgorithm algorithmidentifier,
  *       certificatehash octet string
  *     }
  * </pre>
  *
  * @param seq the asn.1 sequence.
  */
 private certhash(asn1sequence seq) {
   if (seq.size() != 2) {
     throw new illegalargumentexception("bad sequence size: " + seq.size());
   }
   hashalgorithm = algorithmidentifier.getinstance(seq.getobjectat(0));
   certificatehash = deroctetstring.getinstance(seq.getobjectat(1)).getoctets();
 }
Esempio n. 3
0
  private attribute(asn1sequence seq) {
    if (seq.size() != 2) {
      throw new illegalargumentexception("bad sequence size: " + seq.size());
    }

    attrtype = asn1objectidentifier.getinstance(seq.getobjectat(0));
    attrvalues = asn1set.getinstance(seq.getobjectat(1));
  }
Esempio n. 4
0
  private signature(asn1sequence seq) {
    signaturealgorithm = algorithmidentifier.getinstance(seq.getobjectat(0));
    signature = (derbitstring) seq.getobjectat(1);

    if (seq.size() == 3) {
      certs = asn1sequence.getinstance((asn1taggedobject) seq.getobjectat(2), true);
    }
  }
  public policyinformation[] getpolicies() {
    if (policies == null) {
      return null;
    }

    policyinformation[] policyinformations = new policyinformation[policies.size()];
    for (int i = 0; i != policies.size(); i++) {
      policyinformations[i] = policyinformation.getinstance(policies.getobjectat(i));
    }
    return policyinformations;
  }
  public singlepubinfo[] getpubinfos() {
    if (pubinfos == null) {
      return null;
    }

    singlepubinfo[] results = new singlepubinfo[pubinfos.size()];

    for (int i = 0; i != results.length; i++) {
      results[i] = singlepubinfo.getinstance(pubinfos.getobjectat(i));
    }

    return results;
  }
Esempio n. 7
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;
  }
Esempio n. 8
0
  private pkifreetext(asn1sequence seq) {
    enumeration e = seq.getobjects();
    while (e.hasmoreelements()) {
      if (!(e.nextelement() instanceof derutf8string)) {
        throw new illegalargumentexception("attempt to insert non utf8 string into pkifreetext");
      }
    }

    strings = seq;
  }
  public list getextendedkeyusage() throws certificateparsingexception {
    byte[] bytes = this.getextensionbytes("2.5.29.37");

    if (bytes != null) {
      try {
        asn1inputstream din = new asn1inputstream(bytes);
        asn1sequence seq = (asn1sequence) din.readobject();
        list list = new arraylist();

        for (int i = 0; i != seq.size(); i++) {
          list.add(((asn1objectidentifier) seq.getobjectat(i)).getid());
        }

        return collections.unmodifiablelist(list);
      } catch (exception e) {
        throw new certificateparsingexception("error processing extended key usage extension");
      }
    }

    return null;
  }
Esempio n. 10
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) {
        pop = proofofpossession.getinstance(o);
      } else {
        reginfo = asn1sequence.getinstance(o);
      }
    }
  }
  private signingcertificatev2(asn1sequence seq) {
    if (seq.size() < 1 || seq.size() > 2) {
      throw new illegalargumentexception("bad sequence size: " + seq.size());
    }

    this.certs = asn1sequence.getinstance(seq.getobjectat(0));

    if (seq.size() > 1) {
      this.policies = asn1sequence.getinstance(seq.getobjectat(1));
    }
  }
Esempio n. 12
0
 /**
  * return the utf8string at index i.
  *
  * @param i index of the string of interest
  * @return the string at index i.
  */
 public derutf8string getstringat(int i) {
   return (derutf8string) strings.getobjectat(i);
 }
Esempio n. 13
0
 /**
  * return the number of string elements present.
  *
  * @return number of elements present.
  */
 public int size() {
   return strings.size();
 }
 private pkipublicationinfo(asn1sequence seq) {
   action = asn1integer.getinstance(seq.getobjectat(0));
   pubinfos = asn1sequence.getinstance(seq.getobjectat(1));
 }