Package org.bouncycastle.asn1.x509

Examples of org.bouncycastle.asn1.x509.X509NameTokenizer


    public boolean hasUnsupportedCriticalExtension()
    {
        if (this.getVersion() == 3)
        {
            X509Extensions  extensions = c.getTBSCertificate().getExtensions();

            if (extensions != null)
            {
                Enumeration     e = extensions.oids();

                while (e.hasMoreElements())
                {
                    DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
                    if (oid.getId().equals("2.5.29.15")
                       || oid.getId().equals("2.5.29.19"))
                    {
                        continue;
                    }

                    X509Extension       ext = extensions.getExtension(oid);

                    if (ext.isCritical())
                    {
                        return true;
                    }
View Full Code Here


            {
                buf.append("                       " + new String(Hex.encode(sig, i, sig.length - i)) + nl);
            }
        }

        X509Extensions  extensions = c.getTBSCertificate().getExtensions();

        if (extensions != null)
        {
            Enumeration     e = extensions.oids();

            if (e.hasMoreElements())
            {
                buf.append("       Extensions: \n");
            }

            while (e.hasMoreElements())
            {
                DERObjectIdentifier     oid = (DERObjectIdentifier)e.nextElement();
                X509Extension           ext = extensions.getExtension(oid);

                if (ext.getValue() != null)
                {
                    byte[]                  octs = ext.getValue().getOctets();
                    ByteArrayInputStream    bIn = new ByteArrayInputStream(octs);
View Full Code Here

   
    certificateGenerator.setSignatureAlgorithm( "MD5WithRSAEncryption" );
   
    certificateGenerator.setSerialNumber( new BigInteger( ""+SystemTime.getCurrentTime()));
         
    X509Name  issuer_dn = new X509Name(true,cert_dn);
   
    certificateGenerator.setIssuerDN(issuer_dn);
   
    X509Name  subject_dn = new X509Name(true,cert_dn);
   
    certificateGenerator.setSubjectDN(subject_dn);
   
    Calendar  not_after = Calendar.getInstance();
   
View Full Code Here

            // Add the signerInfo version
            //
            signerinfo.add(new DERInteger(signerversion));

            IssuerAndSerialNumber isAnds = new IssuerAndSerialNumber(
                        new X509Name((ASN1Sequence)getIssuer(signCert.getTBSCertificate())),
                        new DERInteger(signCert.getSerialNumber()));
            signerinfo.add(isAnds);

            // Add the digestAlgorithm
            //
View Full Code Here

        return null;
      }

      Vector<DERObjectIdentifier> defaultOrdering = new Vector<DERObjectIdentifier>();
      Vector<String> values = new Vector<String>();
      X509NameTokenizer x509NameTokenizer = new X509NameTokenizer(dn);

      while (x509NameTokenizer.hasMoreTokens()) {
        // This is a pair key=val (CN=xx)
      String pair = x509NameTokenizer.nextToken()// Will escape '+' and initial '#' chars
        int index = pair.indexOf('=');

        if (index != -1) {
          String key = pair.substring(0, index).toLowerCase().trim();
          String val = pair.substring(index + 1);
View Full Code Here

      }*/
        boolean ret = false;
        if (dn != null) {
            String first = null;
            String last = null;
            X509NameTokenizer xt = new X509NameTokenizer(dn);
            if (xt.hasMoreTokens()) {
              first = xt.nextToken();
            }
            while (xt.hasMoreTokens()) {
                last = xt.nextToken();
            }
            String[] dNObjects = DnComponents.getDnObjects(true);
            if ( (first != null) && (last != null) ) {
              first = first.substring(0,first.indexOf('='));
              last = last.substring(0,last.indexOf('='));
View Full Code Here

      }
        String part = null;
        if ((dn != null) && (dnpart != null)) {
            String o;
            dnpart += "="; // we search for 'CN=' etc.
            X509NameTokenizer xt = new X509NameTokenizer(dn);
            while (xt.hasMoreTokens()) {
                o = xt.nextToken();
                //log.debug("checking: "+o.substring(0,dnpart.length()));
                if ((o.length() > dnpart.length()) &&
                        o.substring(0, dnpart.length()).equalsIgnoreCase(dnpart)) {
                    part = o.substring(dnpart.length());
View Full Code Here

    }
    ArrayList<String> parts = new ArrayList<String>();
    if ((dn != null) && (dnpart != null)) {
      String o;
      dnpart += "="; // we search for 'CN=' etc.
      X509NameTokenizer xt = new X509NameTokenizer(dn);
      while (xt.hasMoreTokens()) {
        o = xt.nextToken();
        if ((o.length() > dnpart.length()) &&
            o.substring(0, dnpart.length()).equalsIgnoreCase(dnpart)) {
          parts.add(o.substring(dnpart.length()));
        }
      }
View Full Code Here

      log.trace(">getCustomOids: dn:'" + dn);
    }
    ArrayList<String> parts = new ArrayList<String>();
    if (dn != null) {
      String o;
      X509NameTokenizer xt = new X509NameTokenizer(dn);
      while (xt.hasMoreTokens()) {
        o = xt.nextToken();
        // Try to see if it is a valid OID
        try {
          int i = o.indexOf('=');
          // An oid is never shorter than 3 chars and must start with 1.
          if ( (i > 2) && (o.charAt(1) == '.') ) {
View Full Code Here

    public static String insertCNPostfix(String dn, String cnpostfix){
      String newdn = null;
     
      if ((dn != null) && (cnpostfix != null)) {
          String o;         
          X509NameTokenizer xt = new X509NameTokenizer(dn);
          boolean alreadyreplaced = false;
          while (xt.hasMoreTokens()) {
              o = xt.nextToken();            
              if (!alreadyreplaced && (o.length() > 3) &&
                      o.substring(0, 3).equalsIgnoreCase("cn=")) {
                  o += cnpostfix;    
                  alreadyreplaced = true;
              }
View Full Code Here

TOP

Related Classes of org.bouncycastle.asn1.x509.X509NameTokenizer

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.