Package org.apache.geronimo.crypto.asn1.x509

Examples of org.apache.geronimo.crypto.asn1.x509.X509Name


        privKey = fact.generatePrivate(privKeySpec);
        pubKey = fact.generatePublic(pubKeySpec);

        PKCS10CertificationRequest req = new PKCS10CertificationRequest(
                        algorithm, new X509Name("CN=XXX"), pubKey, null, privKey);
        if (!req.verify())
        {
            fail("Failed verify check EC.");
        }

        req = new PKCS10CertificationRequest(req.getEncoded());
        if (!req.verify())
        {
            fail("Failed verify check EC encoded.");
        }
       
        //
        // try with point compression turned off
        //
        ((ECPointEncoder)pubKey).setPointFormat("UNCOMPRESSED");
       
        req = new PKCS10CertificationRequest(
                        algorithm, new X509Name("CN=XXX"), pubKey, null, privKey);
        if (!req.verify())
        {
            fail("Failed verify check EC uncompressed.");
        }
       
View Full Code Here


        KeyPair             pair = ecGostKpg.generateKeyPair();
        PrivateKey          privKey = pair.getPrivate();
        PublicKey           pubKey = pair.getPublic();

        PKCS10CertificationRequest req = new PKCS10CertificationRequest(
                        algorithm, new X509Name("CN=XXX"), pubKey, null, privKey);
        if (!req.verify())
        {
            fail("Failed verify check EC.");
        }
View Full Code Here

        PrivateKey privKey = fact.generatePrivate(privKeySpec);
        PublicKey pubKey = fact.generatePublic(pubKeySpec);

        PKCS10CertificationRequest req = new PKCS10CertificationRequest(
                        algorithm, new X509Name("CN=XXX"), pubKey, null, privKey);
        if (!req.verify())
        {
            fail("Failed verify check PSS.");
        }
View Full Code Here

        g.initialize(ecSpec, new SecureRandom());

        KeyPair kp = g.generateKeyPair();

        req = new PKCS10CertificationRequest(
                "ECDSAWITHSHA1", new X509Name("CN=XXX"), kp.getPublic(), null, kp.getPrivate());
        if (!req.verify())
        {
            fail("Failed verify check EC.");
        }
       
View Full Code Here

    usernameGeneratorParams.setPrefix(null);
    usernameGeneratorParams.setPostfix(null);
    UsernameGenerator usernameGenerator = UsernameGenerator.getInstance(usernameGeneratorParams);

    final String errorMessage = "Did not generate an expected username.";
    assertEquals(errorMessage, "test", usernameGenerator.generateUsername(new X509Name("CN=test").toString()));
    assertEquals(errorMessage, null, usernameGenerator.generateUsername("".toString()));
    assertEquals(errorMessage, null, usernameGenerator.generateUsername(" ".toString()));
    assertEquals(errorMessage, "test", usernameGenerator.generateUsername(new X509Name("CN=test, serialNumber=1234").toString()));
    assertEquals(errorMessage, null, usernameGenerator.generateUsername(new X509Name("O=org").toString()));
    assertEquals(errorMessage, "12345", usernameGenerator.generateUsername("CN=test, SN=12345"));
    assertEquals(errorMessage, "1234", usernameGenerator.generateUsername("SN=1234"));
   
    // These wont work since new X509Name converts SN to SERIALNUMBER in toString()
    // Is this something we should compensate for in CertTools.getPartFromDN(...) ?
View Full Code Here

        } else {
            log.info("Using named curve parameter encoding for ECC key.");
        }
        final PKCS10CertificationRequest certReq =
            new PKCS10CertificationRequest( sigAlg,
                                            sDN!=null ? new X509Name(sDN) : new X509Name("CN="+alias),
                                            publicKey, new DERSet(),
                                            privateKey,
                                            this.keyStore.getProvider().getName() );
        if ( !certReq.verify() ) {
            String msg = intres.getLocalizedMessage("catoken.errorcertreqverify", alias);
View Full Code Here

        } else {
            log.warn("Huh, what's this? DN: " + dn+" PAIR: "+pair);
        }
      }

      X509Name x509Name = new X509Name(defaultOrdering, values, converter);

      //-- Reorder fields
      X509Name orderedX509Name = getOrderedX509Name(x509Name, ldaporder, converter);

      //log.trace("<stringToBcX509Name");
      return orderedX509Name;
    } // stringToBcX509Name
View Full Code Here

        detectUnescapedPlus(dn)// Log warning if dn contains unescaped '+'
      if (isDNReversed(dn)) {
        dn = reverseDN(dn);
      }
        String ret = null;
        X509Name name = stringToBcX509Name(dn);
        if (name != null) {
            ret = name.toString();
        }
        // For some databases (MySQL for instance) the database column holding subjectDN
        // is only 250 chars long. There have been strange error reported (clipping DN natuarally)
        // that is hard to debug if DN is more than 250 chars and we don't have a good message
        if ( (ret != null) && (ret.length() > 250) ) {
View Full Code Here

            }
        }
       
        String directoryName = getDirectoryStringFromAltName(altName);
        if (directoryName != null) {
          X509Name x509DirectoryName = new X509Name(directoryName);
          GeneralName gn = new GeneralName(4, x509DirectoryName);
          vec.add(gn);
        }
                               
        ArrayList<String> uri = CertTools.getPartsFromDN(altName, CertTools.URI);
View Full Code Here

          }
          Collections.reverse(newOrdering);
          Collections.reverse(newValues);
        }
        //-- Return X509Name with the ordered fields
        return new X509Name(new Vector<DERObjectIdentifier>(newOrdering), new Vector<Object>(newValues), converter);
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.crypto.asn1.x509.X509Name

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.