Пример #1
0
  public Request(ASN1Sequence seq) {
    reqCert = CertID.getInstance(seq.getObjectAt(0));

    if (seq.size() == 2) {
      singleRequestExtensions =
          X509Extensions.getInstance((ASN1TaggedObject) seq.getObjectAt(1), true);
    }
  }
Пример #2
0
  public 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 PBES2Parameters(ASN1Sequence obj) {
    Enumeration e = obj.getObjects();
    ASN1Sequence funcSeq = (ASN1Sequence) e.nextElement();

    if (funcSeq.getObjectAt(0).equals(id_PBKDF2)) {
      func = new KeyDerivationFunc(id_PBKDF2, PBKDF2Params.getInstance(funcSeq.getObjectAt(1)));
    } else {
      func = new KeyDerivationFunc(funcSeq);
    }

    scheme = new EncryptionScheme((ASN1Sequence) e.nextElement());
  }
Пример #4
0
 public static Request getInstance(ASN1TaggedObject obj, boolean explicit) {
   return getInstance(ASN1Sequence.getInstance(obj, explicit));
 }
  /**
   * Constructor from ASN1Sequence.
   *
   * <p>the extensions are a list of constructed sequences, either with (OID, OctetString) or (OID,
   * Boolean, OctetString)
   */
  public X509Extensions(ASN1Sequence seq) {
    Enumeration e = seq.getObjects();

    while (e.hasMoreElements()) {
      ASN1Sequence s = ASN1Sequence.getInstance(e.nextElement());

      if (s.size() == 3) {
        extensions.put(
            s.getObjectAt(0),
            new X509Extension(
                DERBoolean.getInstance(s.getObjectAt(1)),
                ASN1OctetString.getInstance(s.getObjectAt(2))));
      } else if (s.size() == 2) {
        extensions.put(
            s.getObjectAt(0),
            new X509Extension(false, ASN1OctetString.getInstance(s.getObjectAt(1))));
      } else {
        throw new IllegalArgumentException("Bad sequence size: " + s.size());
      }

      ordering.addElement(s.getObjectAt(0));
    }
  }
 public static X509Extensions getInstance(ASN1TaggedObject obj, boolean explicit) {
   return getInstance(ASN1Sequence.getInstance(obj, explicit));
 }