Package org.apache.geronimo.util.asn1.x509

Examples of org.apache.geronimo.util.asn1.x509.Attribute


                String ou = csrProps.getProperty("OU");
                String o = csrProps.getProperty("O");
                String l = csrProps.getProperty("L");
                String st = csrProps.getProperty("ST");
                String c = csrProps.getProperty("C");
                X509Name subject = CaUtils.getX509Name(cn, ou, o, l, st, c);
                Map certReqMap = CaUtils.processSPKAC(spkac);
                // Set the subject and publickey values to be shown in subsequent screens
                response.setRenderParameter("subject", subject.toString());
                response.setRenderParameter("publickey", certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ).toString());
            }
            return CONFIRM_CERT_REQ_MODE+BEFORE_ACTION;
        } catch(Exception e) {
            errorMsg = e.toString();
View Full Code Here


     */
    public X509Attribute(
        String          oid,
        ASN1Encodable   value)
    {
        this.attr = new Attribute(new ASN1ObjectIdentifier(oid), new DERSet(value));
    }
View Full Code Here

     */
    public X509Attribute(
        String              oid,
        ASN1EncodableVector value)
    {
        this.attr = new Attribute(new ASN1ObjectIdentifier(oid), new DERSet(value));
    }
View Full Code Here

     */
    public X509Attribute(
        String          oid,
        ASN1Encodable   value)
    {
        this.attr = new Attribute(new DERObjectIdentifier(oid), new DERSet(value));
    }
View Full Code Here

     */
    public X509Attribute(
        String              oid,
        ASN1EncodableVector value)
    {
        this.attr = new Attribute(new DERObjectIdentifier(oid), new DERSet(value));
    }
View Full Code Here

          ASN1Sequence seq = (ASN1Sequence)obj;
         
          String prefix = "";
      FastDateFormat dateF = FastDateFormat.getInstance("yyyyMMdd");
          for (int i = 0; i < seq.size(); i++) {
            Attribute attr = Attribute.getInstance(seq.getObjectAt(i));
            if (!StringUtils.isEmpty(result)) {
              prefix = ", ";
            }
            if (attr.getAttrType().getId().equals(id_pda_dateOfBirth)) {
              ASN1Set set = attr.getAttrValues();
              // Come on, we'll only allow one dateOfBirth, we're not allowing such frauds with multiple birth dates
              DERGeneralizedTime time = DERGeneralizedTime.getInstance(set.getObjectAt(0));
              Date date = time.getDate();
              String dateStr = dateF.format(date);
              result += prefix + "dateOfBirth="+dateStr;
            }
            if (attr.getAttrType().getId().equals(id_pda_placeOfBirth)) {
              ASN1Set set = attr.getAttrValues();
              // same here only one placeOfBirth
              String pb = ((DERString)set.getObjectAt(0)).getString();
              result += prefix + "placeOfBirth="+pb;             
            }
            if (attr.getAttrType().getId().equals(id_pda_gender)) {
              ASN1Set set = attr.getAttrValues();
              // same here only one gender
              String g = ((DERString)set.getObjectAt(0)).getString();
              result += prefix + "gender="+g;             
            }
            if (attr.getAttrType().getId().equals(id_pda_countryOfCitizenship)) {
              ASN1Set set = attr.getAttrValues();
              // same here only one citizenship
              String g = ((DERString)set.getObjectAt(0)).getString();
              result += prefix + "countryOfCitizenship="+g;             
            }
            if (attr.getAttrType().getId().equals(id_pda_countryOfResidence)) {
              ASN1Set set = attr.getAttrValues();
              // same here only one residence
              String g = ((DERString)set.getObjectAt(0)).getString();
              result += prefix + "countryOfResidence="+g;             
            }
          }
View Full Code Here

     * @return A Collection of ASN.1 Attribute (org.bouncycastle.asn1.x509), or an empty Collection, never null
     * @see #getSubjectDirectoryAttributes(Certificate)
     */
    public static Collection<Attribute> getSubjectDirectoryAttributes(String dirAttr) {
      ArrayList<Attribute> ret = new ArrayList<Attribute>();
      Attribute attr = null;
        String value = CertTools.getPartFromDN(dirAttr, "countryOfResidence");
        if (!StringUtils.isEmpty(value)) {
          ASN1EncodableVector vec = new ASN1EncodableVector();
          vec.add(new DERPrintableString(value));
          attr = new Attribute(new DERObjectIdentifier(id_pda_countryOfResidence),new DERSet(vec));
          ret.add(attr);
        }
        value = CertTools.getPartFromDN(dirAttr, "countryOfCitizenship");
        if (!StringUtils.isEmpty(value)) {
          ASN1EncodableVector vec = new ASN1EncodableVector();
          vec.add(new DERPrintableString(value));
          attr = new Attribute(new DERObjectIdentifier(id_pda_countryOfCitizenship),new DERSet(vec));
          ret.add(attr);
        }
        value = CertTools.getPartFromDN(dirAttr, "gender");
        if (!StringUtils.isEmpty(value)) {
          ASN1EncodableVector vec = new ASN1EncodableVector();
          vec.add(new DERPrintableString(value));
          attr = new Attribute(new DERObjectIdentifier(id_pda_gender),new DERSet(vec));
          ret.add(attr);
        }
        value = CertTools.getPartFromDN(dirAttr, "placeOfBirth");
        if (!StringUtils.isEmpty(value)) {
          ASN1EncodableVector vec = new ASN1EncodableVector();
          X509DefaultEntryConverter conv = new X509DefaultEntryConverter();
          DERObject obj = conv.getConvertedValue(new DERObjectIdentifier(id_pda_placeOfBirth), value);
          vec.add(obj);
          attr = new Attribute(new DERObjectIdentifier(id_pda_placeOfBirth),new DERSet(vec));
          ret.add(attr);
        }       
        // dateOfBirth that is a GeneralizedTime
        // The correct format for this is YYYYMMDD, it will be padded to YYYYMMDD120000Z
        value = CertTools.getPartFromDN(dirAttr, "dateOfBirth");
        if (!StringUtils.isEmpty(value)) {
            if (value.length() == 8) {
                value += "120000Z"; // standard format according to rfc3739
              ASN1EncodableVector vec = new ASN1EncodableVector();
                vec.add(new DERGeneralizedTime(value));
                attr = new Attribute(new DERObjectIdentifier(id_pda_dateOfBirth),new DERSet(vec));
                ret.add(attr);               
            } else {
                log.error("Wrong length of data for 'dateOfBirth', should be of format YYYYMMDD, skipping...");
            }
        }
View Full Code Here

                        "failed AC AttCertValidityPeriod test for id " + id);
            }

            // Attributes
            ASN1Sequence attribSeq = acInfo.getAttributes();
            Attribute att[] = new Attribute[attribSeq.size()];
            for (int i = 0; i < attribSeq.size(); i++)
            {
                att[i] = Attribute.getInstance(attribSeq.getObjectAt(i));
            }
View Full Code Here

     */
    public X509Attribute(
        String          oid,
        ASN1Encodable   value)
    {
        this.attr = new Attribute(new DERObjectIdentifier(oid), new DERSet(value));
    }
View Full Code Here

     */
    public X509Attribute(
        String              oid,
        ASN1EncodableVector value)
    {
        this.attr = new Attribute(new DERObjectIdentifier(oid), new DERSet(value));
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.util.asn1.x509.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.