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()); }
/** * 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)); } }