Beispiel #1
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();
 }
Beispiel #2
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));
  }
Beispiel #3
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);
    }
  }
  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));
    }
  }
 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;
 }
  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;
  }
Beispiel #8
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;
  }
  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;
  }
Beispiel #10
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);
 }
 private pkipublicationinfo(asn1sequence seq) {
   action = asn1integer.getinstance(seq.getobjectat(0));
   pubinfos = asn1sequence.getinstance(seq.getobjectat(1));
 }