/** * Basic constructor. * <p> * Note: Early on a lot of CAs would only accept messages with attributes missing. As the ASN.1 def shows * the attributes field is not optional so should always at least contain an empty set. If a fully compliant * request is required, pass in an empty set, the class will otherwise interpret a null as it should * encode the request with the field missing. * </p> * * @param subject subject to be associated with the public key * @param pkInfo public key to be associated with subject * @param attributes any attributes to be associated with the request. */ public CertificationRequestInfo( X500Name subject, SubjectPublicKeyInfo pkInfo, ASN1Set attributes) { if ((subject == null) || (pkInfo == null)) { throw new IllegalArgumentException("Not all mandatory fields set in CertificationRequestInfo generator."); } validateAttributes(attributes); this.subject = subject; this.subjectPKInfo = pkInfo; this.attributes = attributes; }
/** * @deprecated use getInstance(). */ public CertificationRequestInfo( ASN1Sequence seq) { version = (ASN1Integer)seq.getObjectAt(0); subject = X500Name.getInstance(seq.getObjectAt(1)); subjectPKInfo = SubjectPublicKeyInfo.getInstance(seq.getObjectAt(2)); // // some CertificationRequestInfo objects seem to treat this field // as optional. // if (seq.size() > 3) { ASN1TaggedObject tagobj = (ASN1TaggedObject)seq.getObjectAt(3); attributes = ASN1Set.getInstance(tagobj, false); } validateAttributes(attributes); if ((subject == null) || (version == null) || (subjectPKInfo == null)) { throw new IllegalArgumentException("Not all mandatory fields set in CertificationRequestInfo generator."); } }